List of usage examples for java.lang Long longValue
@HotSpotIntrinsicCandidate public long longValue()
From source file:de.crowdcode.bitemporal.example.AddressAuditRevision2Test.java
@Test public void testAuditedAddressesRevision2() { Person person = personService.findPersonByLastname("Mueller"); Address address = person.getAddress(); Long addressId = address.getId(); assertEquals(5L, addressId.longValue()); String result = addressService.findRevisionNumberByAddressIdAndRevisionNumber(addressId, 2); assertEquals("3", result); }
From source file:com.jd.bdp.hydra.hbase.service.impl.HbaseUtils.java
byte[] long2ByteArray(Long value) { long v = value.longValue(); byte[] b = new byte[8]; for (int i = 0; i < b.length; i++) { b[i] = new Long(v & 0xff).byteValue(); v = v >> 8;//from w w w. ja v a 2 s . com } return b; }
From source file:org.apache.cxf.systest.jaxrs.jaxws.BookStoreSoapRestImpl.java
@Override public Response checkBook(Long id) { if (id.longValue() != 0L) { return Response.status(HttpStatus.SC_NOT_FOUND).build(); } else {//from w w w . j a va 2 s . c o m return Response.ok().build(); } }
From source file:net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory.java
/** * Extract a long out of a string.//from w w w . java 2 s.c o m * * @param properties the property * @param propertyName the name of the property * @param defaultValue the default value if none is found * @return the extracted value */ protected long extractAsynchronousReplicationIntervalMillis(Properties properties, String propertyName, long defaultValue) { String parsedString = PropertyUtil.extractAndLogProperty(propertyName, properties); if (parsedString != null) { try { Long longValue = new Long(parsedString); return longValue.longValue(); } catch (NumberFormatException e) { LOG.warn("Number format exception trying to set asynchronousReplicationIntervalMillis. " + "Using the default instead. String value was: '" + parsedString + "'"); } } return defaultValue; }
From source file:org.thymeleaf.engine21.conversion.conversion3.LongFormatter.java
public String print(final Long object, final Locale locale) { final NumberFormat numberFormat = NumberFormat.getNumberInstance(Locale.US); return numberFormat.format(object.longValue()); }
From source file:com.redhat.rhn.frontend.action.monitoring.ProbeList.java
/** * {@inheritDoc}/* w w w. j a v a2 s . c o m*/ */ @Override protected void processRequestAttributes(RequestContext rctx) { super.processRequestAttributes(rctx); String stateparam = rctx.getParam(PROBE_STATE, false); if (StringUtils.isEmpty(stateparam)) { stateparam = "all"; } else { rctx.getRequest().setAttribute(PROBE_STATE, stateparam); } stateparam = stateparam.toLowerCase(); // Add all/warning/ok/Class css classname rctx.getRequest().setAttribute(stateparam + "Class", "active"); // Setup the probe state summary Map counts = new HashMap(); counts.put(PROBE_COUNT_CRITICAL, "0"); counts.put(PROBE_COUNT_WARNING, "0"); counts.put(PROBE_COUNT_PENDING, "0"); counts.put(PROBE_COUNT_UNKNOWN, "0"); counts.put(PROBE_COUNT_OK, "0"); counts.put(PROBE_COUNT_ALL, "0"); List stateCount = MonitoringManager.getInstance().listProbeStateSummary(rctx.getCurrentUser()); Iterator i = stateCount.iterator(); long stateSum = 0; while (i.hasNext()) { Map row = (Map) i.next(); Long cnt = (Long) row.get("state_count"); stateSum = stateSum + cnt.longValue(); String state = ((String) row.get("state")).toLowerCase(); counts.put(state + "Count", cnt.toString()); } counts.put(PROBE_COUNT_ALL, Long.toString(stateSum)); i = counts.keySet().iterator(); while (i.hasNext()) { String key = (String) i.next(); rctx.getRequest().setAttribute(key, counts.get(key)); } }
From source file:com.redhat.rhn.domain.kickstart.KickstartFactory.java
/** * @param orgIn Org associated with Kickstart Data * @param ksid Kickstart Data Id to lookup * @return Kickstart Data object by ksid *//*from ww w .j ava 2 s .com*/ public static KickstartData lookupKickstartDataByIdAndOrg(Org orgIn, Long ksid) { return (KickstartData) HibernateFactory.getSession().getNamedQuery("KickstartData.findByIdAndOrg") .setLong("id", ksid.longValue()).setLong("org_id", orgIn.getId().longValue()).uniqueResult(); }
From source file:com.hs.mail.imap.mailbox.SelectedMailbox.java
/** * Get the UID corresponding to the given message sequence number from the * cache. If not exist, <code>-1</code> is returned. *///from w w w . j ava 2s . c o m public long getUID(int msn) { Long v = (Long) converter.get(msn); return (v != null) ? v.longValue() : -1; }
From source file:com.redhat.rhn.domain.kickstart.KickstartFactory.java
/** * Get all the KickstartSessions associated with the passed in server id * @param sidIn of Server we want the Sessions for * @return List of KickstartSession objects *///from w w w. j a v a2 s . co m public static List lookupAllKickstartSessionsByServer(Long sidIn) { Session session = HibernateFactory.getSession(); return session.getNamedQuery("KickstartSession.findByServer").setLong("server", sidIn.longValue()).list(); }
From source file:org.callistasoftware.netcare.core.spi.impl.UnitServiceImpl.java
@Override public ServiceResult<MeasureUnit> saveUnit(MeasureUnit measureUnit) { final Long id = measureUnit.getId(); MeasureUnitEntity mue = resolveEntity(id); if (id.longValue() == -1L && mue != null) { getLog().warn("Measure unit with dn {} did already exist in the system.", measureUnit.getDn()); return ServiceResultImpl .createFailedResult(new EntityNotUniqueMessage(MeasureUnitEntity.class, "unikt namn")); }//ww w . j ava2 s . c o m if (id.longValue() != -1L && mue == null) { getLog().warn("Measure unit {} was expected to be in the database but was not", id); return ServiceResultImpl.createFailedResult(new EntityNotFoundMessage(MeasureUnitEntity.class, id)); } if (mue == null) { mue = MeasureUnitEntity.newEntity(measureUnit.getName(), measureUnit.getDn()); verifyWriteAccess(mue); final MeasureUnitEntity saved = repo.save(mue); return ServiceResultImpl.createSuccessResult(MeasureUnitImpl.newFromEntity(saved), new GenericSuccessMessage()); } else { mue.setDn(measureUnit.getDn()); mue.setName(measureUnit.getName()); return ServiceResultImpl.createSuccessResult(MeasureUnitImpl.newFromEntity(mue), new GenericSuccessMessage()); } }