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:at.christophwurst.orm.service.EmployeeServiceTest.java

@Test
public void getById() {
    Employee empl1234 = service.getById(1234L);
    assertNotNull(empl1234);
    assertEquals(new Long(1234), empl1234.getId());
}

From source file:controllers.group.GroupMsgApp.java

/**
 * ???/*from  w  w w  . j a  v a2s. c  om*/
 * @return
 * @throws IOException 
 */
@Transactional
public static Result agreeApply() throws IOException {
    User currentUser = User.getFromSession(session());
    ObjectNodeResult result = new ObjectNodeResult();
    Long groupId = new Long(request().getQueryString("groupId"));
    Long userId = new Long(request().getQueryString("userId"));
    Long messageId = new Long(request().getQueryString("messageId"));
    Group group = Group.queryGroupById(groupId);
    if (group == null)
        return ok(result.errorkey("group.error.nofound").getObjectNode());
    User recevierUser = User.findById(userId);
    List<User> userList = Group.queryUserListOfGroup(groupId); // ?
    if (!userList.contains(recevierUser)) { // ?
        ChatService.appendMemberToGroup(groupId, userId);
        MessageService.pushMsgApplyAgree(currentUser, recevierUser, group);
        MessageService.handlerMessage(messageId);
    } else {
        MessageService.handlerMessage(messageId);
        return ok(result.error("?.").getObjectNode());
    }
    return ok(result.getObjectNode());
}

From source file:com.agiletec.aps.system.ApsSystemUtils.java

/**
 * Inizializzazione della classe di utilit.
 * @throws Exception//  www .  j a v  a2s  .com
 */
public void init() throws Exception {

    String appenderName = "ENTANDO";

    //TODO set this in constant
    String conversionPattern = (String) this._systemParams.get("log4jConversionPattern");
    if (StringUtils.isBlank(conversionPattern)) {
        conversionPattern = "%d{yyyy-MM-dd HH:mm:ss.SSS} - %-5p -  %c - %m%n"; //default conversionPattern
    }
    PatternLayout layout = new PatternLayout(conversionPattern);

    String maxFileSize = (String) this._systemParams.get(INIT_PROP_LOG_FILE_SIZE);
    if (StringUtils.isBlank(maxFileSize)) {
        maxFileSize = "1MB"; //default size
    } else {
        long mega = new Long(maxFileSize) / KILOBYTE;
        maxFileSize = mega + "KB";
    }
    String filename = (String) this._systemParams.get(INIT_PROP_LOG_FILE_PREFIX);
    int maxBackupIndex = Integer.parseInt((String) this._systemParams.get(INIT_PROP_LOG_FILES_COUNT));
    String log4jLevelString = (String) this._systemParams.get(INIT_PROP_LOG_LEVEL);
    if (StringUtils.isBlank(log4jLevelString)) {
        log4jLevelString = "INFO"; //default level
    }

    RollingFileAppender fileAppender = (RollingFileAppender) LogManager.getRootLogger()
            .getAppender(appenderName);
    if (null == fileAppender) {
        fileAppender = new RollingFileAppender();
        fileAppender.setName(appenderName);
    }
    fileAppender.setMaxBackupIndex(maxBackupIndex);
    fileAppender.setThreshold(org.apache.log4j.Level.toLevel(log4jLevelString));
    fileAppender.setLayout(layout);
    fileAppender.setMaxFileSize(maxFileSize);

    fileAppender.setFile(filename);
    fileAppender.activateOptions();

    AsyncAppender async = (AsyncAppender) LogManager.getRootLogger().getAppender("async");
    async.addAppender(fileAppender);
}

From source file:net.sf.morph.util.TestClass.java

public static Map getFullMap() {
    Map fullMap = new HashMap();
    fullMap.put("anObject", new Long(14));
    fullMap.put("myInteger", new Integer(4));
    fullMap.put("myMap", getMyMapProperty());
    fullMap.put("myLongValue", new Long(13));
    fullMap.put("array", new Object[] { "hi" });
    fullMap.put("numberArray", NUMBER_ARRAY);
    fullMap.put("funkyArray", NUMBER_ARRAY);
    fullMap.put("bigDecimal", new BigDecimal(3.5));
    fullMap.put("string", "string");
    return fullMap;
}

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

@Test
public void generateToken_normal() {

    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 S = tokenUtils.generateToken(userDetails, device);

}

From source file:com.redhat.rhn.common.security.acl.BaseHandler.java

/**
 * Returns a Long object from the given object.  We expect
 * a String[] or String as the input all others return null;
 * @param o object to be converted//from  w w w. ja  v a  2 s  .  c  o  m
 * @return Long if object is parsable, or null.
 */
public Long getAsLong(Object o) {
    Long ret = null;

    if (o != null) {
        if (o instanceof String[]) {
            String[] s = (String[]) o;
            if (s.length > 0 && !StringUtils.isEmpty(s[0])) {
                ret = new Long(s[0]);
            }
        } else if (o instanceof String) {
            String s = (String) o;
            if (!StringUtils.isEmpty(s)) {
                ret = new Long(s);
            }
        } else if (o instanceof Long) {
            ret = (Long) o;
        }
    }

    return ret;
}

From source file:jp.co.acroquest.endosnipe.report.converter.util.calc.LongCalculator.java

public Object sub(Object obj1, Object obj2) {
    Long longData1 = (Long) obj1;
    Long longData2 = (Long) obj2;

    return (Object) (new Long((long) (longData1.longValue() - longData2.longValue())));
}

From source file:com.anite.zebra.ext.state.memory.MemoryProcessInstance.java

public MemoryProcessInstance() {
    long temp = processInstanceCounter.longValue();
    processInstanceId = new Long(temp);
    temp++;//  w  w  w  .ja  va2s.  co  m
    processInstanceCounter = new Long(temp);
    log.info("Created MemoryProcessInstance id " + processInstanceId);

}

From source file:mx.um.edu.medicina.camposClinicos.webapp.PlazaFormController.java

@ModelAttribute
@RequestMapping(method = RequestMethod.GET)
protected Plaza showForm(HttpServletRequest request) throws Exception {
    String id = request.getParameter("id");

    if (!StringUtils.isBlank(id)) {
        return plazaManager.get(new Long(id));
    }/*w w w. j a v a2 s  .  c  o  m*/

    return new Plaza();
}

From source file:JobBase.java

/**
 * Set the given counter to the given value
 * //from w w  w.  jav a  2s. c  o  m
 * @param name
 *          the counter name
 * @param value
 *          the value for the counter
 */
protected void setLongValue(Object name, long value) {
    this.longCounters.put(name, new Long(value));
}