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.constretto.spring.configuration.AutowiredConstrettoConfigurationAnnotationTest.java

@Test
public void usePropertyEditorsWhenNeeded() {
    assertEquals(new Long(4), validBeanUsingPropertyEditors.getLongProperty());
    assertNotNull(validBeanUsingPropertyEditors.getFileProperty());
    assertNotNull(validBeanUsingPropertyEditors.getResourceProperty());
}

From source file:com.grahamtech.ads.pojos.AdverseDrugEvent.java

public AdverseDrugEvent flattenEventObjectDTO(AdverseDrugEventResultFlattened flattenedObj) {
    AdverseDrugEvent fullObj = new AdverseDrugEvent();
    fullObj.setMeta(new Meta("20150601"));

    Results result = new Results();
    result.setEvent_id(flattenedObj.getEvent_id());
    result.setCompanynumb(flattenedObj.getCompanynumb());
    result.setSafetyreportid(flattenedObj.getSafetyreportid());
    result.setSender(new Sender(flattenedObj.getSenderorganization()));
    result.setSerious(new Long(flattenedObj.getSerious()).toString());

    List<Reaction> reactionsList = new ArrayList<Reaction>();
    String[] reactionsStringArray = flattenedObj.getPatient_reactions().split("\\,");
    for (String token : reactionsStringArray) {
        String keyValueTrimmed = token.replaceAll("^\\s+", "").replaceAll("\\s+$", "");
        if (!keyValueTrimmed.equals("") && !keyValueTrimmed.equals(" ")) {
            Reaction reaction = new Reaction(keyValueTrimmed);
            reactionsList.add(reaction);
        }/*from w w w . j  a va 2 s.co  m*/
    }

    Reaction[] reactionArray = new Reaction[reactionsList.size()];
    reactionsList.toArray(reactionArray); // fill the array

    result.setPatient(new Patient(reactionArray));
    Results[] resultsArray = new Results[1];
    resultsArray[0] = result;
    fullObj.setResults(resultsArray);

    return fullObj;
}

From source file:com.arindra.project.accounting.controllers.InvoiceController.java

@RequestMapping(method = RequestMethod.GET, value = "/create_demo")
public void createDemoPurchaseOrder() {//@PathVariable("username") String username, @PathVariable("password") String password,@PathVariable("limit") Integer limit){
    Invoice invoice = new Invoice("1", null);
    InvoiceDetail invoiceDetail = new InvoiceDetail(new Long(1), null, new Long(1));

    invoiceRepo.save(invoice);//from  w  w w . j  a  va 2  s.c  o m
    invoiceDetailRepo.save(invoiceDetail);
}

From source file:com.jevontech.wabl.TokenUtilsTest.java

@Test
public void getUserNameFromToken() {

    given(configurationService.getSecret()).willReturn("A");
    given(configurationService.getExpirationTime()).willReturn(new Long(1));
    given(device.isNormal()).willReturn(true);
    given(userDetails.getUsername()).willReturn("test");
    //given(userDetails.getPassword()).willReturn("password");
    //UserDetails userDetails = (UserDetails) new TestUserDetails();
    String token = tokenUtils.generateToken(userDetails, device);
    String username = tokenUtils.getUsernameFromToken(token);
    assertEquals("username should be test", username, "test");

}

From source file:com.webfileanalyzer.testservice.FileStatisticServiceTest.java

@Test
public void getFileByIdTest() {
    Files f = new Files();
    f.setFileName("junit test");
    f.setProcDate(new Date());
    fileService.add(f);//from  w w w  .  ja  v  a  2  s .  c  o m
    assertNotNull(f.getId());
    FileStatistic fs = new FileStatistic("Line unit test1", 5l, 45l, 2l, 6.8);
    fs.setFileId(f.getId());
    fileStatisticService.add(fs);
    FileStatistic fs2 = new FileStatistic("Line unit test2", 5l, 42l, 2l, 4.8);
    fs2.setFileId(f.getId());
    fileStatisticService.add(fs2);
    FileStatistic fs3 = new FileStatistic("Line unit test2", 5l, 0l, 2l, 3.8);
    fs3.setFileId(f.getId());
    fileStatisticService.add(fs3);

    assertEquals("Number of inserted params must be same with retrieved.", 3,
            fileStatisticService.getStatisticsByFileId(new Long(f.getId())).size());

    assertNotNull(fileStatisticService.getStatisticsByFileId(new Long(f.getId())).get(0).getFileId());

    fileStatisticService.delete(fs);
    fileStatisticService.delete(fs2);
    fileStatisticService.delete(fs3);
    fileService.delete(f);

}

From source file:it.grid.storm.namespace.util.userinfo.UserInfoCommand.java

/**
 * // ww  w  .  j  a va2s. c o m
 * @param parameters
 * @return
 * @throws UserInfoException
 */
public int retrieveGroupID(UserInfoParameters parameters) throws UserInfoException {

    int groupId = -1;
    String[] command = buildCommandString(parameters);

    StringBuffer commandOutput = new StringBuffer();
    for (String element : command) {
        commandOutput.append(element).append(" ");
        log.debug("UserInfo Command INPUT String : " + commandOutput.toString());
    }
    String output = getOutput(command);
    if ((output != null) && (output.length() > 0)) {
        try {
            Long groupLong = new Long(Long.parseLong(output));
            if (groupLong.intValue() == groupLong.longValue()) {
                // The number in the output string fits in an integer (is at most 16
                // bits)
                groupId = groupLong.intValue();
            } else {
                // The number in the output string does not fits in an integer (is
                // between 17 and 32 bits)
                log.warn("Group named '" + parameters + "' has a 32 bit GID " + groupLong.longValue()
                        + " . Long GID are not managed by LCMAPS. Ignoring the group");
            }
        } catch (NumberFormatException nfe) {
            log.error("Group named '" + parameters
                    + "' return a result different from a long. NumberFormatException : " + nfe);
            throw new UserInfoException("Group named '" + parameters
                    + "' return a result different from a long. NumberFormatException : " + nfe);
        }
    } else {
        throw new UserInfoException(
                "Group named '" + parameters + "' return a result different from a integer");
    }
    return groupId;
}

From source file:org.opensourcebank.batch.reader.HazelcastMapItemReader.java

public void open(ExecutionContext executionContext) throws ItemStreamException {

    // staring Hazelcast to have this node join the cluster
    // and getting a reference to an items map
    itemMap = Hazelcast.getMap(mapName);

    // possibly restarted, but all items were completed / evicted by another node
    // or just a wrong map name
    if (itemMap.size() == 0) {
        logger.warn("Map [ " + mapName + " ] is empty, no items to read");
    }/*from w w w. j  a  v  a2s . c o  m*/

    // is this step restarted?
    if (executionContext.containsKey(CURRENT_ITEM_ID)) {
        currentItemId = new Long(executionContext.getLong(CURRENT_ITEM_ID)).intValue();
    } else {
        currentItemId = fromId;
    }
}

From source file:agilejson.JSON.java

/**
 * This method takes in a primitive that has been converted to an object
 * and creates a copy of it so that .equals results in different objects.
 * @param v/*from   ww  w.j  a v a2  s .c  o m*/
 * @throws java.lang.Exception
 */
private static Object getObjectForPrimitive(Object v) throws Exception {
    Class c = v.getClass();
    if (c == Byte.class) {
        return new String(new byte[] { ((Byte) v).byteValue() });
    } else if (c == Boolean.class) {
        return new Boolean((Boolean) v);
    } else if (c == Character.class) {
        return new Character((Character) v);
    } else if (c == Short.class) {
        return new Short((Short) v);
    } else if (c == Integer.class) {
        return new Integer((Integer) v);
    } else if (c == Long.class) {
        return new Long((Long) v);
    } else if (c == Float.class) {
        return new Float((Float) v);
    } else if (c == Double.class) {
        return new Double((Double) v);
    } else {
        throw new Exception("Unknown Primitive");
    }
}

From source file:MutableLong.java

/**
 * Gets the value as a Long instance.//from   w w  w.j a  v a 2  s  .c o m
 * 
 * @return the value as a Long
 */
public Object getValue() {
    return new Long(this.value);
}

From source file:com.pawelniewiadomski.devs.jira.webwork.BulkCreateIssues.java

public Long getMaxSize() {
    return new Long(Configuration.getString(APKeys.JIRA_ATTACHMENT_SIZE));
}