Example usage for java.lang Long Long

List of usage examples for java.lang Long Long

Introduction

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

Prototype

@Deprecated(since = "9")
public Long(String s) throws NumberFormatException 

Source Link

Document

Constructs a newly allocated Long object that represents the long value indicated by the String parameter.

Usage

From source file:com.addthis.hydra.data.util.TestConcurrentKeyTopper.java

@Test
public void testNonEmptyBytesEncoding() {
    ConcurrentKeyTopper topper1 = new ConcurrentKeyTopper();
    topper1.init();/* www  .j av  a  2s.c  o  m*/
    topper1.increment("a", 1, 5);
    topper1.increment("b", 2, 5);
    topper1.increment("c", 3, 5);
    topper1.increment("d", 4, 5);
    assertEquals(4, topper1.size());
    byte[] serialized = topper1.bytesEncode(0);
    ConcurrentKeyTopper topper2 = new ConcurrentKeyTopper();
    topper2.bytesDecode(serialized, 0);
    assertEquals(4, topper2.size());
    assertEquals(new Long(1), topper2.get("a"));
    assertEquals(new Long(2), topper2.get("b"));
    assertEquals(new Long(3), topper2.get("c"));
    assertEquals(new Long(4), topper2.get("d"));
}

From source file:com.bstek.dorado.data.variant.LinkedMetaData.java

public void setLong(String key, long l) {
    put(key, new Long(l));
}

From source file:com.abiquo.abiserver.business.authentication.TokenUtils.java

/**
 * Get the expiration from the token./* w  w w  . j  a  va  2s .co  m*/
 * 
 * @param token The token.
 * @return The expiration.
 */
public static long getTokenExpiration(final String[] token) {
    return new Long(token[1]).longValue();
}

From source file:org.springmodules.util.ObjectsTests.java

public void testHashCodeWithLong() {
    long lng = 883l;
    int expected = (new Long(lng)).hashCode();
    assertEquals(expected, Objects.hashCode(lng));
}

From source file:de.berlios.gpon.wui.actions.model.ItemTypeSelectAction.java

public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws IOException, ServletException {

    if (request.getParameter("objectId") != null) {
        // lets go and fill

        String objectId = request.getParameter("objectId");

        log.info("Selected objectId: " + objectId);

        GponModelDao model = (GponModelDao) getObjectForBeanId("txGponModelDao");
        ItemType it = null;//www  .  j av  a 2  s. co m

        try {
            it = model.findItemTypeById(new Long(objectId));
        } catch (Throwable ex) {
            log.error("Unable to get ComplexItemType with id " + objectId);
            return mapping.findForward("error");
        }

        if (it == null) {
            log.error("Unable to get ComplexItemType is null for id " + objectId);
            return mapping.findForward("error");
        }

        // complexType is set
        ItemTypeForm itemTypeForm = new ItemTypeForm();

        if (itemTypeForm != null) {
            itemTypeForm.setId(it.getId());
            itemTypeForm.setName(it.getName());
            itemTypeForm.setDescription(it.getDescription());
            if (it.getBaseType() != null) {
                itemTypeForm.setBaseItemTypeId(it.getBaseType().getId());
            }

            itemTypeForm.setPropertyDecl(
                    (ItemPropertyDecl[]) it.getInheritedItemPropertyDecls().toArray(new ItemPropertyDecl[0]));

            log.info("Item type props: " + it.getInheritedItemPropertyDecls());

            itemTypeForm.setPropertyDeclDelete(new boolean[it.getInheritedItemPropertyDecls().size()]);

            // New Properties have to be preinitialized  

            ItemPropertyDecl[] newPropertyDecl = new ItemPropertyDecl[20];

            for (int i = 0; i < 20; i++) {
                newPropertyDecl[i] = new ItemPropertyDecl();
            }

            itemTypeForm.setNewPropertyDecl(newPropertyDecl);

            // bind to session
            request.getSession().setAttribute("selectedItemTypeForm", itemTypeForm);
            request.getSession().setAttribute("selectedItemType", it);

        } else {
            log.error("itemTypeForm is null");
            return mapping.getInputForward();
        }
    } else {
        log.error("No objectId parameter!");
        return mapping.getInputForward();
    }

    return mapping.findForward("success");
}

From source file:mx.um.edu.medicina.camposClinicos.service.impl.PlazaManagerImpl.java

/**
 * {@inheritDoc}/*from ww  w .  j  av  a2s. c  o  m*/
 */
@Override
public void removePlaza(final String plazaId) {
    log.debug("removing plaza: " + plazaId);
    plazaDao.remove(new Long(plazaId));
}

From source file:org.openmrs.contrib.metadatarepository.service.impl.UserManagerImpl.java

/**
 * {@inheritDoc}
 */
public User getUser(String userId) {
    return userDao.get(new Long(userId));
}

From source file:dao.CarryonRecentAddQuery.java

/**
 * This method is not called by spring./*from  ww w.  j  a  v  a2s . c o m*/
 * This method adds an entry into pblob
 * @param conn the connection
 * @param ownerid 
 * @param entryid 
 * @param category 
 * @param btitle 
 * @param mimeType 
 * @param bsize 
 * @param zoom 
 * @param caption 
 * @exception BaseDaoException
 */
public void run(Connection conn, String ownerid, String entryid, int category, String btitle, String mimeType,
        long bsize, int zoom, String caption) throws BaseDaoException {

    byte[] capBytes = { ' ' };
    if (!RegexStrUtil.isNull(caption)) {
        capBytes = caption.getBytes();
    }
    String stmt = "insert into pblob values(?, ?, ?, ?, ?, ?, CURRENT_TIMESTAMP(), ?, ?, ?, ?)";
    PreparedStatement s = null;
    try {
        s = conn.prepareStatement(stmt);
        s.setLong(1, 0);
        s.setLong(2, new Long(entryid));
        s.setLong(3, new Long(ownerid));
        s.setInt(4, new Integer(category));
        s.setString(5, mimeType);
        s.setString(6, btitle);
        s.setLong(7, bsize);
        s.setInt(8, new Integer(zoom));
        s.setInt(9, 0);
        s.setBytes(10, capBytes);
        s.executeUpdate();
    } catch (SQLException e) {
        logger.error("Error adding a blob.", e);
        throw new BaseDaoException("Error adding pblob " + stmt, e);
    }
}

From source file:org.terasoluna.gfw.functionaltest.domain.service.date.DateServiceImpl.java

@Override
public void updateOperationDate(String id, String diffTime) {
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("diff", new Long(diffTime));
    params.put("operation_date_id", new Integer(id));

    jdbcTemplate.update(UPDATE_DIFF_BY_ID, params);
}

From source file:net.mindengine.oculus.frontend.web.controllers.admin.user.UserEditController.java

@Override
protected Object formBackingObject(HttpServletRequest request) throws Exception {
    Long id = new Long(request.getParameter("id"));
    User user = userDAO.getUserById(id);
    if (user == null)
        throw new UnexistentResource("user");
    return user;/*from   w  ww .ja  va 2  s  .  com*/
}