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:org.myjerry.evenstar.web.author.DeletePostController.java

/**
 * User action to delete the given post.
 * /*  w w w  .j  a va 2 s. c om*/
 * @param request
 * @param response
 * @return
 * @throws Exception
 */
public ModelAndView view(HttpServletRequest request, HttpServletResponse response) throws Exception {
    ModelAndView mav = new ModelAndView();
    mav.setViewName(".author.deletePost");

    String blogID = request.getParameter("blogID");
    String postID = request.getParameter("postID");

    BlogPost post = this.blogPostService.getPost(new Long(postID), new Long(blogID));

    mav.addObject("blogID", blogID);
    mav.addObject("postID", postID);
    mav.addObject("post", post);

    return mav;
}

From source file:edu.usc.goffish.gofs.formats.gml.GMLWriter.java

public static Object classValueToGMLValue(Object value) {
    if (value instanceof Integer) {
        return new Long(((Integer) value).longValue());
    } else if (value instanceof Float) {
        return new Double(((Float) value).doubleValue());
    } else if (value instanceof Boolean) {
        return new Long(((Boolean) value).booleanValue() ? 1L : 0L);
    } else if (value instanceof List) {
        @SuppressWarnings("unchecked")
        List<Object> list = (List<Object>) value;
        List<KeyValuePair> children = new ArrayList<>(list.size());
        for (Object v : list) {
            children.add(KeyValuePair.createKVP("value", v));
        }//ww w .j av  a2s . c o m
        return children;
    }

    return value;
}

From source file:com.judoscript.jamaica.MyUtils.java

public static Object parseIntObject(String x, String typeHint) {
    boolean isLong = x.endsWith("l") || x.endsWith("L");
    if (isLong) {
        x = x.substring(0, x.length() - 1);
        if (typeHint == null)
            typeHint = "long";
    }/*from  www .ja v  a2  s. c  o m*/

    long l;
    try {
        if (x.charAt(0) != '0') {
            l = Long.parseLong(x); // Decimal
        } else if (x.length() == 1) {
            l = 0;
        } else {
            char ch = x.charAt(1); // if exceptions, it's 0 anyway.
            if ((ch == 'x') || (ch == 'X'))
                l = Long.parseLong(x.substring(2), 16); // Hex
            else
                l = Long.parseLong(x, 8); // Octal
        }
    } catch (Exception e) {
        l = 0;
    }

    if (typeHint != null)
        return number2object(l, typeHint);
    else if (isLong)
        return new Long(l);
    else
        return new Integer((int) l);
}

From source file:com.octo.captcha.engine.bufferedengine.SimpleBufferedEngineContainer.java

public SimpleBufferedEngineContainer(CaptchaEngine engine, CaptchaBuffer memoryBuffer, CaptchaBuffer diskBuffer,
        ContainerConfiguration containerConfiguration, int feedPeriod, int swapPeriod) {
    super(engine, memoryBuffer, diskBuffer, containerConfiguration);

    this.swapPeriod = new Long(swapPeriod);
    this.feedPeriod = new Long(feedPeriod);
    startScheduler();/*  w  w w .  jav  a 2s.  c  o  m*/
}

From source file:com.healthcit.cacure.businessdelegates.FormManagerIntegrationTest.java

@Test
@DataSet("FormManagerIntegrationTest.xml")
public void testGetForm() {
    BaseForm form = formManager.getForm(11L);
    assertNotNull(form);/*from w  w w . j a va  2s .  com*/
    assertTrue(form instanceof QuestionnaireForm);
    assertEquals(new Long(11), form.getId());
    assertEquals(new Long(2), form.getAuthor().getId());
    assertEquals(new Long(1), form.getLockedBy().getId());
    assertEquals(new Long(1), form.getLastUpdatedBy().getId());
    assertEquals(new Long(10), form.getModule().getId());
    assertEquals("questionnaire form 1", form.getName());
    assertEquals(new Integer(1), form.getOrd());
    assertEquals(FormStatus.IN_REVIEW, form.getStatus());
    assertEquals(date("2011-07-01 11:00"), form.getUpdateDate());
    assertEquals(uuid("uuid-form-11"), form.getUuid());

}

From source file:MutableLong.java

public Long getValue() {
    return new Long(_value);
}

From source file:com.hs.mail.imap.dao.MySqlMailboxDao.java

public Mailbox getMailbox(long ownerID, String mailboxName) {
    String sql = "SELECT * FROM mailbox USE INDEX (fk_mailbox_user) WHERE ownerid = ? AND name = ?";
    return (Mailbox) queryForObject(sql, new Object[] { new Long(ownerID), mailboxName }, mailboxRowMapper);
}

From source file:com.healthcit.cacure.model.QuestionnaireFormTest.java

@Test
@DataSet//ww  w.j  a  v  a 2s .c  o m
public void testRead() {
    QuestionnaireForm form = em.find(QuestionnaireForm.class, 1002L);
    assertNotNull(form);
    assertEquals("All Kind Of Elements Section", form.getName());
    assertNotNull(form.getModule());
    assertEquals(new Long(1001), form.getModule().getId());
    assertEquals(new Integer(2), form.getOrd());
    assertEquals(FormStatus.IN_PROGRESS, form.getStatus());
    assertEquals(date("2011-05-31 11:02:50.828"), form.getUpdateDate());
    assertEquals(new Long(1), form.getAuthor().getId());
    assertEquals(uuid("da1e9eaf-aafa-445c-9a82-57712caa128f"), form.getUuid());
    assertEquals(new Long(1), form.getLockedBy().getId());
    assertEquals(new Long(1), form.getLastUpdatedBy().getId());
    assertNotNull(form.getElements());
    assertEquals(13, form.getElements().size());
    assertEquals(new Long(1005), form.getElements().get(0).getId());
    assertEquals(new Long(1004), form.getElements().get(1).getId());
    assertEquals(new Long(1010), form.getElements().get(2).getId());
    assertEquals(new Long(1003), form.getFormSkipRule().getId());
}

From source file:org.openmeetings.app.templates.ResetPasswordTemplate.java

public String getResetPasswordTemplate(String reset_link, Long default_lang_id) {
    try {/* ww  w . j  a va  2s  . com*/

        super.init();

        Fieldlanguagesvalues labelid514 = fieldmanagment.getFieldByIdAndLanguage(new Long(514),
                default_lang_id);
        Fieldlanguagesvalues labelid515 = fieldmanagment.getFieldByIdAndLanguage(new Long(515),
                default_lang_id);
        Fieldlanguagesvalues labelid516 = fieldmanagment.getFieldByIdAndLanguage(new Long(516),
                default_lang_id);

        /* lets make a Context and put data into it */
        VelocityContext context = new VelocityContext();
        context.put("reset_link", reset_link);
        context.put("reset_link2", reset_link);
        context.put("labelid513", fieldmanagment.getString(513L, default_lang_id));
        context.put("labelid514", labelid514.getValue());
        context.put("labelid515", labelid515.getValue());
        context.put("labelid516", labelid516.getValue());

        /* lets render a template */
        StringWriter w = new StringWriter();
        Velocity.mergeTemplate(templateName, "UTF-8", context, w);

        return w.toString();

    } catch (Exception e) {
        log.error("Problem merging template : ", e);
        // System.out.println("Problem merging template : " + e );
    }
    return null;
}

From source file:org.lamop.riche.webservices.WorkRESTWS.java

@DELETE
@Path("{id}")
@Produces(MediaType.APPLICATION_JSON)// w  ww.j  ava 2  s .c  om
@RequestMapping(method = RequestMethod.DELETE)
public void remove(@PathParam("id") int id) {
    serviceWork.removeEntity(new Long(id));
}