List of usage examples for java.lang Long valueOf
@HotSpotIntrinsicCandidate public static Long valueOf(long l)
From source file:org.shareok.data.redis.job.DspaceApiJobDaoImpl.java
@Override public DspaceApiJob findJobByJobId(long jobId) { try {/* w w w.j ava 2s . c o m*/ BoundHashOperations<String, String, String> jobOps = redisTemplate .boundHashOps(RedisUtil.getJobQueryKey(jobId)); if (null != jobOps) { DspaceApiJob job = RedisUtil.getDspaceApiJobInstance(); job.setJobId(jobId); String startTime = (String) jobOps.get("startTime"); job.setStartTime((null == startTime || "".equals(startTime)) ? null : ShareokdataManager.getSimpleDateFormat().parse(startTime)); String endTime = (String) jobOps.get("endTime"); job.setEndTime((null == endTime || "".equals(endTime)) ? null : ShareokdataManager.getSimpleDateFormat().parse(endTime)); job.setUserId(Long.valueOf(jobOps.get("userId"))); job.setServerId(Integer.valueOf(jobOps.get("serverId"))); job.setStatus(Integer.valueOf(jobOps.get("status"))); job.setType(Integer.valueOf(jobOps.get("type"))); // job.setRepoType(Integer.valueOf(jobOps.get("repoType"))); job.setFilePath(jobOps.get("filePath")); job.setCommunityId((String) jobOps.get("communityId")); job.setSubCommunityId((String) jobOps.get("subCommunityId")); job.setCollectionId((String) jobOps.get("collectionId")); job.setItemId((String) jobOps.get("itemId")); job.setBitstreamId((String) jobOps.get("bitstreamId")); job.setPolicyId((String) jobOps.get("policyId")); return job; } else { return null; } } catch (ParseException | NumberFormatException ex) { logger.error("Cannot find the job information by job ID " + jobId, ex); } return null; }
From source file:com.stratio.ingestion.sink.druid.EventParser.java
private Map<String, Object> parseEvent(Event event) { final Map<String, String> headers = event.getHeaders(); Map<String, Object> parsedEvent = null; if (MapUtils.isNotEmpty(headers)) { parsedEvent = new HashMap<String, Object>(); for (String header : headers.keySet()) { if (timestampField.equalsIgnoreCase(header)) { parsedEvent.put(header, Long.valueOf(headers.get(header))); } else { parsedEvent.put(header, headers.get(header)); }/*from w w w.ja v a 2 s . c o m*/ } } return parsedEvent; }
From source file:org.devgateway.toolkit.forms.models.PersistableJpaRepositoryModel.java
@Override public int hashCode() { return Long.valueOf(id).hashCode(); }
From source file:cz.muni.fi.editor.webapp.formatters.OrganizationFormatter.java
@Override public OrganizationForm parse(String s, Locale locale) throws ParseException { if (StringUtils.isEmpty(s)) { throw new ParseException("Passed empty text", 0); } else {//from ww w . j ava2 s. com OrganizationForm of = new OrganizationForm(); of.setId(Long.valueOf(s)); return of; } }
From source file:net.cloudkit.enterprises.infrastructure.commons.ExecuteTimeInterceptor.java
@Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) { Long startTime = (Long) request.getAttribute(START_TIME); if (startTime == null) { startTime = Long.valueOf(System.currentTimeMillis()); request.setAttribute(START_TIME, startTime); }// ww w .j a v a2 s. c o m return true; }
From source file:com.mb.framework.util.DateTimeUtil.java
/** * This method is used for getting the number corresponding to Calendar year * //w ww . j av a2 s .c o m * @param year * @return */ public static String getYear(String year) { int yr = 0; if (StringUtils.isNotEmpty(year)) { Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(Long.valueOf(year)); yr = calendar.get(Calendar.YEAR); } return String.valueOf(yr); }
From source file:com.nebhale.cyclinglibrary.repository.JdbcItemRepositoryTest.java
@Test public void create() { this.jdbcTemplate.update("INSERT INTO types(id, name, shortName) VALUES(?, ?, ?)", 0, "test-name", "test-short-name"); this.jdbcTemplate.update("INSERT INTO collections(id, typeId, name, shortName) VALUES(?, ?, ?, ?)", 1, 0, "test-name", "test-short-name"); Item item = this.itemRepository.create(Long.valueOf(1), "test-name", "test-short-name", StubPointFactory.create(0), StubPointFactory.create(1)); Map<String, Object> itemData = this.jdbcTemplate .queryForMap("SELECT id, collectionId, name, shortName FROM items"); assertEquals(Long.valueOf(1), itemData.get("collectionId")); assertEquals("test-name", itemData.get("name")); assertEquals("test-short-name", itemData.get("shortName")); assertEquals(itemData.get("id"), item.getId()); assertEquals(itemData.get("collectionId"), item.getCollectionId()); assertEquals(itemData.get("name"), item.getName()); assertEquals(itemData.get("shortName"), item.getShortName()); List<Point> points = item.getPoints(); List<Map<String, Object>> pointsData = this.jdbcTemplate .queryForList("SELECT id, itemId, latitude, longitude, elevation FROM points"); Point point0 = points.get(0); Map<String, Object> point0Data = pointsData.get(0); assertEquals(item.getId(), point0Data.get("itemId")); assertEquals(Double.valueOf(0), point0Data.get("latitude")); assertEquals(Double.valueOf(1), point0Data.get("longitude")); assertEquals(Double.valueOf(2), point0Data.get("elevation")); assertEquals(point0Data.get("id"), point0.getId()); assertEquals(point0Data.get("itemId"), point0.getItemId()); assertEquals(point0Data.get("latitude"), point0.getLatitude()); assertEquals(point0Data.get("longitude"), point0.getLongitude()); assertEquals(point0Data.get("elevation"), point0.getElevation()); Point point1 = points.get(1); Map<String, Object> point1Data = pointsData.get(1); assertEquals(item.getId(), point1Data.get("itemId")); assertEquals(Double.valueOf(1), point1Data.get("latitude")); assertEquals(Double.valueOf(2), point1Data.get("longitude")); assertEquals(Double.valueOf(3), point1Data.get("elevation")); assertEquals(point1Data.get("id"), point1.getId()); assertEquals(point1Data.get("itemId"), point1.getItemId()); assertEquals(point1Data.get("latitude"), point1.getLatitude()); assertEquals(point1Data.get("longitude"), point1.getLongitude()); assertEquals(point1Data.get("elevation"), point1.getElevation()); }
From source file:gov.nih.nci.caintegrator.application.study.AnnotationGroupUploadContent.java
/** * @param cdeId the cdeId to set/*from w ww .j av a2s . c om*/ */ public void setCdeId(String cdeId) { if (!StringUtils.isBlank(cdeId)) { this.cdeId = Long.valueOf(cdeId); } }
From source file:com.gsr.myschool.server.reporting.convocation.ConvocationController.java
@RequestMapping(value = "test", method = RequestMethod.GET, produces = "application/pdf") @ResponseStatus(HttpStatus.OK)/*from w ww.ja va 2s . co m*/ public void generateReportTest(@RequestParam String niveauId, @RequestParam String sessionId, HttpServletResponse response) { ReportDTO dto = convocationService.generateConvocationTest(Long.valueOf(niveauId), Long.valueOf(sessionId)); try { response.addHeader("Content-Disposition", "attachment; filename=convocation.pdf"); BufferedOutputStream outputStream = new BufferedOutputStream(response.getOutputStream()); byte[] result = reportService.generatePdf(dto); outputStream.write(result, 0, result.length); outputStream.flush(); outputStream.close(); } catch (Exception e) { throw new RuntimeException(e); } }
From source file:com.codebutler.farebot.mifare.Card.java
public static Card fromXml(String xml) throws Exception { DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document doc = builder.parse(new InputSource(new StringReader(xml))); Element rootElement = doc.getDocumentElement(); CardType type = CardType.class.getEnumConstants()[Integer.parseInt(rootElement.getAttribute("type"))]; byte[] id = Utils.hexStringToByteArray(rootElement.getAttribute("id")); Date scannedAt = rootElement.hasAttribute("scanned_at") ? new Date(Long.valueOf(rootElement.getAttribute("scanned_at"))) : new Date(0); switch (type) { case MifareDesfire: return DesfireCard.fromXml(id, scannedAt, rootElement); case CEPAS://w w w . ja va2s. c o m return CEPASCard.fromXML(id, scannedAt, rootElement); case FeliCa: return FelicaCard.fromXml(id, scannedAt, rootElement); default: throw new UnsupportedOperationException("Unsupported card type: " + type); } }