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.judoscript.jamaica.MyUtils.java

public static Object number2object(long val, String typeHint) {
    if (typeHint != null) {
        if (typeHint.equals("int"))
            return new Integer((int) val);
        if (typeHint.equals("long"))
            return new Long(val);
        if (typeHint.equals("short"))
            return new Short((short) val);
        if (typeHint.equals("char"))
            return new Character((char) val);
        if (typeHint.equals("byte"))
            return new Byte((byte) val);
        if (typeHint.equals("double"))
            return new Double(val);
        if (typeHint.equals("float"))
            return new Float(val);
    }/*from w ww. j a  v  a2  s .  c om*/
    return new Long(val);
}

From source file:dao.DirectoryAddStreamBlobQuery.java

/**
* This method is used to add blobstreams for directory.
* @param conn - the connection/*from  w w  w.j a va 2s .c  om*/
* @param blob - the blob stream
* @param blobType - the blob type (1 - photos, 2-music, 3-video 4 - documents, 5 - archives)
* @param mimeType - the mime type (image/jpeg, application/octet-stream)
* @param btitle - the title for this blob
* @param bsize - the size of the blob
* @param zoom - the zoom for the blob (used for displaying for image/jpeg)
* @param directoryId - the directoryId
* @param loginId - the loginId
* @param caption - the caption
* Modified query to accessdate at the end
* @throws Dao Exception - when an error or exception occurs while inserting this blob in DB.
*
 **/

public void run(Connection conn, byte[] blob, int blobType, String mimeType, String btitle, long bsize,
        int zoom, String directoryId, String loginId, String caption) throws BaseDaoException {

    // long dt = new java.util.Date().getTime();
    byte[] capBytes = { ' ' };
    if (!RegexStrUtil.isNull(caption)) {
        capBytes = caption.getBytes();
    }

    long dt = System.currentTimeMillis();
    PreparedStatement s = null;
    String stmt = "insert into dirblob values(?, ?, ?, ?, ?, ?, CURRENT_TIMESTAMP(), ?, ?, ?, ?, CURRENT_TIMESTAMP())";
    try {
        s = conn.prepareStatement(stmt);
        s.setLong(1, 0);
        s.setLong(2, new Long(directoryId));
        s.setLong(3, new Long(loginId));
        s.setInt(4, new Integer(blobType));
        s.setString(5, mimeType);
        s.setString(6, btitle);
        // s.setDate(7, new Date(dt));
        s.setBytes(7, blob);
        s.setLong(8, bsize);
        s.setInt(9, new Integer(zoom));
        s.setBytes(10, capBytes);
        s.executeUpdate();
    } catch (Exception e) {
        throw new BaseDaoException("Error adding a blob to directory query  stmt " + stmt, e);
    }
}

From source file:org.opencredo.couchdb.inbound.CouchDbChangesPollingMessageSourceTest.java

private List<ChangedDocument> createChangedDocuments(int n) throws URISyntaxException {
    List<ChangedDocument> documents = new ArrayList<ChangedDocument>();
    String uri = "http://test/database/";
    for (int i = 0; i < n; i++) {
        ChangedDocument doc = new ChangedDocument(new URI(uri + UUID.randomUUID()),
                ChangedDocument.Status.CREATED, new Long(i));
        documents.add(doc);/*from  w  ww.  j ava  2 s  . co  m*/
    }
    return documents;
}

From source file:edu.utah.further.fqe.impl.service.plan.DependencyExpression.java

/**
 * @param dependencyExpression/*  w  w w  .j  a v  a  2s .com*/
 */
public DependencyExpression(final String dependencyExpression) {
    final List<String> captureGroups = RegExUtil.capture(dependencyExpression, DEPENDENCY_EXPRESSION);
    this.qid = new Long(captureGroups.get(0));
    this.property = captureGroups.get(1);
}

From source file:com.feilong.commons.core.lang.ObjectUtilTest.java

/**
 * Assert equals./* w  ww.  j  av a  2  s .  c  o m*/
 */
@Test
public final void assertEquals() {

    Long a = new Long(1L);
    Long b = new Long(1L);

    log.info((a == b) + "");
    log.info(a.equals(b) + "");

    User user = new User(1L);
    List<User> list = new ArrayList<User>();

    list.add(user);
    list.add(new User(1L));
    list.add(new User(new Long(1L)));
    list.add(new User(new Long(1L)));
    list.add(new User(new Long(1L)));

    for (User user2 : list) {
        log.info((user2.getId() == user.getId()) + "");
    }
}

From source file:su90.mybatisdemo.dao.RegionsMapperTest.java

@Test(groups = { "find" })
@Transactional/*from   w ww .j  av  a  2  s.c  om*/
public void testFindById() {
    Region result = this.regionsMapper.findById(1L);
    assertEquals(result.getId(), new Long(1L));
    assertEquals(result.getName(), "Europe");
}

From source file:com.redhat.rhn.domain.action.ActionFormatter.java

private String getActionLink(String key, long count) {
    LocalizationService ls = LocalizationService.getInstance();
    //  We may have to append .plural to the key
    //  if the case includes multiple systems
    StringBuilder keybuff = new StringBuilder();
    keybuff.append(key);//from   w w  w.ja  v a 2 s.  c  om
    Object[] args = new Object[2];
    args[0] = action.getId().toString();
    args[1] = new Long(count);
    if (count > 1) {
        keybuff.append(".plural");
    }
    return ls.getMessage(keybuff.toString(), args);
}

From source file:$.TaskRestFT.java

/**
     * //./*from w  w  w .  ja va  2s  .  c om*/
     */
    @Test
    @Category(Smoke.class)
    public void createUpdateAndDeleteTask() {

        // create
        Task task = TaskData.randomTask();

        URI createdTaskUri = restTemplate.postForLocation(resourceUrl, task);
        System.out.println(createdTaskUri.toString());
        Task createdTask = restTemplate.getForObject(createdTaskUri, Task.class);
        assertThat(createdTask.getTitle()).isEqualTo(task.getTitle());

        // update
        String id = StringUtils.substringAfterLast(createdTaskUri.toString(), "/");
        task.setId(new Long(id));
        task.setTitle(TaskData.randomTitle());

        restTemplate.put(createdTaskUri, task);

        Task updatedTask = restTemplate.getForObject(createdTaskUri, Task.class);
        assertThat(updatedTask.getTitle()).isEqualTo(task.getTitle());

        // delete
        restTemplate.delete(createdTaskUri);

        try {
            restTemplate.getForObject(createdTaskUri, Task.class);
            fail("Get should fail while feth a deleted task");
        } catch (HttpStatusCodeException e) {
            assertThat(e.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND);
        }
    }

From source file:com.baasbox.dao.FileDao.java

public ODocument create(String fileName, String contentType, byte[] content) throws Throwable {
    ODocument file = super.create();
    ORecordBytes record = new ORecordBytes(content);
    file.field(BINARY_FIELD_NAME, record);
    file.field(FILENAME_FIELD_NAME, fileName);
    file.field(CONTENT_TYPE_FIELD_NAME, contentType);
    file.field(CONTENT_LENGTH_FIELD_NAME, new Long(content.length));
    return file;/*from w  w  w  .j a v  a 2 s  . c  om*/
}

From source file:com.silverwrist.dynamo.security.AuditReadOps_mysql.java

private final List runListStatement(PreparedStatement stmt) throws SQLException {
    ResultSet rs = null;//  www .jav  a 2s. co  m
    try { // get the list of record IDs (long integers)
        rs = stmt.executeQuery();
        if (!(rs.next()))
            return Collections.EMPTY_LIST; // no results
        ArrayList rc = new ArrayList();
        do { // add each entry to the list
            rc.add(new Long(rs.getLong(1)));

        } while (rs.next()); // end do

        rc.trimToSize();
        return Collections.unmodifiableList(rc);

    } // end try
    finally { // shut down the result set before we go
        SQLUtils.shutdown(rs);

    } // end finally

}