List of usage examples for java.lang Long valueOf
@HotSpotIntrinsicCandidate public static Long valueOf(long l)
From source file:com.inkubator.hrm.web.converter.ModeRefConverter.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 {// w w w . j a v a 2 s .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)) { LoanNewTypeService loanSchemaService = (LoanNewTypeService) ServiceWebUtil .getService("loanNewTypeService"); LoanNewType loanNewType = loanSchemaService .getEntiyByPK(Long.valueOf(paySalaryComponent.getModelReffernsil())); message = loanNewType.getLoanTypeName(); } //if specific == reimbursment schema if (Objects.equals(paySalaryComponent.getModelComponent().getSpesific(), HRMConstant.MODEL_COMP_REIMBURSEMENT)) { // RmbsTypeService rmbsTypeService = (RmbsTypeService) ServiceWebUtil.getService("rmbsTypeService"); RmbsType rmbsType = rmbsTypeService .getEntiyByPK(Long.valueOf(paySalaryComponent.getModelReffernsil())); message = rmbsType.getName(); } //if specific ==benefit group if (Objects.equals(paySalaryComponent.getModelComponent().getSpesific(), HRMConstant.MODEL_COMP_BENEFIT_TABLE)) { BenefitGroupService benefitGroupService = (BenefitGroupService) ServiceWebUtil .getService("benefitGroupService"); BenefitGroup benefitGroup = benefitGroupService .getEntiyByPK(Long.valueOf(paySalaryComponent.getModelReffernsil())); message = benefitGroup.getName(); } } catch (Exception ex) { Logger.getLogger(ModelReferensiConverter.class.getName()).log(Level.SEVERE, null, ex); } return message; }
From source file:cz.muni.fi.editor.webapp.formatters.UserPermissionFormatter.java
@Override public UserPermissionForm parse(String text, Locale locale) throws ParseException { if (StringUtils.isEmpty(text)) { throw new ParseException("Empty text.", 0); }/* ww w . j a v a 2 s .c om*/ UserPermissionForm upf = new UserPermissionForm(); upf.setId(Long.valueOf(text)); return upf; }
From source file:ch.cyberduck.core.sftp.SFTPQuotaFeature.java
@Override public Space get() throws BackgroundException { final ThreadLocal<Space> quota = new ThreadLocal<Space>() { @Override// ww w . ja v a2 s. c o m protected Space initialValue() { return new Space(0L, Long.MAX_VALUE); } }; final Path home = new SFTPHomeDirectoryService(session).find(); new SFTPCommandFeature(session).send(String.format("df -Pk %s | awk '{print $3, $4}'", home.getAbsolute()), new DisabledProgressListener(), new TranscriptListener() { @Override public void log(final Type request, final String output) { switch (request) { case response: final String[] numbers = StringUtils.split(output, ' '); if (numbers.length == 2) { try { quota.set(new Space(Long.valueOf(numbers[0]) * 1000L, Long.valueOf(numbers[1]) * 1000L)); } catch (NumberFormatException e) { log.warn(String.format("Ignore line %s", output)); } } else { log.warn(String.format("Ignore line %s", output)); } } } }); return quota.get(); }
From source file:com.rastating.droidbeard.net.FetchShowSummariesTask.java
@Override protected TVShowSummary[] doInBackground(Void... voids) { List<TVShowSummary> shows = new ArrayList<TVShowSummary>(); String json = getJson("shows", null); try {/*from w w w.j a v a2 s . c o m*/ if (json != null) { JSONObject root = new JSONObject(json); JSONObject data = root.getJSONObject("data"); Iterator<String> keys = data.keys(); while (keys.hasNext()) { String key = keys.next(); JSONObject show = data.getJSONObject(key); long tvdbid = 0; if (show.has("tvdbid")) { tvdbid = show.getLong("tvdbid"); } else { tvdbid = Long.valueOf(key); } TVShowSummary tvShowSummary = new TVShowSummary(show.getString("show_name")); tvShowSummary.setNetwork(show.getString("network")); tvShowSummary.setTvDbId(tvdbid); tvShowSummary.setStatus(show.getString("status")); Object pausedState = show.get("paused"); if (pausedState instanceof Boolean) { tvShowSummary.setPaused((Boolean) pausedState); } else { tvShowSummary.setPaused(pausedState.equals(1)); } try { String nextDateString = show.getString("next_ep_airdate"); if (!nextDateString.equals("")) { Date date = new SimpleDateFormat("yyyy-MM-dd").parse(nextDateString); tvShowSummary.setNextAirDate(date); } } catch (ParseException e) { tvShowSummary.setNextAirDate(null); } shows.add(tvShowSummary); } } else { return null; } } catch (Exception e) { setLastException(json, e); e.printStackTrace(); return null; } Collections.sort(shows, new TVShowSummaryComparator()); return shows.toArray(new TVShowSummary[shows.size()]); }
From source file:org.energyos.espi.common.domain.ServiceCategoryUnmarshallerTests.java
@Test public void kind() throws SAXException, IOException, XpathException, DatatypeConfigurationException { assertEquals(Long.valueOf(9L), loadServiceCategory().getKind()); }
From source file:com.rs.TCOfflineStatementCollection.java
/** * addStatement takes a statement and adds it to the local database * @param statement// w w w . j av a 2 s .co m * @param addInterface */ public void addStatement(Statement statement, addStatementInterface addInterface) { _statementArray.add(statement); Long now = Long.valueOf(System.currentTimeMillis()); ContentValues initialValues = new ContentValues(); try { initialValues.put(LocalStatements.CREATE_DATE, now); initialValues.put(LocalStatements.STATEMENT_JSON, statement.toJSON()); initialValues.put(LocalStatements.QUERY_STRING, ""); initialValues.put(LocalStatements.STATEMENT_ID, statement.getId().toString()); } catch (Exception e) { addInterface.errorBlock("initialValues" + e.toString()); return; } try { appContext.getContentResolver().insert(LocalStatements.CONTENT_URI, initialValues); } catch (Exception e) { addInterface.errorBlock("insert" + e.toString()); return; } addInterface.completionBlock(); }
From source file:net.logstash.logback.marker.ObjectFieldsAppendingMarkerTest.java
@Test public void testWriteTo_nonUnwrappable() throws IOException { StringWriter writer = new StringWriter(); JsonGenerator generator = FACTORY.createGenerator(writer); LogstashMarker marker = Markers.appendFields(Long.valueOf(1L)); generator.writeStartObject();//from ww w . j av a 2 s.c o m marker.writeTo(generator); generator.writeEndObject(); generator.flush(); assertThat(writer.toString()).isEqualTo("{}"); }
From source file:boa.aggregators.ConfidenceIntervalAggregator.java
/** {@inheritDoc} */ @Override/*from ww w . ja v a 2 s .c o m*/ public void aggregate(final String data, final String metadata) throws IOException, InterruptedException { for (final String s : data.split(";")) { final int idx = s.indexOf(":"); if (idx > 0) { final long item = Long.valueOf(s.substring(0, idx)); final long count = Long.valueOf(s.substring(idx + 1)); for (int i = 0; i < count; i++) aggregate(item, metadata); } else aggregate(Long.valueOf(s), metadata); } }
From source file:com.consol.citrus.admin.service.report.TestNGTestReportService.java
@Override public TestReport getLatest(Project activeProject) { TestReport report = new TestReport(); if (hasTestResults(activeProject)) { try {/*from w w w . j av a 2 s . c om*/ Document testResults = XMLUtils.parseMessagePayload(getTestResultsAsString(activeProject)); report.setProjectName(activeProject.getName()); report.setSuiteName( XPathUtils.evaluateAsString(testResults, "/testng-results/suite[1]/@name", null)); report.setDuration(Long.valueOf( XPathUtils.evaluateAsString(testResults, "/testng-results/suite[1]/@duration-ms", null))); try { report.setExecutionDate(dateFormat.parse(XPathUtils.evaluateAsString(testResults, "/testng-results/suite[1]/@started-at", null))); } catch (ParseException e) { log.warn("Unable to read test execution time", e); } report.setPassed( Long.valueOf(XPathUtils.evaluateAsString(testResults, "/testng-results/@passed", null))); report.setFailed( Long.valueOf(XPathUtils.evaluateAsString(testResults, "/testng-results/@failed", null))); report.setSkipped( Long.valueOf(XPathUtils.evaluateAsString(testResults, "/testng-results/@skipped", null))); report.setTotal( Long.valueOf(XPathUtils.evaluateAsString(testResults, "/testng-results/@total", null))); NodeList testClasses = XPathUtils.evaluateAsNodeList(testResults, "testng-results/suite[1]/test/class", null); for (int i = 0; i < testClasses.getLength(); i++) { Element testClass = (Element) testClasses.item(i); List<Element> testMethods = DomUtils.getChildElementsByTagName(testClass, "test-method"); for (Element testMethod : testMethods) { if (!testMethod.hasAttribute("is-config") || testMethod.getAttribute("is-config").equals("false")) { TestResult result = new TestResult(); Test test = new Test(); test.setClassName(testClass.getAttribute("name")); test.setMethodName(testMethod.getAttribute("name")); test.setPackageName( test.getClassName().substring(0, test.getClassName().lastIndexOf('.'))); test.setName(test.getClassName().substring(test.getClassName().lastIndexOf('.') + 1) + "." + test.getMethodName()); test.setType(TestType.JAVA); result.setTest(test); result.setSuccess(testMethod.getAttribute("status").equals("PASS")); report.getResults().add(result); } } } } catch (IOException e) { log.error("Failed to read test results file", e); } } return report; }
From source file:com.baidu.cc.Constants.java
/** * get configuration version id value.//from ww w. j a va 2 s . c o m * * @param version return this value if not exist in the system property * @return configuration version value. */ public static long getVersion(String version) { return Long.valueOf(getSystemProp(ENV_VERSION, version)); }