Example usage for java.lang Long valueOf

List of usage examples for java.lang Long valueOf

Introduction

In this page you can find the example usage for java.lang Long valueOf.

Prototype

@HotSpotIntrinsicCandidate
public static Long valueOf(long l) 

Source Link

Document

Returns a Long instance representing the specified long value.

Usage

From source file:com.google.code.stackexchange.client.examples.AnswersApiExample.java

/**
 * Process command line./* w w w .  jav  a  2s. c  o m*/
 * 
 * @param line the line
 * @param options the options
 */
private static void processCommandLine(CommandLine line, Options options) {
    if (line.hasOption(HELP_OPTION)) {
        printHelp(options);
    } else if (line.hasOption(APPLICATION_KEY_OPTION)) {
        final String keyValue = line.getOptionValue(APPLICATION_KEY_OPTION);

        final StackExchangeApiClientFactory factory = StackExchangeApiClientFactory.newInstance(keyValue);
        final StackExchangeApiClient client = factory.createStackExchangeApiClient();

        if (line.hasOption(ID_OPTION)) {
            String idValue = line.getOptionValue(ID_OPTION);
            List<Answer> answersByUser = client.getAnswersByUsers(Long.valueOf(idValue));
            for (Answer answer : answersByUser) {
                printResult(answer);
            }
        }
    } else {
        printHelp(options);
    }
}

From source file:com.multimedia.service.commonItem.CmsCommonItemServiceImpl.java

@Override
public CommonItem getInsertBean(CommonItem obj) {
    if (obj == null)
        obj = new CommonItem();
    obj.setActive(Boolean.TRUE);/*from  w  w  w . j  a  v  a2  s.c  o  m*/
    obj.setViews(Long.valueOf(0));
    return obj;
}

From source file:com.google.code.stackexchange.client.examples.CommentsApiExample.java

/**
 * Process command line.//  w ww . j  a  v  a  2s .c o  m
 * 
 * @param line the line
 * @param options the options
 */
private static void processCommandLine(CommandLine line, Options options) {
    if (line.hasOption(HELP_OPTION)) {
        printHelp(options);
    } else if (line.hasOption(APPLICATION_KEY_OPTION)) {
        final String keyValue = line.getOptionValue(APPLICATION_KEY_OPTION);

        final StackExchangeApiClientFactory factory = StackExchangeApiClientFactory.newInstance(keyValue);
        final StackExchangeApiClient client = factory.createStackExchangeApiClient();

        if (line.hasOption(ID_OPTION)) {
            String idValue = line.getOptionValue(ID_OPTION);
            List<Comment> userComments = client.getUsersComments(Long.valueOf(idValue));
            for (Comment comment : userComments) {
                printResult(comment);
            }
        }
    } else {
        printHelp(options);
    }
}

From source file:com.inkubator.hrm.dao.impl.PayComponentDataExceptionDaoImpl.java

@Override
public List<PayComponentDataException> getByParamWithDetailForDetail(String searchParameter,
        String paySalaryComponentId, int firstResult, int maxResults, Order order) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearchByParamForDetail(searchParameter, criteria);
    criteria.add(Restrictions.eq("paySalaryComponent.id", Long.valueOf(paySalaryComponentId.substring(1))));
    criteria.addOrder(order);/*from   w  w w. j av  a2s. co m*/
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

From source file:com.gene.game.controllers.UserController.java

@RequestMapping(value = "/getbyid/{id}", method = RequestMethod.GET)
@ResponseBody/*from  w w w . jav  a  2 s  .  c  o m*/
public User getUserById(@PathVariable String id) {
    return userDao.findOne(Long.valueOf(id));
}

From source file:com.janrain.backplane.config.BackplaneConfig.java

/**
 * @return the server default max message value per channel
 * @throws SimpleDBException/*from  w  ww  . java  2 s  .  c o m*/
 */
public static long getDefaultMaxMessageLimit() {
    Long max = Long.valueOf(ConfigDAOs.serverConfigDao().oneServerConfig().get()
            .get(ServerConfigFields.DEFAULT_MESSAGES_MAX()).get());
    return max == null ? BackplaneConfig.BP_MAX_MESSAGES_DEFAULT : max;
}

From source file:core.controller.DepartemenController.java

@RequestMapping(method = RequestMethod.POST, value = "/update")
public String update(HttpServletRequest request) {
    long id = Long.valueOf(request.getParameter("txtId"));
    String kode = request.getParameter("txtKode");
    String nama = request.getParameter("txtNama");
    Departemen dep = new Departemen();
    dep.setId(id);/*from  ww  w. ja v a 2 s  .c o  m*/
    dep.setKode(kode);
    dep.setNama(nama);
    departemenDAO.update(dep);
    return "redirect:/departemen";
}

From source file:org.duracloud.mill.audit.AuditLogWritingProcessor.java

@Override
protected void executeImpl() throws TaskExecutionFailedException {

    try {// w  w  w .ja v  a2 s  .  c o m
        String account = task.getAccount();
        String storeId = task.getStoreId();
        String spaceId = task.getSpaceId();
        String contentId = task.getContentId();
        String action = task.getAction();
        Map<String, String> props = task.getContentProperties();
        String acls = task.getSpaceACLs();
        Date timestamp = new Date(Long.valueOf(task.getDateTime()));

        auditLogStore.write(account, storeId, spaceId, contentId, task.getContentChecksum(),
                task.getContentMimetype(), task.getContentSize(), task.getUserId(), action,
                props != null ? AuditLogStoreUtil.serialize(props) : null, acls, task.getSourceSpaceId(),
                task.getSourceContentId(), timestamp);

        log.debug("audit task successfully processed: {}", task);
    } catch (TransactionSystemException e) {
        log.error("failed to write item  ( account={} storeId={} spaceId={} contentId={} timestamp={} ) "
                + "to the database due to a transactional error. Likely cause: duplicate entry. Details: {}. Ignoring...",
                task.getAccount(), task.getStoreId(), task.getSpaceId(), task.getContentId(),
                new Date(Long.valueOf(task.getDateTime())), e.getMessage());
    } catch (Exception e) {
        String message = "Failed to execute " + task + ": " + e.getMessage();
        log.debug(message, e);
        throw new TaskExecutionFailedException(message, e);
    }
}

From source file:fm.last.commons.hive.serde.transform.UnixTimeFieldTransform.java

/**
 * @param value {@link Integer} value representing a unixtime in seconds.
 *///w w w. ja  va  2 s.c om
@Override
public Object transform(Object value, TypeInfo columnType) {
    if (isColumnOfStringType(columnType)) {
        int seconds = ((Integer) value).intValue();
        long millis = seconds * 1000L;
        return UNIX_TIME_FORMAT.format(Long.valueOf(millis));
    }
    return value;
}

From source file:de.hybris.platform.commercefacades.order.converters.populator.DeliveryOrderEntryGroupPopulator.java

@Override
public void populate(final AbstractOrderModel source, final AbstractOrderData target)
        throws ConversionException {
    super.populate(source, target);

    if (target.getDeliveryOrderGroups() == null) {
        target.setDeliveryOrderGroups(new ArrayList<DeliveryOrderEntryGroupData>());
    }// w w w  .j  a  v  a  2  s.  c  o  m

    for (final AbstractOrderEntryModel entryModel : source.getEntries()) {
        createUpdateShipGroupData(entryModel, target);
    }
    target.setDeliveryItemsQuantity(Long.valueOf(sumDeliveryItemsQuantity(source)));
}