List of usage examples for java.lang Long longValue
@HotSpotIntrinsicCandidate public long longValue()
From source file:com.couchbase.lite.replicator.ChangeTracker.java
public Map<String, Object> changesFeedPOSTBodyMap() { Object since = lastSequenceID; if (lastSequenceID != null && lastSequenceID instanceof String) { try {//from w ww . j av a2 s.co m Long value = Long.valueOf((String) lastSequenceID); if (value.longValue() >= 0) since = value; } catch (NumberFormatException e) { // ignore } } if (docIDs != null && docIDs.size() > 0) { filterName = "_doc_ids"; filterParams = new HashMap<String, Object>(); filterParams.put("doc_ids", docIDs); } Map<String, Object> post = new HashMap<String, Object>(); post.put("feed", getFeed()); post.put("heartbeat", getHeartbeatMilliseconds()); post.put("style", includeConflicts ? "all_docs" : null); post.put("active_only", activeOnly && !caughtUp ? true : null); post.put("since", since); if (filterName != null) post.put("filter", filterName); post.put("limit", limit > 0 ? limit : null); // TODO: {@"accept_encoding", @"gzip"} if (filterName != null && filterParams != null) post.putAll(filterParams); return post; }
From source file:com.demo.db.dao.impl.DriverDaoImpl.java
@Override public Driver insert(Driver driver) { QueryRunner queryRunner = dbHelper.getRunner(); try {/*from w w w .j a v a 2 s . c o m*/ Long id = queryRunner.insert(dbHelper.getConnection(), "insert into demo_driver(cell, password, name, sfz_a, sfz_b, jsz_a, xsz_a, license_plate) values(?, ?, ?, ?, ?, ?, ?, ?)", new ScalarHandler<Long>(), new Object[] { driver.getCell(), DigestUtils.md5Hex(driver.getPassword()), driver.getName(), driver.getSfzA(), driver.getSfzB(), driver.getJszA(), driver.getXszA(), driver.getLicensePlate() }); if (id != null && id.longValue() > 0) { driver.setId(id); } } catch (SQLException e) { String methodName = Thread.currentThread().getStackTrace()[1].getMethodName(); LOGGER.error("{}??{}", methodName, driver); throw new RuntimeException("??", e); } return driver; }
From source file:com.esofthead.mycollab.module.project.view.assignments.gantt.GanttItemWrapper.java
public void setDuration(Long duration) { task.setDuration(duration);// www .ja v a 2 s . c o m if (startDate != null) { LocalDate expectedEndDate = BusinessDayTimeUtils.plusDays(startDate, (int) (duration.longValue() / DateTimeUtils.MILISECONDS_IN_A_DAY)); setStartAndEndDate(startDate, expectedEndDate, true, true); } }
From source file:net.sf.sze.frontend.zeugnis.BewertungenController.java
/** * Zeigt die Bewertung zu der entsprechenden Id. * @param halbjahrId die Id des Schulhalbjahres * @param klassenId die Id der Klasse//from w ww.j av a2 s .c om * @param schulfachId die Id des Schulfaches. * @param bewertungsId die Id der Bewertung * @param model das Model * @return die logische View */ @RequestMapping(value = URL.BewertungenPath.EDIT, method = RequestMethod.GET) public String editBewertung(@PathVariable(URL.Session.P_HALBJAHR_ID) Long halbjahrId, @PathVariable(URL.Session.P_KLASSEN_ID) Long klassenId, @PathVariable(URL.Session.P_SCHULFACH_ID) Long schulfachId, @PathVariable(value = URL.BewertungenPath.P_BEWERTUNGS_ID) Long bewertungsId, Model model) { final ZeugnisFormular formular = zeugnisFormularService.getZeugnisFormular(halbjahrId.longValue(), klassenId.longValue()); final BewertungWithNeigbors bewertungWithNeigbors = bewertungErfassungsService .getBewertungWithNeighbors(formular, schulfachId, bewertungsId); setEditModelValues(halbjahrId, klassenId, schulfachId, bewertungWithNeigbors.getBewertung(), bewertungWithNeigbors.getPrevBewertungsId(), bewertungWithNeigbors.getNextBewertungsId(), model); return BEWERTUNGEN_EDIT_BEWERTUNG_VIEW; }
From source file:com.linkedin.pinot.query.aggregation.StarTreeQueriesTest.java
@Test(dataProvider = "filterQueryDataProvider") public void testPlanMaker(Map<String, String> filterQuery) throws Exception { // Build request final BrokerRequest brokerRequest = new BrokerRequest(); final List<AggregationInfo> aggregationsInfo = new ArrayList<AggregationInfo>(); aggregationsInfo.add(getSumAggregationInfo()); brokerRequest.setAggregationsInfo(aggregationsInfo); if (!filterQuery.isEmpty()) { String[] flattened = flattenFilterQuery(filterQuery); setFilterQuery(brokerRequest, flattened[0], flattened[1]); }// w ww.jav a 2 s . c o m // Compute plan final PlanMaker instancePlanMaker = new InstancePlanMakerImplV3(); final PlanNode rootPlanNode = instancePlanMaker.makeInnerSegmentPlan(indexSegment, brokerRequest); rootPlanNode.showTree(""); Assert.assertEquals(rootPlanNode.getClass(), StarTreeAggregationPlanNode.class); // Perform aggregation final MAggregationOperator operator = (MAggregationOperator) rootPlanNode.run(); final IntermediateResultsBlock resultBlock = (IntermediateResultsBlock) operator.nextBlock(); // Get response final ReduceService reduceService = new DefaultReduceService(); final Map<ServerInstance, DataTable> instanceResponseMap = new HashMap<ServerInstance, DataTable>(); instanceResponseMap.put(new ServerInstance("localhost:0000"), resultBlock.getAggregationResultDataTable()); instanceResponseMap.put(new ServerInstance("localhost:1111"), resultBlock.getAggregationResultDataTable()); instanceResponseMap.put(new ServerInstance("localhost:2222"), resultBlock.getAggregationResultDataTable()); instanceResponseMap.put(new ServerInstance("localhost:3333"), resultBlock.getAggregationResultDataTable()); instanceResponseMap.put(new ServerInstance("localhost:4444"), resultBlock.getAggregationResultDataTable()); instanceResponseMap.put(new ServerInstance("localhost:5555"), resultBlock.getAggregationResultDataTable()); instanceResponseMap.put(new ServerInstance("localhost:6666"), resultBlock.getAggregationResultDataTable()); instanceResponseMap.put(new ServerInstance("localhost:7777"), resultBlock.getAggregationResultDataTable()); instanceResponseMap.put(new ServerInstance("localhost:8888"), resultBlock.getAggregationResultDataTable()); instanceResponseMap.put(new ServerInstance("localhost:9999"), resultBlock.getAggregationResultDataTable()); final BrokerResponse reducedResults = reduceService.reduceOnDataTable(brokerRequest, instanceResponseMap); // Check (we sent 10 broker requests, so assume 10x) Long fromPinot = reducedResults.getAggregationResults().get(0).getLong("value"); Map<String, Number> fromRawData = computeAggregateFromRawData(avroFile, filterQuery); Assert.assertEquals(fromPinot.longValue(), fromRawData.get("M0").longValue() * 10 /* because 10 broker requests */); }
From source file:com.clustercontrol.agent.winevent.WinEventMonitor.java
private String createQuery(WinEventCheckInfo checkInfo, String logName) { m_log.debug("createQuery() start creating query for EvtQuery"); String query = "<QueryList><Query><Select Path='" + logName + "'>*[System["; // //from w w w. j a va 2 s . c o m if (checkInfo.getSource() != null && checkInfo.getSource().size() != 0) { query += "Provider["; StringBuffer sourceStr = new StringBuffer(); for (String sourceName : checkInfo.getSource()) { sourceStr.append("@Name='"); sourceStr.append(sourceName); sourceStr.append("' or "); } query += sourceStr.toString(); query = query.replaceFirst(" or \\z", ""); // ?"or" query += "] and "; } // query += "("; query += checkInfo.isLevelCritical() ? "Level=" + WinEventConstant.CRITICAL_LEVEL + " or " : ""; query += checkInfo.isLevelWarning() ? "Level=" + WinEventConstant.WARNING_LEVEL + " or " : ""; query += checkInfo.isLevelVerbose() ? "Level=" + WinEventConstant.VERBOSE_LEVEL + " or " : ""; query += checkInfo.isLevelError() ? "Level=" + WinEventConstant.ERROR_LEVEL + " or " : ""; query += checkInfo.isLevelInformational() ? "Level=" + WinEventConstant.INFORMATION_LEVEL0 + " or Level=" + WinEventConstant.INFORMATION_LEVEL4 + " or " : ""; query = query.replaceFirst(" or \\z", ""); // ?"or" query += ") and "; // ID if (checkInfo.getEventId() != null && checkInfo.getEventId().size() != 0) { query += "("; StringBuffer sourceStr = new StringBuffer(); for (Integer id : checkInfo.getEventId()) { sourceStr.append("EventID=" + id + " or "); } query += sourceStr.toString(); query = query.replaceFirst(" or \\z", ""); // ?"or" query += ") and "; } // ? if (checkInfo.getCategory() != null && checkInfo.getCategory().size() != 0) { query += "("; StringBuffer sourceStr = new StringBuffer(); for (Integer category : checkInfo.getCategory()) { sourceStr.append("Task=" + category + " or "); } query += sourceStr.toString(); query = query.replaceFirst(" or \\z", ""); // ?"or" query += ") and "; } // if (checkInfo.getKeywords() != null && checkInfo.getKeywords().size() != 0) { long targetKeyword = 0l; for (Long keyword : checkInfo.getKeywords()) { targetKeyword += keyword.longValue(); } query += "(band(Keywords," + targetKeyword + "))"; } query = query.replaceFirst(" and \\z", ""); query += "]]</Select></Query></QueryList>"; return query; }
From source file:org.eclipse.gemini.blueprint.test.AbstractOsgiTests.java
/** * Tries to get the bundle context for spring-osgi-test-support bundle. This is useful on platform where the * platformContext or system BundleContext doesn't behave like a normal context. * /*from w w w . j av a2 s. c om*/ * Will fallback to {@link #platformContext}. * * @return */ private BundleContext getRuntimeBundleContext() { // read test bundle id property Long id = OsgiTestInfoHolder.INSTANCE.getTestBundleId(); BundleContext ctx = null; if (id != null) try { ctx = OsgiBundleUtils.getBundleContext(platformContext.getBundle(id.longValue())); } catch (RuntimeException ex) { logger.trace("cannot determine bundle context for bundle " + id, ex); } return (ctx == null ? platformContext : ctx); }
From source file:com.npower.dm.hibernate.management.UpdateImageManagementBeanImpl.java
public ImageUpdateStatus getImageUpdateStatus(Long releaseStatus) throws DMException { try {//from w w w . j ava 2 s. co m ImageUpdateStatus status = (ImageUpdateStatus) this.getHibernateSession() .get(ImageUpdateStatusEntity.class, releaseStatus.longValue()); return status; } catch (HibernateException e) { throw new DMException("Could not found ImageUpdateStatusEntity by ID: " + releaseStatus, e); } }
From source file:net.sf.sze.frontend.zeugnis.BewertungenController.java
/** * Zeigt die Bewertungen des entsprechenden Faches der Klasse in dem Halbjahr. * @param halbjahrId die Id des Schulhalbjahres * @param klassenId die Id der Klasse/* w ww .j ava2 s . c om*/ * @param schulfachId die Id des Schulfaches. * @param model das Model * @param redirectAttributes Fehlermeldungen. * @return die logische View */ @RequestMapping(value = URL.BewertungenPath.LIST, method = RequestMethod.GET) public String showBewertungenPath(@PathVariable(URL.Session.P_HALBJAHR_ID) Long halbjahrId, @PathVariable(URL.Session.P_KLASSEN_ID) Long klassenId, @RequestParam(value = URL.Session.P_SCHULFACH_ID, required = false) Long schulfachId, Model model, RedirectAttributes redirectAttributes) { final ZeugnisFormular formular = zeugnisFormularService.getZeugnisFormular(halbjahrId.longValue(), klassenId.longValue()); if (formular == null) { redirectAttributes.addFlashAttribute("message", "Es wurden keine Bewertungen gefunden."); return URL.redirectWithNamedParams(URL.ZeugnisPath.START, URL.Session.P_HALBJAHR_ID, halbjahrId, URL.Session.P_KLASSEN_ID, klassenId); } if (!formular.getSchulhalbjahr().isSelectable()) { redirectAttributes.addFlashAttribute("message", "Das Schulhalbjahr ist nicht mehr selektierbar."); return URL.redirectWithNamedParams(URL.ZeugnisPath.START, URL.Session.P_HALBJAHR_ID, halbjahrId, URL.Session.P_KLASSEN_ID, klassenId); } final List<Schulfach> schulfaecher = bewertungErfassungsService.getActiveSchulfaecherOrderByName(formular); if (CollectionUtils.isEmpty(schulfaecher)) { redirectAttributes.addFlashAttribute("message", "Es wurden keine Bewertungen gefunden."); return URL.redirectWithNamedParams(URL.ZeugnisPath.START, URL.Session.P_HALBJAHR_ID, halbjahrId, URL.Session.P_KLASSEN_ID, klassenId); } final Long usedSchulfachId; if (schulfachId == null) { LOG.debug("Nehme das erste Schulfach"); usedSchulfachId = schulfaecher.get(0).getId(); } else { usedSchulfachId = schulfachId; } final List<Bewertung> bewertungen = bewertungErfassungsService.getSortedBewertungen(formular, usedSchulfachId.longValue()); model.addAttribute("bewertungen", bewertungen); model.addAttribute("schulfaecher", schulfaecher); model.addAttribute("zeugnisFormular", formular); model.addAttribute(URL.Session.P_SCHULFACH_ID, usedSchulfachId); return "bewertungen/listBewertungen"; }
From source file:com.joyent.manta.client.MantaClientIT.java
@Test(groups = "move") public final void canMoveEmptyDirectory() throws IOException { final String name = UUID.randomUUID().toString(); final String path = testPathPrefix + name; mantaClient.putDirectory(path);//from w w w . j ava 2 s . c om final String newDir = testPathPrefix + "subdir-" + UUID.randomUUID() + "/"; mantaClient.move(path, newDir); boolean newLocationExists = mantaClient.existsAndIsAccessible(newDir); Assert.assertTrue(newLocationExists, "Destination directory doesn't exist: " + newDir); MantaObjectResponse head = mantaClient.head(newDir); boolean isDirectory = head.isDirectory(); Assert.assertTrue(isDirectory, "Destination wasn't created as a directory"); Long resultSetSize = head.getHttpHeaders().getResultSetSize(); Assert.assertEquals(resultSetSize.longValue(), 0L, "Destination directory is not empty"); boolean sourceIsDeleted = !mantaClient.existsAndIsAccessible(path); Assert.assertTrue(sourceIsDeleted, "Source directory didn't get deleted: " + path); }