List of usage examples for java.lang Long valueOf
@HotSpotIntrinsicCandidate public static Long valueOf(long l)
From source file:com.panet.imeta.core.playlist.FilePlayListReplayLineNumberFile.java
private void initialize(FileObject lineNumberFile, String encoding) throws KettleException { BufferedReader reader = null; try {// w w w . j a va 2 s . c o m if (encoding == null) reader = new BufferedReader(new InputStreamReader(KettleVFS.getInputStream(lineNumberFile))); else reader = new BufferedReader( new InputStreamReader(KettleVFS.getInputStream(lineNumberFile), encoding)); String line = null; while ((line = reader.readLine()) != null) { if (line.length() > 0) lineNumbers.add(Long.valueOf(line)); } } catch (Exception e) { throw new KettleException("Could not read line number file " + lineNumberFile.getName().getURI(), e); } finally { if (reader != null) try { reader.close(); } catch (IOException e) { LogWriter.getInstance().logBasic("TextFilePlayLineNumber", "Could not close line number file " + lineNumberFile.getName().getURI()); } } }
From source file:com.android.vending.licensing.i.java
private void a(String paramString) { try {/*w w w . java 2s . co m*/ Long localLong2 = Long.valueOf(Long.parseLong(paramString)); localLong1 = localLong2; this.m = localLong1.longValue(); this.s.a("validityTimestamp", paramString); return; } catch (NumberFormatException localNumberFormatException) { while (true) { Log.w("ServerManagedPolicy", "License validity timestamp (VT) missing, caching for a minute"); Long localLong1 = Long.valueOf(60000L + System.currentTimeMillis()); paramString = Long.toString(localLong1.longValue()); } } }
From source file:cn.com.cennavi.visualizer.service.ExecuteController.java
@RequestMapping(value = RestNameAPIContant.EXCEL_TO_WORD, method = RequestMethod.POST) public ModelAndView excel2Word(@RestBeanVariable ExecuteParams params, HttpServletRequest request, HttpServletResponse response) throws Exception { JSONObject jsonObject = new JSONObject(); try {/*from www.j av a2s . c o m*/ String license = new String(SBase64.decode(params.getLicense()), "utf-8"); String[] _license = license.split("#"); if (_license.length == 2) { Long s = Long.valueOf(_license[0]) * 1000; if (s < System.currentTimeMillis()) { jsonObject.put("error", "error license"); } if (ObjUtil.isEmpty(_license[1])) { jsonObject.put("error", "error license"); } params.setSign_str(_license[1]); JSONArray array = new JSONArray(); ExecuteIfTemplateService ifTemplateService = new ExecuteIfTemplateService(); if (params.getIf_file() != null) { ifTemplateService.execute(params.getIf_file()); } ExecuteParseExcelService executeParseExcelService = new ExecuteParseExcelService(); List<ExecuteParseExcelService.Student> students = executeParseExcelService.execute(params); if ("2".equalsIgnoreCase(params.getDomethod())) { ExecuteCompareService_2 executeCompareService_2 = new ExecuteCompareService_2(); executeCompareService_2.compare(students, params, ifTemplateService); ExecuteWordService executeWordService = new ExecuteWordService(); byte[] word = executeWordService.execute(students, params); array.put(createFile(word, "toword", "docx")); } else if ("3".equalsIgnoreCase(params.getDomethod())) { ExecuteGroupService executeGroupService = new ExecuteGroupService(); Map<String, List<String[]>> group = executeGroupService.execute(students); ExecuteGroupExcelService groupExcelService = new ExecuteGroupExcelService(); byte[] excel = groupExcelService.execute(group); array.put(createFile(excel, "toexcel", "xls")); } else { ExecuteCompareService executeCompareService = new ExecuteCompareService(); executeCompareService.compare(students, params, ifTemplateService); ExecuteWordService executeWordService = new ExecuteWordService(); byte[] word = executeWordService.execute(students, params); array.put(createFile(word, "toword", "docx")); } jsonObject.put("files", array); jsonObject.put("error", ""); } else { jsonObject.put("error", "error license"); } } catch (Exception e) { e.printStackTrace(); jsonObject.put("error", "error license"); } finally { this.returnAjax(jsonObject.toString(), request, response); } return null; }
From source file:com.inkubator.hrm.web.converter.ModelReferensiConverter.java
@Override public String getAsString(FacesContext context, UIComponent component, Object value) { String message = StringUtils.EMPTY; // Pay Salary Component id String paySalaryComponentId = component.getAttributes().get("paySalaryComponentId").toString(); try {//from w w w . j a va 2s.c o m //get specifik from paysalaryComponent->modelComponent->specifik PaySalaryComponentService paySalaryComponentService = (PaySalaryComponentService) ServiceWebUtil .getService("paySalaryComponentService"); PaySalaryComponent paySalaryComponent = paySalaryComponentService .getEntityByPkWithDetail(Long.valueOf(paySalaryComponentId)); //if specific == loan schema if (Objects.equals(paySalaryComponent.getModelComponent().getSpesific(), HRMConstant.MODEL_COMP_LOAN)) { LoanSchemaService loanSchemaService = (LoanSchemaService) ServiceWebUtil .getService("loanSchemaService"); message = loanSchemaService .getLoanSchemaNameByPk(Long.valueOf(paySalaryComponent.getModelReffernsil())); } //if specific == reimbursment schema if (Objects.equals(paySalaryComponent.getModelComponent().getSpesific(), HRMConstant.MODEL_COMP_REIMBURSEMENT)) { ReimbursmentSchemaService reimbursmentSchemaService = (ReimbursmentSchemaService) ServiceWebUtil .getService("reimbursmentSchemaService"); message = reimbursmentSchemaService .getReimbursmentSchemaNameByPk(Long.valueOf(paySalaryComponent.getModelReffernsil())); } //if specific ==benefit group if (Objects.equals(paySalaryComponent.getModelComponent().getSpesific(), HRMConstant.MODEL_COMP_BENEFIT_TABLE)) { BenefitGroupService benefitGroupService = (BenefitGroupService) ServiceWebUtil .getService("benefitGroupService"); message = benefitGroupService .getBenefitGroupNameByPk(Long.valueOf(paySalaryComponent.getModelReffernsil())); } } catch (Exception ex) { Logger.getLogger(ModelReferensiConverter.class.getName()).log(Level.SEVERE, null, ex); } return message; }
From source file:org.jasig.portlet.announcements.controller.ApproveAjaxController.java
@Override protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { Long annId = Long.valueOf(request.getParameter("annId")); Boolean approval = Boolean.valueOf(request.getParameter("approval")); Announcement ann = announcementService.getAnnouncement(annId); Date startDisplay = ann.getStartDisplay(); Date endDisplay = ann.getEndDisplay(); if (endDisplay == null) { // Unspecified end date means the announcement does not expire; we // will substitute a date in the future each time this item is // evaluated. long aYearFromNow = System.currentTimeMillis() + Announcement.MILLISECONDS_IN_A_YEAR; endDisplay = new Date(aYearFromNow); }//from w ww. j av a2s. c om Date now = new Date(); int status = 3; /** * Scheduled = 0 * Expired = 1 * Showing = 2 * Pending = 3 */ if (startDisplay.after(now) && endDisplay.after(now) && approval) { status = 0; } else if (startDisplay.before(now) && endDisplay.after(now) && approval) { status = 2; } else if (endDisplay.before(now)) { status = 1; } ann.setPublished(approval); cm.getCacheManager().getCache("guestAnnouncementCache").flush(); announcementService.addOrSaveAnnouncement(ann); return new ModelAndView("ajaxApprove", "status", status); }
From source file:org.nekorp.workflow.desktop.data.access.rest.ClienteDAOImp.java
@Override public void guardar(Cliente dato) { if (dato.getId() == null) { URI resource = factory.getTemplate().postForLocation(factory.getRootUlr() + "/clientes", dato); String[] uri = StringUtils.split(resource.toString(), '/'); String id = uri[uri.length - 1]; dato.setId(Long.valueOf(id)); } else {/*from www . j ava 2 s. c om*/ Map<String, Object> map = new HashMap<>(); map.put("id", dato.getId()); factory.getTemplate().postForLocation(factory.getRootUlr() + "/clientes/{id}", dato, map); } }
From source file:com.appdynamics.extensions.rackspace.stats.DatabaseStats.java
private Map<String, Map<String, Long>> getMetricsFromNode(JsonNode serviceResponse) { Map<String, Map<String, Long>> instanceStats = new HashMap<String, Map<String, Long>>(); JsonNode instancesNode = serviceResponse.get("instances"); for (JsonNode instance : instancesNode) { Map<String, Long> stats = new HashMap<String, Long>(); stats.put("Status", Long.valueOf(Status.valueOf(instance.path("status").asText()).statusInt)); stats.put("Volume-size", instance.path("volume").path("size").asLong()); instanceStats.put(instance.path("name").asText(), stats); }/*from w ww . j ava 2 s .co m*/ return instanceStats; }
From source file:cz.muni.fi.editor.database.dao.NotificationDAOImpl.java
public NotificationDAOImpl() { latestNotification = new Notification(); latestNotification.setId(Long.valueOf(0L)); }
From source file:org.ambraproject.user.action.ImportUsersPermissionsAction.java
@Override public String execute() { Map<String, Object> session = ServletActionContext.getContext().getSession(); if (hashCodes == null) { addActionError("No users selected to import"); return INPUT; }/* w w w . j a v a2s.c o m*/ List<ImportedUserView> users = (List<ImportedUserView>) session.get(IMPORT_USER_LIST); List<Long> hashCodeList = Arrays.asList(hashCodes); for (ImportedUserView user : users) { if (!hashCodeList.contains(Long.valueOf(user.hashCode()))) { user.setState(ImportedUserView.USER_STATES.IGNORE); log.debug("Ignoring user: {}", user.getDisplayName()); } } accountsToImport = hashCodes.length; UserProfile userProfile = userService.getUserByAuthId(this.getAuthId()); //Only allow the user to assign the new user roles that they belong to already userRoles = userProfile.getRoles(); return SUCCESS; }
From source file:cz.muni.fi.mir.db.service.impl.ConfigurationServiceImpl.java
@Override @Transactional(readOnly = true)//from ww w .ja v a 2 s.c o m public Configuration getConfigurationByID(Long id) throws IllegalArgumentException { if (id == null || Long.valueOf("0").compareTo(id) >= 0) { throw new IllegalArgumentException( "Given entity does not have valid id should be greater than one but was [" + id + "]"); } return configurationDAO.getByID(id); }