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:com.redhat.rhn.frontend.action.common.test.RhnSetActionTest.java

public static void verifyRhnSetData(Long uid, String setname, int size)
        throws HibernateException, SQLException {
    Session session = null;/*from ww  w. j  a  va 2  s .c  om*/
    Connection c = null;
    Statement stmt = null;
    ResultSet rs = null;
    try {
        session = HibernateFactory.getSession();
        session.flush();
        c = session.connection();
        stmt = c.createStatement();
        String query = "select * from rhnset where user_id = " + uid.toString();
        rs = stmt.executeQuery(query);

        assertNotNull(rs);

        int cnt = 0;
        while (rs.next()) {
            assertEquals(uid.longValue(), rs.getLong("USER_ID"));
            assertEquals(setname, rs.getString("LABEL"));
            cnt++;
        }

        assertEquals(size, cnt);
    } catch (SQLException e) {
        log.error("Error validating data.", e);
        throw e;
    } finally {
        HibernateHelper.cleanupDB(rs, stmt);
    }
}

From source file:io.fabric8.jube.local.NodeHelper.java

private static boolean safeCheckIsAlive(Installation installation) {
    Long pid = 0L;
    try {// w  ww . j  a v  a  2s  . co m
        pid = installation.getActivePid();
    } catch (Exception e) {
        // ignore, but force a pid value so we run for the timeout duration
    }
    return pid != null && pid.longValue() > 0;
}

From source file:com.redhat.rhn.domain.config.ConfigurationFactory.java

/**
 * Finds a ConfigRevision for a given ConfigFile and given revision id
 * @param cf The ConfigFile to look for.
 * @param revId The ConfigFile revision to look for.
 * @return ConfigRevision The sought for ConfigRevision.
 *//*w w  w  .  j av  a2s  . c  o m*/
public static ConfigRevision lookupConfigRevisionByRevId(ConfigFile cf, Long revId) {
    Session session = HibernateFactory.getSession();
    Query q = session.getNamedQuery("ConfigRevision.findByRevisionAndConfigFile");
    q.setLong("rev", revId.longValue());
    q.setEntity("cf", cf);
    return (ConfigRevision) q.uniqueResult();
}

From source file:com.harpatec.examples.converter.DateTimeReadConverter.java

@Override
public DateTime convert(DBObject source) {
    Long millis = (Long) source.get("millis");
    return new DateTime(millis.longValue());
}

From source file:com.nzion.util.UtilMisc.java

/** Converts an <code>Object</code> to a <code>long</code>. Returns
 * zero if conversion is not possible./*  www .  ja va 2 s . c  om*/
 * @param obj Object to convert
 * @return long value
 */
public static long toLong(Object obj) {
    Long result = toLongObject(obj);
    return result == null ? 0 : result.longValue();
}

From source file:com.redhat.rhn.domain.config.ConfigurationFactory.java

/**
 * Lookup a ConfigFile by its channel's id and config file name's id
 * @param channel The file's config channel id
 * @param name The file's config file name id
 * @return the ConfigFile found or null if not found.
 *//*  ww w  . j  a  v  a2  s. com*/
public static ConfigFile lookupConfigFileByChannelAndName(Long channel, Long name) {
    Session session = HibernateFactory.getSession();
    Query query = session.getNamedQuery("ConfigFile.findByChannelAndName")
            .setLong("channel_id", channel.longValue()).setLong("name_id", name.longValue())
            .setLong("state_id", ConfigFileState.normal().getId().longValue())
            //Retrieve from cache if there
            .setCacheable(true);
    try {
        return (ConfigFile) query.uniqueResult();
    } catch (ObjectNotFoundException e) {
        return null;
    }
}

From source file:org.callistasoftware.netcare.core.spi.impl.UnitServiceImpl.java

private MeasureUnitEntity resolveEntity(final Long id) {
    if (id.longValue() == -1L) {
        return null;
    }/*  w  w  w . j  av  a  2s .  c o m*/

    return repo.findOne(id);
}

From source file:de.crowdcode.bitemporal.example.AddressAuditRevision1Test.java

@Test
public void testAuditedAddressesRevision1() {
    Person person = personService.findPersonByLastname("Mueller");
    Address address = person.getAddress();

    Long addressId = address.getId();
    assertEquals(4L, addressId.longValue());

    String result = addressService.findRevisionNumberByAddressIdAndRevisionNumber(addressId, 1);
    assertEquals("2", result);
}

From source file:com.hendi.webapp.repository.EmployeeRepositoryTest.java

@Test
public void testHitung() {
    Long jumlah = er.count();
    Assert.assertEquals(3L, jumlah.longValue());
}

From source file:com.budiana.irpan.belajar.dao.PesertaDaoTest.java

@Test
public void testHitung() {
    Long jumlah = pd.count();
    Assert.assertEquals(3L, jumlah.longValue());
}