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:cz.muni.fi.mir.db.service.impl.ProgramServiceImpl.java

@Override
@Transactional(readOnly = true)//from w  ww  . j  av a  2s  . c o  m
public Program getProgramByID(Long id) throws IllegalArgumentException {
    if (id == null || Long.valueOf("0").compareTo(id) >= 0) {
        throw new IllegalArgumentException(
                "Given entity does not have valid id should be greater than one but was [" + id + "]");
    }

    return programDAO.getByID(id);
}

From source file:ch.cyberduck.core.sds.SDSSearchFeature.java

@Override
public AttributedList<Path> search(final Path workdir, final Filter<Path> regex,
        final ListProgressListener listener) throws BackgroundException {
    try {/*from   ww  w  .ja  va2 s  . co  m*/
        final AttributedList<Path> result = new AttributedList<>();
        final NodeList list = new NodesApi(session.getClient()).searchFsNodes(StringUtils.EMPTY,
                String.format("*%s*", regex.toPattern().pattern()), null, -1,
                Long.valueOf(new SDSNodeIdProvider(session).getFileid(workdir, listener)), null, null, null,
                null);
        final SDSAttributesFinderFeature feature = new SDSAttributesFinderFeature(session);
        for (Node node : list.getItems()) {
            final PathAttributes attributes = feature.toAttributes(node);
            final EnumSet<AbstractPath.Type> type;
            switch (node.getType()) {
            case ROOM:
                type = EnumSet.of(Path.Type.directory, Path.Type.volume);
                break;
            case FOLDER:
                type = EnumSet.of(Path.Type.directory);
                break;
            default:
                type = EnumSet.of(Path.Type.file);
                break;
            }
            result.add(new Path(new Path(node.getParentPath(), EnumSet.of(Path.Type.directory)), node.getName(),
                    type, attributes));
        }
        return result;
    } catch (ApiException e) {
        throw new SDSExceptionMappingService().map("Failure to read attributes of {0}", e, workdir);
    }
}

From source file:org.homiefund.test.dao.HomeDAOTest.java

@Test
public void getById() {
    Assert.assertEquals("wrong id", Long.valueOf(2L), homeDAO.getById(2L).getId());
}

From source file:org.nekorp.workflow.desktop.servicio.bridge.RegistroCostoBridge.java

@Override
public void unload(RegistroCostoVB origen, RegistroCosto destino) {
    BeanUtils.copyProperties(origen, destino, new String[] { "id", "tipo", "precioUnitario", "precioCliente" });
    if (StringUtils.isEmpty(origen.getId())) {
        destino.setId(null);//from w w w  .  j ava 2 s.  c o  m
    } else {
        destino.setId(Long.valueOf(origen.getId()));
    }
    destino.setTipo(origen.getTipo());
    destino.getPrecioUnitario().setValue(origen.getPrecioUnitario().toString());
    destino.getPrecioCliente().setValue(origen.getPrecioCliente().toString());
}

From source file:org.nekorp.workflow.desktop.data.access.rest.ServicioDAOImp.java

@Override
public void guardar(Servicio dato) {
    if (dato.getId() == null) {
        URI resource = factory.getTemplate().postForLocation(factory.getRootUlr() + "/servicios", dato);
        String[] uri = StringUtils.split(resource.toString(), '/');
        String id = uri[uri.length - 1];
        dato.setId(Long.valueOf(id));
    } else {/*from  w ww .  j  av a2  s .c om*/
        Map<String, Object> map = new HashMap<>();
        map.put("id", dato.getId());
        factory.getTemplate().postForLocation(factory.getRootUlr() + "/servicios/{id}", dato, map);
    }
}

From source file:eionet.gdem.web.struts.config.SystemFormAction.java

@Override
public ActionForward execute(ActionMapping actionMapping, ActionForm actionForm,
        HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) {
    ActionErrors errors = new ActionErrors();
    try {//from  w  ww .  j a  v  a  2 s.c o  m
        DynaValidatorForm form = (DynaValidatorForm) actionForm;
        form.set("cmdXGawk", Properties.xgawkCommand);
        form.set("qaTimeout", Long.valueOf(Properties.qaTimeout));
    } catch (Exception e) {
        LOGGER.error("Error setting system configuration form", e);
        errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("label.exception.unknown"));
        saveMessages(httpServletRequest, errors);
    }
    saveMessages(httpServletRequest, errors);

    return actionMapping.findForward("success");
}

From source file:com.codebutler.farebot.transit.myway.MyWayTagRecord.java

@Override
public int compareTo(@NonNull MyWayTagRecord rhs) {
    // Order by timestamp
    return Long.valueOf(this.mTimestamp).compareTo(rhs.mTimestamp);
}

From source file:io.github.seleniumquery.SeleniumQueryConfig.java

private static long getLongProperty(String propertyName, long defaultValue) {
    String propertyAsString = SeleniumQueryConfig.properties.getProperty(propertyName);
    if (propertyAsString == null || propertyAsString.trim().isEmpty()) {
        return defaultValue;
    }//  w  w  w  . j a  v a 2 s  .  co m
    return Long.valueOf(propertyAsString);
}

From source file:com.devnexus.ting.core.dao.DocumentDaoTest.java

/**
 * Test to verify that the seed data is correctly populated. Typically there
 * should be 10 industries in the system:
 *
 *//* ww w .j a  va 2  s  . co  m*/
@Test
public void testInsertDocument() throws IOException {

    FileData document = new FileData();
    document.setFileModified(new Date());
    document.setName("cartman.jpg");
    document.setType("image/jpeg");

    InputStream is = DocumentDaoTest.class.getResourceAsStream("/images/speakers/hans_dockter.jpg");

    byte[] imageData = IOUtils.toByteArray(is);
    document.setFileSize(Long.valueOf(imageData.length));
    document.setFileData(imageData);

    FileData savedDocument = documentDao.save(document);
    super.entityManager.flush();

    FileData docFromDb = documentDao.getOne(savedDocument.getId());

    Assert.assertEquals("cartman.jpg", docFromDb.getName());

}

From source file:cz.muni.fi.mir.db.service.impl.RevisionServiceImpl.java

@Override
@Transactional(readOnly = true)/*from  www. j av a 2s  .c o m*/
public Revision getRevisionByID(Long id) throws IllegalArgumentException {
    if (id == null || Long.valueOf("0").compareTo(id) >= 0) {
        throw new IllegalArgumentException(
                "Given entity does not have valid id should be greater than one but was [" + id + "]");
    }

    return revisionDAO.getByID(id);
}