List of usage examples for java.lang Long longValue
@HotSpotIntrinsicCandidate public long longValue()
From source file:hoot.services.db.DbUtils.java
public static long insertMap(final long userId, Connection conn) throws Exception { Long newId = (long) -1; NumberExpression<Long> expression = NumberTemplate.create(Long.class, "nextval('maps_id_seq')"); Configuration configuration = getConfiguration(); SQLQuery query = new SQLQuery(conn, configuration); List<Long> ids = query.from().list(expression); if (ids != null && ids.size() > 0) { newId = ids.get(0);//from w w w.j a va 2 s . co m QMaps maps = QMaps.maps; final Timestamp now = new Timestamp(Calendar.getInstance().getTimeInMillis()); new SQLInsertClause(conn, configuration, maps) .columns(maps.id, maps.createdAt, maps.displayName, maps.publicCol, maps.userId) .values(newId, now, "map-with-id-" + newId, true, userId).execute(); } DbUtils.createMap(newId.longValue()); return newId.longValue(); }
From source file:com.silverwrist.venice.core.impl.ConferencingImporter.java
private final long getPostMapping(long old) { if (old == 0) return 0; Long rc = (Long) (m_post_map.get(new Long(old))); return (rc == null) ? 0 : rc.longValue(); }
From source file:de.iai.ilcd.model.dao.DataSetDao.java
/** * Get result count for lsearch call/*from ww w.ja v a 2s .c om*/ * * @param params * lsearch parameters * @param mostRecentVersionOnly * flag to indicate if only the most recent version of a data set shall be returned if multiple versions * exist * @param stocks * meta data of data stocks * @param excludeStock * stock that shall be excluded from the search (may be <code>null</code>) * @return returns the count of results when a lsearch is issued with this lsearch parameters */ public long searchResultCount(ValueParser params, boolean mostRecentVersionOnly, IDataStockMetaData[] stocks, IDataStockMetaData excludeStock) { Query query = this.createQueryObject(params, null, SortOrder.ASCENDING, true, mostRecentVersionOnly, stocks, excludeStock); Long resultCount = (Long) query.getSingleResult(); return resultCount.longValue(); }
From source file:de.iai.ilcd.model.dao.DataSetDao.java
private long getDatasetsFromRootDsCount(IDataStockMetaData dataStock) { EntityManager em = PersistenceUtil.getEntityManager(); Query query = em// ww w .j a v a2s .com .createQuery("SELECT COUNT(a) FROM " + this.getJpaName() + " a WHERE a.rootDataStock.id=:dsId"); query.setParameter("dsId", dataStock.getId()); Long resultCount = (Long) query.getSingleResult(); return resultCount.longValue(); }
From source file:de.iai.ilcd.model.dao.DataSetDao.java
private long getDatasetsFromNonRootDsCount(IDataStockMetaData dataStock) { final String dsField = this.getDataStockField(); StringBuilder sb = new StringBuilder("SELECT COUNT(b) FROM DataStock a LEFT JOIN a.").append(dsField) .append(" b WHERE a.id=:dsId"); EntityManager em = PersistenceUtil.getEntityManager(); Query query = em.createQuery(sb.toString()); query.setParameter("dsId", dataStock.getId()); Long resultCount = (Long) query.getSingleResult(); return resultCount.longValue(); }
From source file:net.sf.iqser.plugin.csv.CsvContentProvider.java
private long getCachedFileModificationTimestamp() { Long cachedTimestamp = MODIFICATION_TIMESTAMP_CACHE.get(getName()); if (null != cachedTimestamp) { return cachedTimestamp.longValue(); }/*from w w w. ja va2s . c o m*/ return 0L; }
From source file:com.frameworkset.commons.dbcp2.datasources.PerUserPoolDataSource.java
/** * Gets the user specific value for//from w ww . j ava 2 s . c o m * {@link GenericObjectPool#getMinEvictableIdleTimeMillis()} for the * specified user's pool or the default if no user specific value is defined. */ public long getPerUserMinEvictableIdleTimeMillis(String key) { Long value = null; if (perUserMinEvictableIdleTimeMillis != null) { value = perUserMinEvictableIdleTimeMillis.get(key); } if (value == null) { return getDefaultMinEvictableIdleTimeMillis(); } return value.longValue(); }
From source file:eu.supersede.dm.ga.GAPersistentDB.java
public List<HGAGameSummary> getGamesByRoleAndProcess(Long userId, String roleName, Long processId) { List<HGAGameSummary> games = new ArrayList<>(); List<Long> gameList = participationJpa.findGames(userId, roleName); for (Long gameId : gameList) { HGAGameSummary info = gamesJpa.findOne(gameId); // FIXME: in case of game deletion, some participations may be left behind if (info == null) { // Game not found continue; }/*from ww w. java 2 s.co m*/ HActivity activity = activitiesJpa.findOne(info.getActivityId()); // FIXME: in case of game deletion, some activities may be left behind if (activity == null) { continue; } if (activity.getProcessId() != null && activity.getProcessId().equals(processId.longValue())) { HGAGameSummary summary = extract(info); games.add(summary); } } return games; }
From source file:org.jahia.modules.modulemanager.flow.ModuleManagementFlowHandler.java
public void initModules(RequestContext requestContext, RenderContext renderContext) { // generate tables ids, used by datatable jquery plugin to store the state of a table in the user localestorage. // new flow = new ids reloadTablesUUIDFromSession(requestContext); if (!requestContext.getFlowScope().contains("adminModuleTableUUID")) { requestContext.getFlowScope().put("adminModuleTableUUID", UUID.randomUUID().toString()); requestContext.getFlowScope().put("forgeModuleTableUUID", UUID.randomUUID().toString()); }//from w w w. j a v a 2 s. c o m if (!isStudio(renderContext)) { forgeService.loadModules(); final Long startedBundleId = (Long) requestContext.getExternalContext().getSessionMap() .get("moduleHasBeenStarted"); if (startedBundleId != null) { Bundle b = BundleUtils.getBundle(startedBundleId.longValue()); JahiaTemplatesPackage module = BundleUtils.getModule(b); String msgKey = "serverSettings.manageModules.module.started"; if (module != null && module.getState().getState() == ModuleState.State.WAITING_TO_BE_IMPORTED) { msgKey = "serverSettings.manageModules.start.waitingToBeImported"; } requestContext.getMessageContext().addMessage(new MessageBuilder().info().source(startedBundleId) .code(msgKey).arg(b.getSymbolicName()).build()); requestContext.getExternalContext().getSessionMap().remove("moduleHasBeenStarted"); } final Object stoppedBundleId = requestContext.getExternalContext().getSessionMap() .get("moduleHasBeenStopped"); if (stoppedBundleId != null) { requestContext.getMessageContext().addMessage(new MessageBuilder().info().source(stoppedBundleId) .code("serverSettings.manageModules.module.stopped").arg(stoppedBundleId).build()); requestContext.getExternalContext().getSessionMap().remove("moduleHasBeenStopped"); } final List<String> missingDependencies = (List<String>) requestContext.getExternalContext() .getSessionMap().get("missingDependencies"); if (missingDependencies != null) { createMessageForMissingDependencies(requestContext.getMessageContext(), missingDependencies); requestContext.getExternalContext().getSessionMap().remove("missingDependencies"); } } }
From source file:com.frameworkset.commons.dbcp2.datasources.PerUserPoolDataSource.java
/** * Gets the user specific value for// w w w .j a va2s . co m * {@link GenericObjectPool#getTimeBetweenEvictionRunsMillis()} for the * specified user's pool or the default if no user specific value is defined. */ public long getPerUserTimeBetweenEvictionRunsMillis(String key) { Long value = null; if (perUserTimeBetweenEvictionRunsMillis != null) { value = perUserTimeBetweenEvictionRunsMillis.get(key); } if (value == null) { return getDefaultTimeBetweenEvictionRunsMillis(); } return value.longValue(); }