Example usage for java.lang Long longValue

List of usage examples for java.lang Long longValue

Introduction

In this page you can find the example usage for java.lang Long longValue.

Prototype

@HotSpotIntrinsicCandidate
public long longValue() 

Source Link

Document

Returns the value of this Long as a long value.

Usage

From source file:cherry.example.web.applied.ex10.AppliedEx10ControllerImpl.java

@Override
public ModelAndView execute(AppliedEx10Form form, BindingResult binding, Authentication auth, Locale locale,
        SitePreference sitePref, NativeWebRequest request) {

    if (hasErrors(form, binding)) {
        return withViewname(viewnameOfStart).build();
    }//from   w w w  . j  av a 2  s.  c om

    if (!oneTimeTokenValidator.isValid(request.getNativeRequest(HttpServletRequest.class))) {
        LogicalErrorUtil.rejectOnOneTimeTokenError(binding);
        return withViewname(viewnameOfStart).build();
    }

    Long id = service.create(form);
    checkState(id != null, "failed to create: form=%s", form);

    return redirect(redirectOnExecute(id.longValue())).build();
}

From source file:com.intuit.tank.project.JobValidator.java

public long getDurationMs(String group) {
    Long duration = expectedDuration.get(group);
    return duration != null ? duration.longValue() : 0L;
}

From source file:com.intuit.tank.project.JobValidator.java

public long getExpectedTime(String group) {
    Long duration = expectedDuration.get(group);
    return duration != null ? duration.longValue() : 0;
}

From source file:org.kuali.mobility.push.service.DeviceServiceImplTest.java

@Test
public void testCountDevicesWithoutUsername() {
    Long count = getService().countDevicesWithoutUsername();
    assertEquals("Found more than one device without a username.", 1L, count.longValue());
}

From source file:com.rcs.service.service.impl.MessageSourceLocalServiceImpl.java

public long getMessageSourcesKeyCount() throws SystemException {
    DynamicQuery query = DynamicQueryFactoryUtil.forClass(MessageSource.class);
    query.setProjection(ProjectionFactoryUtil.countDistinct("primaryKey.key"));
    List result = MessageSourceLocalServiceUtil.dynamicQuery(query);
    Long count = (Long) result.get(0);
    return count.longValue();
}

From source file:com.redhat.rhn.domain.kickstart.KickstartFactory.java

/**
 * Lookup a list of KickstartableTree objects that use the passed in channelId
 * @param channelId The base channel of the kickstart trees
 * @return List of KickstartableTree objects
 *//*from w  w w  .  j a v a2  s  .c o  m*/
public static List<KickstartableTree> lookupKickstartTreesByChannelAndNullOrg(Long channelId) {
    Session session = null;
    List retval = null;
    String query = "KickstartableTree.findByChannelAndNullOrg";
    session = HibernateFactory.getSession();
    retval = session.getNamedQuery(query).setLong("channel_id", channelId.longValue())
            // Retrieve from cache if there
            .setCacheable(true).list();
    return retval;
}

From source file:com.intuit.tank.project.JobValidator.java

private void addDuration(String groupName, int loop, long milis) {
    Long val = this.expectedDuration.get(groupName);
    long l = val != null ? val.longValue() : 0L;
    l += milis * loop;//from  w  ww.j a va2  s .  co m
    expectedDuration.put(groupName, l);
}

From source file:edu.utah.further.fqe.impl.service.route.DataSourceMock.java

/**
 * @param inputString/*from  ww w  .ja  v a 2  s . c  o m*/
 * @return processed input string
 */
@Handler
public QueryContext processQueryContext(final @Body QueryContext parentContext) {
    Validate.notNull(parentContext);
    if (log.isDebugEnabled()) {
        log.debug(getDataSourcePrefix() + "processQueryContext() " + parentContext);
        log.debug("QC Data Source ID: " + parentContext.getDataSourceId());
        log.debug("Search criteria: " + parentContext.getQuery());
    }

    // This section mocks a data source's creation of a new child context, queuing it
    // and setting its parent.
    QueryContextEntity childContext = QueryContextEntity.newInstanceWithExecutionId();
    childContext.setDataSourceId(name);
    childContext.setParent(QueryContextEntity.newCopy(parentContext));
    // Assuming the search query's first criterion is of type [EQ,
    // desiredNumRecordsBackFromThisDataSource, value]. Set value (parameter #2
    // (0-based index) on the parameter list)as our output records.
    //
    // If there are two criteria, using the second criterion's value instead.
    final Long numRecords = getNumRecordsFromQuery(parentContext);

    childContext.setNumRecords(numRecords.longValue());
    childContext = (QueryContextEntity) contextService.queue(childContext);
    childContext.start();
    childContext.finish();

    final long sleepValue = getSleepValue();
    if (log.isDebugEnabled()) {
        log.debug("Sleeping for " + sleepValue + " miliseconds");
    }
    IoUtil.sleep(sleepValue);

    return QueryContextToImpl.newCopy(childContext);
}

From source file:fixio.netty.codec.FixMessageDecoderTest.java

@Test
public void testDecode() throws Exception {
    List<Object> result = decode(
            "8=FIX.4.1\u00019=90\u000135=0\u000149=INVMGR\u000156=BRKR\u000134=240\u000152=19980604-08:03:31\u000110=129\u0001");

    assertEquals(1, result.size());/*from   ww  w .ja  v  a2  s.c  o m*/
    assertTrue(result.get(0) instanceof FixMessageImpl);
    final FixMessageImpl fixMessage = (FixMessageImpl) result.get(0);

    FixMessageHeader header = fixMessage.getHeader();

    assertEquals("FIX.4.1", fixMessage.getHeader().getBeginString());
    assertEquals(MessageTypes.HEARTBEAT, fixMessage.getMessageType());
    assertEquals("INVMGR", header.getSenderCompID());
    assertEquals("BRKR", header.getTargetCompID());
    assertEquals(240, header.getMsgSeqNum());
    assertEquals(129, fixMessage.getChecksum());

    final Long value = fixMessage.getValue(FieldType.SendingTime);
    assertEquals(ZonedDateTime.of(LocalDate.of(1998, 6, 4), LocalTime.of(8, 3, 31), systemUTC().zone())
            .toInstant().toEpochMilli(), value.longValue());
}

From source file:org.horizontaldb.integration.DatabaseIntegrationTest.java

@Test(expected = IllegalStateException.class)
public void shouldNotAllowChangingIdentityForAuthenticatedCall() {
    ShardContext context = new ShardContext(TestUser.JANE.name());

    try {//w  w w .  j  a v  a  2  s.  c  om
        testService.authenticate(testUserHelper.getJoeToken());

        Long actualCount = testService.getCountOfPersonsByDepartment(context,
                TestDepartment.DEVELOPMENT.name());

        assertEquals(0, actualCount.longValue());
    } finally {
        testService.logoff(testUserHelper.getJoeToken());
    }
}