Example usage for java.lang Long intValue

List of usage examples for java.lang Long intValue

Introduction

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

Prototype

public int intValue() 

Source Link

Document

Returns the value of this Long as an int after a narrowing primitive conversion.

Usage

From source file:org.tec.webapp.jdbc.entity.TestUser.java

/**
 * create seed user// w w w . j  a  v a  2s. c  o m
 * @return the seed user
 */
protected UserBean testUser() {
    UserBean user = new User();

    user.setUserName("junit");
    user.setEmail("junit@test.null");

    Long id = mUserDba.insert(user);
    Assert.assertTrue("id is foobared", id > 0);

    user.setUserId(id.intValue());

    return user;
}

From source file:com.pegawai.app.controller.PegawaiController.java

@RequestMapping(value = "/form", method = RequestMethod.GET)
public void tampilkanForm(@RequestParam(required = false, defaultValue = "-") String id, ModelMap mm) {
    Pegawai p = null;//from w  ww  .j av  a  2s  . c o  m
    if (!id.equals("-")) {
        p = pegawaiService.findOne(id);
    }

    if (p != null) {
        mm.addAttribute("pegawai", p);
    } else {
        mm.addAttribute("pegawai", new Pegawai());
    }

    Long countJabatan = jabatanService.count();
    Page<Jabatan> listJabatan = jabatanService.findAll(new PageRequest(0, countJabatan.intValue()));
    mm.addAttribute("daftarJabatan", listJabatan);
}

From source file:edu.upc.dama.sparksee.RemoteGraph.java

public String next(Long queryId, Long rows) {
    return ((RemoteTransaction) this.tx()).next(queryId.intValue(), rows.intValue());
}

From source file:es.tid.fiware.rss.dao.impl.GenericDaoImpl.java

@Override
public int count() {
    List list = getHibernateTemplate().find("select count(*) from " + domainClass.getName() + " o");
    Long count = (Long) list.get(0);
    return count.intValue();
}

From source file:net.turnbig.jdbcx.test.JdbcxQueryTest.java

@Test
public void testQueryPrimitiveObject() {
    Integer count = jdbc.queryForObject("select count(0) from member", Integer.class);
    Assert.assertEquals("total records is 2", count.intValue(), 2);

    Long countLong = jdbc.queryForObject("select count(0) from member", Long.class);
    Assert.assertEquals("total records is 2", countLong.intValue(), 2);

    Member m = new Member();
    m.setName("woo");
    Boolean isAdmin = jdbc.queryForObject("select is_admin from member where name = :name", m, Boolean.class);
    Assert.assertTrue(isAdmin);//from w w w  .  j av  a 2  s  .co m
}

From source file:jcine.AsientosClient.java

public Asiento[] getAsientos() throws IOException, ParseException {

    HttpURLConnection conn = (HttpURLConnection) entryPoint.openConnection();
    conn.setRequestMethod("GET");
    conn.setDoOutput(true);/*from   w w  w . ja va 2  s.  c  om*/
    StringBuilder builder = new StringBuilder();
    BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8"));
    String line;
    while ((line = reader.readLine()) != null) {
        builder.append(line);
    }

    JSONParser parser = new JSONParser();

    JSONArray list = (JSONArray) parser.parse(builder.toString());

    Asiento[] result = new Asiento[list.size()];

    for (int i = 0; i < list.size(); i++) {
        JSONObject obj = (JSONObject) list.get(i);
        String name = (String) obj.get("numero");
        Long posX = (Long) obj.get("posicionX");
        Long posY = (Long) obj.get("posicionY");

        result[i] = new Asiento(name, posX.intValue(), posY.intValue());

    }

    return result;
}

From source file:edu.upc.dama.sparksee.RemoteGraph.java

public String closeQuery(Long queryId) {
    String closeRequest = ((RemoteTransaction) this.tx()).closeQuery(queryId.intValue());
    return closeRequest;
}

From source file:es.upm.fiware.rss.dao.impl.GenericDaoImpl.java

@Override
public int count() {
    List list = this.getSession().createQuery("select count(*) from " + this.domainClass.getName() + " o")
            .list();//from   ww  w . ja v a 2 s  . com

    Long count = (Long) list.get(0);
    return count.intValue();
}

From source file:de.tud.kitchen.android.NTPTimeReceiver.java

@Override
protected Void doInBackground(InetAddress... params) {
    NTPUDPClient client = new NTPUDPClient();
    client.setDefaultTimeout(10000);/*from  w  w  w  .ja  va2 s  .  co m*/
    try {
        client.open();
    } catch (final SocketException se) {
        se.printStackTrace();
        return null;
    }
    while (!this.isCancelled()) {
        try {
            TimeInfo info = client.getTime(params[0]);
            info.computeDetails();
            Long offsetValue = info.getOffset();
            int receiverTimeDelta = (offsetValue == null) ? 0 : offsetValue.intValue();
            publishProgress(receiverTimeDelta);
        } catch (final IOException ioe) {
            ioe.printStackTrace();
            continue;
        }

        try {
            Thread.sleep(1000 * 60);
        } catch (InterruptedException e) {
            continue;
        }
    }
    client.close();
    return null;
}

From source file:it.jugpadova.controllers.EventEditController.java

private int index(Long indexSpeaker) {
    return indexSpeaker.intValue() - 1;
}