List of usage examples for java.lang Integer longValue
public long longValue()
From source file:com.mastfrog.acteur.ClasspathResourcePage.java
private static Long getCachedSize(Class<?> pageClass, Path path) { Map<Path, Integer> sz = sizes.get(pageClass); if (sz != null) { Integer val = sz.get(path); if (val != null) { return val.longValue(); }/*from w ww . j a va 2 s . c om*/ } return null; }
From source file:org.kuali.kfs.gl.OJBUtility.java
/** * This method calculates the actual size of given selection results * /*from w w w . j a v a 2 s . c o m*/ * @param result the given selection results * @param recordCount the possible number of the given results * @param fieldValues the input field map * @param businessObject the given business object * @return the actual size of given selection results */ public static Long getResultActualSize(Collection result, Integer recordCount, Map fieldValues, Object businessObject) { int resultSize = result.size(); Integer limit = getResultLimit(); Long resultActualSize = new Long(resultSize); if (recordCount > limit) { long actualCount = recordCount.longValue() + resultSize - limit.longValue(); resultActualSize = new Long(actualCount); } return resultActualSize; }
From source file:com.github.jessemull.microflex.util.IntegerUtil.java
/** * Converts a list of integers to a list of longs. * @param List<Integer> list of integers * @return list of longs *//*from w ww. j av a 2s . c o m*/ public static List<Long> toLongList(List<Integer> list) { List<Long> longList = new ArrayList<Long>(); for (Integer val : list) { longList.add(val.longValue()); } return longList; }
From source file:com.glaf.core.util.ParamUtils.java
public static long getLong(Map<String, Object> dataMap, String key) { long result = 0; Object value = dataMap.get(key); if (value == null) { value = dataMap.get(key.toLowerCase()); }//from ww w . j a v a2s.co m if (value == null) { value = dataMap.get(key.toUpperCase()); } if (value != null && StringUtils.isNotEmpty(value.toString())) { if (value instanceof String) { String tmp = (String) value; result = Long.parseLong(tmp); } else if (value instanceof Integer) { Integer x = (Integer) value; result = Long.valueOf(x.intValue()); } else if (value instanceof Long) { Long x = (Long) value; result = x.longValue(); } else if (value instanceof Double) { Double x = (Double) value; result = x.longValue(); } else { String tmp = value.toString(); result = Long.parseLong(tmp); } } return result; }
From source file:com.glaf.core.util.ParamUtils.java
public static Long getLongValue(Map<String, Object> dataMap, String key) { Long result = null;//from w w w . java 2 s . c om Object value = dataMap.get(key); if (value == null) { value = dataMap.get(key.toLowerCase()); } if (value == null) { value = dataMap.get(key.toUpperCase()); } if (value != null && StringUtils.isNotEmpty(value.toString())) { if (value instanceof String) { String tmp = (String) value; result = Long.parseLong(tmp); } else if (value instanceof Integer) { Integer x = (Integer) value; result = Long.valueOf(x.intValue()); } else if (value instanceof Long) { Long x = (Long) value; result = x.longValue(); } else if (value instanceof Double) { Double x = (Double) value; result = x.longValue(); } else { String tmp = value.toString(); result = Long.parseLong(tmp); } } return result; }
From source file:com.evolveum.midpoint.repo.sql.util.RUtil.java
public static Long toLong(Integer i) { if (i == null) { return null; }/*ww w . ja v a 2 s . c o m*/ return i.longValue(); }
From source file:com.glaf.base.utils.ParamUtil.java
public static long getLong(Map<String, Object> dataMap, String key) { long result = 0; Object value = dataMap.get(key); if (value != null && StringUtils.isNotEmpty(value.toString())) { if (value instanceof String) { String tmp = (String) value; result = Long.valueOf(tmp); } else if (value instanceof Integer) { Integer x = (Integer) value; result = x.intValue();/*from w w w . j a va 2 s . co m*/ } else if (value instanceof Long) { Long x = (Long) value; result = x.longValue(); } else if (value instanceof Double) { Double x = (Double) value; result = x.longValue(); } } return result; }
From source file:com.bibisco.manager.ImageManager.java
public static String load(Integer pIntIdImage) { String lStrFileName = null;/*from w w w . j a v a2 s . c o m*/ mLog.debug("Start load(ImageDTO)"); SqlSessionFactory lSqlSessionFactory = SqlSessionFactoryManager.getInstance().getSqlSessionFactoryProject(); SqlSession lSqlSession = lSqlSessionFactory.openSession(); try { ImagesMapper lImagesMapper = lSqlSession.getMapper(ImagesMapper.class); Images lImages = lImagesMapper.selectByPrimaryKey(pIntIdImage.longValue()); lStrFileName = lImages.getFileName(); } catch (Throwable t) { mLog.error(t); throw new BibiscoException(t, BibiscoException.SQL_EXCEPTION); } finally { lSqlSession.close(); } mLog.debug("End load(ImageDTO)"); return lStrFileName; }
From source file:com.bibisco.manager.ImageManager.java
public static void delete(Integer pIntIdImage) { mLog.debug("Start delete(Integer)"); SqlSessionFactory lSqlSessionFactory = SqlSessionFactoryManager.getInstance().getSqlSessionFactoryProject(); SqlSession lSqlSession = lSqlSessionFactory.openSession(); try {/*from w w w. j a v a 2s .co m*/ ImagesMapper lImagesMapper = lSqlSession.getMapper(ImagesMapper.class); // load image to delete Images lImages = lImagesMapper.selectByPrimaryKey(pIntIdImage.longValue()); // delete image file on disk deleteFile(lImages.getFileName()); // delete image on db lImagesMapper.deleteByPrimaryKey(pIntIdImage.longValue()); lSqlSession.commit(); } catch (Throwable t) { mLog.error(t); lSqlSession.rollback(); throw new BibiscoException(t, BibiscoException.SQL_EXCEPTION); } finally { lSqlSession.close(); } mLog.debug("End delete(Integer)"); }
From source file:org.goobi.production.flow.jobs.HistoryAnalyserJob.java
/** * Update the history if necessary. It means: - count storage difference in * byte <br>// w ww .j a va2 s . co m * - count imagesWork difference <br> * - count imagesMaster difference <br> * - count metadata difference <br> * - count docstruct difference <br> * * @param inProcess * the {@link Process} to use * * @return true, if any history event is updated, so the process has to be * saved to database */ public static Boolean updateHistory(Process inProcess) throws IOException, DataException { boolean updated = false; /* storage */ if (updateHistoryEvent(inProcess, HistoryTypeEnum.storageDifference, getCurrentStorageSize(inProcess))) { updated = true; } /* imagesWork */ Integer numberWork = FileUtils.getNumberOfFiles( new File(serviceManager.getProcessService().getImagesTifDirectory(true, inProcess)), ".tif"); if (updateHistoryEvent(inProcess, HistoryTypeEnum.imagesWorkDiff, numberWork.longValue())) { updated = true; } /* imagesMaster */ Integer numberMaster = FileUtils.getNumberOfFiles( new File(serviceManager.getProcessService().getImagesOrigDirectory(true, inProcess)), ".tif"); if (updateHistoryEvent(inProcess, HistoryTypeEnum.imagesMasterDiff, numberMaster.longValue())) { updated = true; } /* metadata */ if (updateHistoryEvent(inProcess, HistoryTypeEnum.metadataDiff, inProcess.getSortHelperMetadata().longValue())) { updated = true; } /* docstruct */ if (updateHistoryEvent(inProcess, HistoryTypeEnum.docstructDiff, inProcess.getSortHelperDocstructs().longValue())) { updated = true; } return updated; }