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:jp.co.ntts.vhut.util.VhutUtil.java

/**
 * Vhut????????????./*from  w  w  w . j a  va2s  .  c  o  m*/
 * @param prefix 
 * @param privateId ?ID
 * @return ?
 */
public static String createServicePrefix(String prefix, long privateId) {
    String privateIdString = new Long(privateId).toString();
    if (privateIdString.length() > 2) {
        privateIdString = privateIdString.substring(privateIdString.length() - 3);
    }
    String id = StringUtils.leftPad(privateIdString, 3, "0");
    return String.format("%s%s", prefix, id);
}

From source file:reviewbot.controllers.ReviewController.java

@RequestMapping(value = "/readReview", method = RequestMethod.GET, produces = "application/json")
public ReviewDTO readReview(@RequestParam(value = "id") String idStr) {
    if (idStr == null) {
        return new ReviewDTO();
    }//from   w  w  w  . j a  va 2s.com
    return _reviewService.readOne(new Long(Long.parseLong(idStr)));

}

From source file:com.cemeterylistingswebtest.test.rest.LoginControllerTest.java

@Test(enabled = false)
public void testCreate() {
    Long subID = new Long(17);
    Calendar calendar = Calendar.getInstance();
    calendar.set(Calendar.YEAR, 2008);
    calendar.set(Calendar.MONTH, Calendar.FEBRUARY);
    calendar.set(Calendar.DATE, 4);

    java.sql.Date javaSqlDate = new java.sql.Date(calendar.getTime().getTime());

    UserRole user = new UserRole.Builder().setLevel(1).build();

    Subscriber newSub = new Subscriber.Builder().setEmail("manfredOsulivan@horseRaddish.com")
            .setFirstName("Manfred").setSurname("Osulivan").setPwd("applesandsuch").setUsername("ManiFredOssy")
            .setSubscriptionDate(javaSqlDate).setUserRoleID(user).build();

    HttpEntity<Subscriber> requestEntity = new HttpEntity<>(newSub, getContentType());
    //        Make the HTTP POST request, marshaling the request to JSON, and the response to a String
    ResponseEntity<String> responseEntity = restTemplate.exchange(URL + "api/Subscriber/create",
            HttpMethod.POST, requestEntity, String.class);
    System.out.println(" THE RESPONSE BODY " + responseEntity.getBody());
    System.out.println(" THE RESPONSE STATUS CODE " + responseEntity.getStatusCode());
    System.out.println(" THE RESPONSE IS HEADERS " + responseEntity.getHeaders());

    Assert.assertEquals(responseEntity.getStatusCode(), HttpStatus.OK);
    id = newSub.getSubscriberID();//from ww  w  .  j a va 2 s .  c  o  m
}

From source file:functionnality.VelibAvailableBikesST4.java

public VelibStation request() {
    VelibWebRequest velibR = new VelibWebRequest("/vls/v1/stations/" + station.getNumStation());
    JSONObject response;/*  w w w.j a  va2s.c  o m*/
    String status;
    long available_bike_stands = 0, available_bikes = 0;
    Object tmp;
    if (!station.getNumStation().equals("")) {
        velibR.addParameterGet("contract", "Toulouse");
        response = velibR.parseResultJSON(velibR.requestWithGet());
        status = (String) response.get("status");
        if (status != null) {
            tmp = response.get("available_bike_stands");
            if (tmp != null) {
                available_bike_stands = (long) tmp;
            }
            tmp = response.get("available_bikes");
            if (tmp != null) {
                available_bikes = (long) tmp;
            }
            station.setStatus(status);
            station.setAvailableBikes(new Long(available_bikes).intValue());
            station.setAvailableStands(new Long(available_bike_stands).intValue());
            return station;
        }
    }
    return null;
}

From source file:com.ewcms.plugin.vote.manager.web.ResultServlet.java

@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    ServletOutputStream out = null;//  www  .  j av a  2 s.  com
    StringBuffer output = new StringBuffer();
    try {
        String id = req.getParameter("id");

        if (!id.equals("") && StringUtils.isNumeric(id)) {
            Long questionnaireId = new Long(id);

            ServletContext application = getServletContext();
            WebApplicationContext wac = WebApplicationContextUtils.getWebApplicationContext(application);
            VoteFacable voteFac = (VoteFacable) wac.getBean("voteFac");

            String ipAddr = req.getRemoteAddr();

            output = voteFac.getQuestionnaireResultClientToHtml(questionnaireId,
                    getServletContext().getContextPath(), ipAddr);
        }
        out = resp.getOutputStream();
        resp.setCharacterEncoding("UTF-8");
        resp.setContentType("text/html; charset=UTF-8");
        out.write(output.toString().getBytes("UTF-8"));
        out.flush();
    } finally {
        if (out != null) {
            out.close();
            out = null;
        }
    }
}

From source file:edu.utah.further.fqe.api.util.FqeQueryContextUtil.java

/**
 * Returns the masked safe result, that is if results are less than mask but greater
 * than zero, a masked value is returned.
 * /*from  w w w. jav  a  2  s .  c  o  m*/
 * @param qc
 * @param mask
 * @return
 */
public static String getResultMaskSafe(final QueryContextTo qc, final int mask) {
    if (qc.getNumRecords() == ResultContext.ACCESS_DENIED) {
        return "Unauthorized";
    }
    final boolean masked = qc.getHasChildren() ? isAnyChildMasked(qc, mask) : isChildMasked(qc, mask);
    return masked ? FqeNames.MASK_STRING : new Long(qc.getNumRecords()).toString();
}

From source file:gov.nih.nci.lv.util.LVUtils.java

/**
 * converts a ids seperated by a comma to a set.
 * @param ids ids/*from  w ww  .ja  v a  2 s.  co m*/
 * @param delimiter delimiter
 * @return Set
 */
public static List<Long> convertStringToList(String ids, String delimiter) {
    List<Long> labs = new ArrayList<Long>();
    if (StringUtils.isEmpty(ids)) {
        return labs;
    }
    StringTokenizer st = new StringTokenizer(ids, delimiter);
    while (st.hasMoreTokens()) {
        labs.add(new Long(st.nextElement().toString()));
    }
    return labs;
}

From source file:fr.syncarnet.tasks.DeletedTasks.java

public boolean add(UUID uuid, long timestamp) {
    timestamps.put(uuid, new Long(timestamp));
    return super.add(uuid);
}

From source file:com.ewcms.content.vote.web.ResultServlet.java

@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    ServletOutputStream out = null;// w w  w. ja v a  2 s  .c o  m
    StringBuffer output = new StringBuffer();
    try {
        String id = req.getParameter("id");

        if (!id.equals("") && StringUtils.isNumeric(id)) {
            Long questionnaireId = new Long(id);

            ServletContext application = getServletContext();
            WebApplicationContext wac = WebApplicationContextUtils.getWebApplicationContext(application);
            QuestionnaireService questionnaireService = (QuestionnaireService) wac
                    .getBean("questionnaireService");

            String ipAddr = req.getRemoteAddr();

            output = questionnaireService.getQuestionnaireResultClientToHtml(questionnaireId,
                    getServletContext().getContextPath(), ipAddr);
        }
        out = resp.getOutputStream();
        resp.setCharacterEncoding("UTF-8");
        resp.setContentType("text/html; charset=UTF-8");
        out.write(output.toString().getBytes("UTF-8"));
        out.flush();
    } finally {
        if (out != null) {
            out.close();
            out = null;
        }
    }
}

From source file:fr.mael.microrss.service.FeedServiceTest.java

@Test
public void testNb() {
    login(17);/*from  w w w  .j  a  v a 2s  .  c  o m*/
    configuration.setArticlePageSize(4);
    Long nb = feedService.pageNumber(feedService.get(1));
    Assert.assertEquals(new Long(2), new Long(nb));
    configuration.setArticlePageSize(3);
    nb = feedService.pageNumber(feedService.get(1));
    Assert.assertEquals(new Long(3), new Long(nb));
}