List of usage examples for java.lang Long valueOf
@HotSpotIntrinsicCandidate public static Long valueOf(long l)
From source file:data.services.FreeValueRangeService.java
public void create(FreeValueRange fvr) { FreeValueRange supvr = new FreeValueRange(); supvr.setUid(fvr.getUid());//from www . j a va2 s . co m supvr.setEvent(fvr.getEvent()); String arr = ""; for (FreeValueRange ovr : freeValueRangeDao.findByEventUid(supvr)) { arr += ovr.getUid() + "; " + ovr.getEvent().getId() + " - " + ovr.getEvent().getName(); freeValueRangeDao.delete(ovr); } fvr.setAmax(Long.valueOf(getZeroInNullAndTrim(fvr.getAmax()))); fvr.setAmin(Long.valueOf(getZeroInNullAndTrim(fvr.getAmin()))); fvr.setValueMax(Long.valueOf(getZeroInNullAndTrim(fvr.getValueMax()))); fvr.setValueMin(Long.valueOf(getZeroInNullAndTrim(fvr.getValueMin()))); if (validate(fvr)) { freeValueRangeDao.save(fvr); //addError(fvr.getUid()); } }
From source file:testapp.web.StatementFormController.java
protected Object formBackingObject(HttpServletRequest request) throws ServletException { Statement s = null;/*from w w w. j a va2 s . c o m*/ String statementId = request.getParameter("statementId"); if (statementId == null) { logger.debug("creating new statement"); s = new Statement(); String personId = request.getParameter("personId"); if (personId == null || personId.trim().length() == 0) { throw new RuntimeException("no personId specified for new statement"); } Person p = getPersonDao().findById(Long.valueOf(personId)); s.setPerson(p); } else { logger.debug("fetching statement " + statementId); s = getStatementDao().findById(Long.valueOf(statementId)); } return s; }
From source file:com.easysoft.build.dao.BuildConfigInfoDao.java
public List<BuildConfigInfo> getBuildConfigInfoByDeployId(String id, String curBranch) { String hql = " from BuildConfigInfo bc left join fetch bc.ri rInfo left join fetch bc.bd d where rInfo.name=:curBranch " + "and rInfo.isValid='2' and bc.status='5' and d.id=:id order by bc.addTime asc "; Map<String, Object> params = new HashMap<String, Object>(); params.put("id", Long.valueOf(id)); params.put("curBranch", curBranch); return this.queryForHQL(hql, params); }
From source file:com.shuffle.bitcoin.blockchain.BlockchainDotInfo.java
/** * * Given a wallet address, this function looks up the address' balance using Blockchain.info's * API. The amount returned is of type long and represents the number of satoshis. *//* ww w . ja va 2 s. c o m*/ @Override public synchronized long getAddressBalance(String address) throws IOException { String url = "https://blockchain.info/rawaddr/" + address; URL obj = new URL(url); JSONTokener tokener = new JSONTokener(obj.openStream()); JSONObject root = new JSONObject(tokener); return Long.valueOf(root.get("final_balance").toString()); }
From source file:piecework.util.ContentUtility.java
public static ContentResource toContent(GridFsResource resource) throws IOException { String resourceId = resource.getId().toString(); return new BasicContentResource.Builder().contentId(resourceId).contentType(resource.getContentType()) .filename(resource.getFilename()).location(resource.getFilename()) .inputStream(resource.getInputStream()).lastModified(resource.lastModified()) .length(Long.valueOf(resource.contentLength())).build(); }
From source file:com.jumpbyte.test.springrest.service.RESTControllerTestIT.java
@Test public void getUserWithJSON() { RestTemplate restTemplate = createJSONRestTemplate(); User user = restTemplate.getForObject(baseUrl + "/123", User.class, (Object) null); assertNotNull(user);/* w ww . ja v a2 s . com*/ assertEquals(Long.valueOf(123), user.getId()); }
From source file:com.weavers.duqhan.util.FileUploader.java
public static CloudineryImageDto uploadImage(MultipartFile file) { CloudineryImageDto imageBean = new CloudineryImageDto(); imageBean.setUrl("failure"); String timeInMili = String.valueOf(new Date().getTime()); Map params = Cloudinary.asMap("public_id", timeInMili); Calendar calendar = Calendar.getInstance(); List<Transformation> eager = Arrays.asList(new Transformation().width(512).height(512).crop("thumb")); Cloudinary cloudinary = new Cloudinary(ObjectUtils.asMap("cloud_name", CLOUD_NAME, "api_key", API_KEY, "tags", "product", "timestamp", calendar.getTimeInMillis(), "api_secret", API_SECRET, // "upload_preset", "gpucdhrn", // "transformation", incoming, "eager", eager)); Map uploadResult;//from w w w . j a v a2s .co m String url = null; try { // cloudinary.url().type("fetch").imageTag("http://upload.wikimedia.org/wikipedia/commons/0/0c/Scarlett_Johansson_Csars_2014.jpg"); byte[] file1 = file.getBytes(); uploadResult = cloudinary.uploader().upload(file1, params); // cloudinary.url().transformation(new Transformation().width(512).height(512).crop("fill")).imageTag(params); String publicId = (String) uploadResult.get("public_id"); url = (String) uploadResult.get("url"); String signature = (String) uploadResult.get("signature"); String format = (String) uploadResult.get("format"); String secureUrl = (String) uploadResult.get("secure_url"); Integer version = (Integer) uploadResult.get("version"); //<editor-fold defaultstate="collapsed" desc="Image Bean"> imageBean.setFormat(format); imageBean.setPublicId(publicId); imageBean.setSecureUrl(secureUrl); imageBean.setSignature(signature); imageBean.setVersion(Long.valueOf(version)); imageBean.setUrl(url); //</editor-fold> } catch (Exception ex) { java.util.logging.Logger.getLogger(FileUploader.class.getName()).log(Level.SEVERE, null, ex); // System.out.println("eeeeeeeeeee"+ex.getLocalizedMessage()); imageBean.setUrl("failure"); } return imageBean; }
From source file:com.clustercontrol.sql.util.JdbcDriverUtil.java
public JdbcDriverUtil() { m_log.debug("initializing configuration for sql monitoring..."); //JDBC??/*from ww w . ja v a 2 s.co m*/ Integer count = HinemosPropertyUtil.getHinemosPropertyNum(JDBC_DRIVER, Long.valueOf(3)).intValue(); m_log.debug("use " + count + " jdbc drivers for sql monitoring."); for (int i = 1; i <= count.intValue(); i++) { String name = HinemosPropertyUtil.getHinemosPropertyStr(JDBC_DRIVER_NAME + i, ""); if ("".equals(name)) { continue; } String classname = HinemosPropertyUtil.getHinemosPropertyStr(JDBC_DRIVER_CLASSNAME + i, ""); if ("".equals(classname)) { continue; } Long loginTimeout = HinemosPropertyUtil.getHinemosPropertyNum(JDBC_DRIVER_LOGINTIMEOUT + i, null); if (loginTimeout == null) { continue; } String properties = HinemosPropertyUtil.getHinemosPropertyStr(JDBC_DRIVER_PROPERTIES + i, ""); // JDBC_DRIVER_PROPERTIES??? m_log.debug("setting jdbc driver " + i + " : " + name + "(classname = " + classname + ", login_timeout = " + loginTimeout + ")"); jdbcProperties.put(classname, new JdbcDriverProperties(classname, name, loginTimeout.intValue(), properties, i)); } }
From source file:com.multimedia.service.advertisement.CmsAdvertisementServiceImpl.java
@Override public Advertisement getInsertBean(Advertisement a) { if (a == null) a = new Advertisement(); Long sort = (Long) service.getSinglePropertyU("max(sort)"); if (sort == null) sort = Long.valueOf(0); else/*from ww w .j a v a2s . c o m*/ sort++; a.setSort(sort); a.setActive(Boolean.TRUE); return a; }
From source file:org.obozek.minermonitor.model.LazyPaginationModel.java
@Override public List<T> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String, String> filters) { Sort.Direction direction = null;/*from w ww .ja va 2s . c o m*/ if (SortOrder.ASCENDING.equals(sortOrder)) { direction = Sort.Direction.ASC; } if (SortOrder.DESCENDING.equals(sortOrder)) { direction = Sort.Direction.DESC; } Sort sort = null; if (sortField != null) { Sort.Order order = direction != null ? new Sort.Order(direction, sortField) : new Sort.Order(sortField); sort = new Sort(order); } F pageRequest = createPageRequest(pageSize != 0 ? first / pageSize : first, pageSize, sort, filters); Page<T> page = getPage(pageRequest); setRowCount(Long.valueOf(page.getTotalElements()).intValue()); cachedMap.clear(); List<T> result = new ArrayList<>(); for (T t : page) { result.add(t); cachedMap.put(t.getRowKey(), t); } return result; }