List of usage examples for java.lang Long Long
@Deprecated(since = "9") public Long(String s) throws NumberFormatException
From source file:com.google.gsa.valve.modules.utils.CookieManagement.java
/** * Transforms Apache cookies into Servlet Cookies * //from w ww . java 2 s. c o m * @param apacheCookie apache cookie * * @return servlet cookie */ public static javax.servlet.http.Cookie transformApacheCookie( org.apache.commons.httpclient.Cookie apacheCookie) { javax.servlet.http.Cookie newCookie = null; if (apacheCookie != null) { Date expire = apacheCookie.getExpiryDate(); int maxAge = -1; if (expire == null) { maxAge = -1; } else { Date now = Calendar.getInstance().getTime(); // Convert milli-second to second Long second = new Long((expire.getTime() - now.getTime()) / 1000); maxAge = second.intValue(); } newCookie = new javax.servlet.http.Cookie(apacheCookie.getName(), apacheCookie.getValue()); //Hardcoding the domain newCookie.setDomain(apacheCookie.getDomain()); newCookie.setPath(apacheCookie.getPath()); newCookie.setMaxAge(maxAge); newCookie.setSecure(apacheCookie.getSecure()); } return newCookie; }
From source file:com.modeln.build.ctrl.charts.CMnBuildChart.java
/** * Validate the data submitted by the user and return any error codes. * * @param req HTTP request/* w ww.j av a 2 s.c o m*/ * @param res HTTP response * * @return Error code if any errors were found. */ public static final JFreeChart getMetricChart(CMnDbBuildData build) { JFreeChart chart = null; DefaultPieDataset pieData = new DefaultPieDataset(); if ((build.getMetrics() != null) && (build.getMetrics().size() > 0)) { Enumeration metrics = build.getMetrics().elements(); while (metrics.hasMoreElements()) { CMnDbMetricData currentMetric = (CMnDbMetricData) metrics.nextElement(); String name = currentMetric.getMetricType(currentMetric.getType()); // Get elapsed time in "minutes" Long value = new Long(currentMetric.getElapsedTime() / (1000 * 60)); pieData.setValue(name, value); } } // API: ChartFactory.createPieChart(title, data, legend, tooltips, urls) chart = ChartFactory.createPieChart("Build Metrics", pieData, true, true, false); // get a reference to the plot for further customization... PiePlot plot = (PiePlot) chart.getPlot(); chartFormatter.formatMetricChart(plot, "min"); return chart; }
From source file:com.oliveira.pedidovenda.converter.GrupoConverter.java
@Override public Object getAsObject(FacesContext context, UIComponent component, String value) { Grupo retorno = null;// w w w. jav a 2 s . com if (StringUtils.isNotEmpty(value)) { Long id = new Long(value); retorno = grupos.porId(id); } return retorno; }
From source file:jp.primecloud.auto.api.ApiValidate.java
public static void validateFarmNo(String farmNo) { ValidateUtil.required(farmNo, "EAPI-000001", new Object[] { PARAM_NAME_FARM_NO }); ValidateUtil.longInRange(farmNo, new Long(1), Long.MAX_VALUE, "EAPI-000002", new Object[] { PARAM_NAME_FARM_NO, new Long(1), Long.MAX_VALUE }); }
From source file:jp.co.acroquest.endosnipe.report.converter.util.calc.LongCalculator.java
public Object add(Object obj1, Object obj2) { Long longData1 = (Long) obj1; Long longData2 = (Long) obj2; return (Object) (new Long((long) (longData1.longValue() + longData2.longValue()))); }
From source file:Main.java
public static List<Long> toList(long... array) { if (isEmpty(array)) { return new ArrayList<>(0); }// w w w . j a va2s . co m List<Long> list = new ArrayList<>(array.length); for (long l : array) { list.add(new Long(l)); } return list; }
From source file:com.mgp.dao.EquipeDaoImpl.java
@Override public Equipe getEntityById(int idEquipe) throws Exception { session = sessionFactory.openSession(); Equipe equipe = (Equipe) session.load(Equipe.class, new Long(idEquipe)); tx = session.getTransaction();/* w w w . j a va2 s .co m*/ session.beginTransaction(); tx.commit(); session.close(); return equipe; }
From source file:com.nitsoft.ecommerce.api.response.StatusResponse.java
public StatusResponse(int status, T result, long totalRecords) { this.statusCode = status; this.result = result; this.totalRecords = new Long(totalRecords); }
From source file:videoquotes.corn.FacebookPostAnalytics.java
@RequestMapping(value = "/cron/updatePostAnalytics") private void updateQuoteAnalytics() { Collection<FacebookPost> queuedQuotes = posts.findByNeedSync(0, 1); Iterator<FacebookPost> queuedQuotesIt = queuedQuotes.iterator(); while (queuedQuotesIt.hasNext()) { FacebookPost post = queuedQuotesIt.next(); post.setLikes(new Long(FacebookUtil.getPostLikesCount(post.getFbid()))); post.setShares(new Long(FacebookUtil.getPostShareCount(post.getFbid()))); post.setLastSync(new Date().getTime()); posts.update(post);/*from w w w . j a v a 2 s . c o m*/ } }
From source file:com.itmanwuiso.checksums.dao.Formatter.java
@SuppressWarnings("unchecked") public JSONObject resultToJson(HashResult result) { JSONObject back = new JSONObject(); if (null == result) { return back; }/*from w ww. j a va2 s.c o m*/ back.put("filePath", result.getFilePath()); back.put("fileSize", new Long(result.getFileSize())); JSONObject hashes = new JSONObject(); if (null != result.getHashes() && !result.getHashes().isEmpty()) { for (Entry<String, byte[]> e : result.getHashes().entrySet()) { hashes.put(e.getKey(), bytesToString(e.getValue())); } } back.put("hashes", hashes); return back; }