List of usage examples for java.lang Integer longValue
public long longValue()
From source file:org.kuali.rice.ken.bo.Notification.java
/** * Set value of lock column for OJB optimistic locking * @param lockVerNbr value of lock column for OJB optimistic locking *//* ww w .j a va2s. c om*/ // should discard this method and call super directly public void setLockVerNbr(Integer lockVerNbr) { super.setVersionNumber(lockVerNbr.longValue()); }
From source file:com.janrain.backplane2.server.MessageRequest.java
public MessageRequest(String callback, String since, String block) { if (StringUtils.isNotEmpty(callback)) { if (!callback.matches("[\\._a-zA-Z0-9]*")) { throw new InvalidRequestException("invalid_request", "Callback parameter value is malformed"); }// w w w. j a v a 2 s . c o m } this.since = StringUtils.isBlank(since) ? "" : since; try { Integer blockSeconds = Integer.valueOf(block); if (blockSeconds < 0 || blockSeconds > MAX_BLOCK_SECONDS) { throw new InvalidRequestException("Invalid value for block parameter (" + block + "), must be between 0 and " + MAX_BLOCK_SECONDS); } this.returnBefore = new Date(System.currentTimeMillis() + blockSeconds.longValue() * 1000); } catch (NumberFormatException e) { throw new InvalidRequestException( "Invalid value for block parameter (" + block + "): " + e.getMessage()); } }
From source file:gov.nih.nci.ncicb.tcga.dcc.qclive.common.action.MafFileProcessor.java
private void insertBiospecimenToFileRelationships(final HashMap<String, BCRID> barcodesOrUuids, final QcContext context, final File mafFile) throws UUIDException { final List<Integer> biospecimenIds; final List<Long> shippedBiospecimenIds; // if center is converted to UUID use the uuids to look up the biospecimen ID if (context.isCenterConvertedToUUID()) { final List<String> uuids = new ArrayList<String>(); for (final BCRID bcrId : barcodesOrUuids.values()) { uuids.add(bcrId.getUUID());/*from ww w.j a va2 s. co m*/ } shippedBiospecimenIds = bcrDataService.getShippedBiospecimenIds(uuids); biospecimenIds = new ArrayList<Integer>(); for (final Long shippedBiospecimenId : shippedBiospecimenIds) { biospecimenIds.add(shippedBiospecimenId.intValue()); } } else { biospecimenIds = BiospecimenHelper.getBiospecimenIds(new ArrayList<BCRID>(barcodesOrUuids.values()), bcrDataService); shippedBiospecimenIds = new ArrayList<Long>(); for (final Integer id : biospecimenIds) { shippedBiospecimenIds.add(id.longValue()); } } // add biospecimen to file relationship into common and disease database BiospecimenHelper.insertBiospecimenFileRelationship(biospecimenIds, context.getArchive().getFilenameToIdToMap().get(mafFile.getName()), bcrDataService, context.getArchive().getTheTumor()); // now shipped biospecimen to file... bcrDataService.addShippedBiospecimensFileRelationship(shippedBiospecimenIds, context.getArchive().getFilenameToIdToMap().get(mafFile.getName())); }
From source file:org.eurekastreams.server.persistence.TabMapper.java
/** * Find the Tab by id.//from w w w .j a va2 s.c o m * * @param tabId * ID of the Tab to look up * @return the entity with the input */ public Tab findById(final Integer tabId) { return findById(tabId.longValue()); }
From source file:architecture.user.web.struts2.action.admin.ajax.GroupManagementAction.java
public String updateGroup() throws Exception { try {/*www. ja va 2 s . c o m*/ Map map = ParamUtils.getJsonParameter(request, "item", Map.class); String name = (String) map.get("name"); String displayName = (String) map.get("displayName"); String description = (String) map.get("description"); if (groupId == null) { Integer selectedGroupId = (Integer) map.get("groupId"); groupId = selectedGroupId.longValue(); } Group group = getTargetGroup(); if (!StringUtils.isEmpty(name)) group.setName(name); if (!StringUtils.isEmpty(displayName)) group.setDisplayName(displayName); if (!StringUtils.isEmpty(description)) group.setDescription(description); groupManager.updateGroup(group); this.targetGroup = null; return success(); } catch (Throwable e) { e.printStackTrace(); throw new Exception(e); } }
From source file:com.bibisco.manager.CharacterManager.java
public static CharacterInfoWithoutQuestionsDTO loadCharacterInfoWithoutQuestions( CharacterInfoWithoutQuestions pCharacterInfoWithoutQuestions, Integer lIntIdCharacter) { CharacterInfoWithoutQuestionsDTO lCharacterInfoWithoutQuestionsDTO; mLog.debug("Start loadCharacterInfoWithoutQuestions(CharacterInfoWithoutQuestions, Integer)"); SqlSessionFactory lSqlSessionFactory = SqlSessionFactoryManager.getInstance().getSqlSessionFactoryProject(); SqlSession lSqlSession = lSqlSessionFactory.openSession(); try {/*from w w w . java 2 s. c o m*/ CharactersMapper lCharactersMapper = lSqlSession.getMapper(CharactersMapper.class); CharactersWithBLOBs lCharacters = lCharactersMapper.selectByPrimaryKey(lIntIdCharacter.longValue()); lCharacterInfoWithoutQuestionsDTO = new CharacterInfoWithoutQuestionsDTO(); lCharacterInfoWithoutQuestionsDTO.setId(lIntIdCharacter); lCharacterInfoWithoutQuestionsDTO.setCharacterInfoWithoutQuestions(pCharacterInfoWithoutQuestions); switch (pCharacterInfoWithoutQuestions) { case CONFLICT: lCharacterInfoWithoutQuestionsDTO .setTaskStatus(TaskStatus.getTaskStatusFromValue(lCharacters.getConflictTaskStatus())); lCharacterInfoWithoutQuestionsDTO.setInfo(lCharacters.getConflict()); break; case EVOLUTION_DURING_THE_STORY: lCharacterInfoWithoutQuestionsDTO.setTaskStatus( TaskStatus.getTaskStatusFromValue(lCharacters.getEvolutionduringthestoryTaskStatus())); lCharacterInfoWithoutQuestionsDTO.setInfo(lCharacters.getEvolutionduringthestory()); break; case LIFE_BEFORE_STORY_BEGINNING: lCharacterInfoWithoutQuestionsDTO.setTaskStatus( TaskStatus.getTaskStatusFromValue(lCharacters.getLifebeforestorybeginningTaskStatus())); lCharacterInfoWithoutQuestionsDTO.setInfo(lCharacters.getLifebeforestorybeginning()); break; default: break; } } catch (Throwable t) { mLog.error(t); throw new BibiscoException(t, BibiscoException.SQL_EXCEPTION); } finally { lSqlSession.close(); } mLog.debug("End loadCharacterInfoWithoutQuestions(CharacterInfoWithoutQuestions, Integer)"); return lCharacterInfoWithoutQuestionsDTO; }
From source file:codes.thischwa.c5c.DispatcherPUT.java
private void imageProcessingAndSizeCheck(Path tempPath, String sanitizedName, long fileSize, FilemanagerConfig conf) throws C5CException, IOException { Integer maxSize = (conf.getUpload().isFileSizeLimitAuto()) ? PropertiesLoader.getMaxUploadSize() : conf.getUpload().getFileSizeLimit(); if (fileSize > maxSize.longValue() * 1024 * 1024) throw new FilemanagerException(FilemanagerAction.UPLOAD, FilemanagerException.Key.UploadFilesSmallerThan, String.valueOf(maxSize)); String extension = FilenameUtils.getExtension(sanitizedName); // check image only boolean isImageExt = checkImageExtension(sanitizedName, conf.getUpload().isImagesOnly(), conf.getImages().getExtensions()); if (!isImageExt) return;//from w ww . ja v a 2 s . c o m // remove exif data Path woExifPath = UserObjectProxy.removeExif(tempPath); if (!tempPath.equals(woExifPath)) { Files.move(woExifPath, tempPath, StandardCopyOption.REPLACE_EXISTING); } // check if the file is really an image InputStream in = new BufferedInputStream(Files.newInputStream(tempPath, StandardOpenOption.READ)); Dimension dim = getDimension(in); if (isImageExt && dim == null) throw new FilemanagerException(FilemanagerAction.UPLOAD, FilemanagerException.Key.UploadImagesOnly); IOUtils.closeQuietly(in); // check if resize is enabled and fix it, if necessary Resize resize = conf.getImages().getResize(); if (resize.isEnabled() && (dim.getHeight() > resize.getMaxHeight() || dim.getWidth() > resize.getMaxWidth())) { logger.debug("process resize"); StreamContent sc = connector.resize(new BufferedInputStream(Files.newInputStream(tempPath)), extension, new Dimension(resize.getMaxWidth(), resize.getMaxHeight())); Files.copy(sc.getInputStream(), tempPath, StandardCopyOption.REPLACE_EXISTING); IOUtils.closeQuietly(sc.getInputStream()); } }
From source file:com.bibisco.manager.CharacterManager.java
public static CharacterInfoQuestionsDTO loadCharacterInfoQuestions( CharacterInfoQuestions pCharacterInfoQuestions, Integer lIntIdCharacter) { CharacterInfoQuestionsDTO lCharacterInfoQuestionsDTO; mLog.debug("Start loadCharacterInfo(CharacterInfoQuestions, Integer)"); SqlSessionFactory lSqlSessionFactory = SqlSessionFactoryManager.getInstance().getSqlSessionFactoryProject(); SqlSession lSqlSession = lSqlSessionFactory.openSession(); try {/*w ww.j av a 2s.c o m*/ CharactersMapper lCharactersMapper = lSqlSession.getMapper(CharactersMapper.class); CharactersWithBLOBs lCharacters = lCharactersMapper.selectByPrimaryKey(lIntIdCharacter.longValue()); lCharacterInfoQuestionsDTO = new CharacterInfoQuestionsDTO(); lCharacterInfoQuestionsDTO.setId(lIntIdCharacter); lCharacterInfoQuestionsDTO.setCharacterInfoQuestions(pCharacterInfoQuestions); switch (pCharacterInfoQuestions) { case BEHAVIORS: lCharacterInfoQuestionsDTO.setFreeText(lCharacters.getBehaviorsFreeText()); lCharacterInfoQuestionsDTO .setTaskStatus(TaskStatus.getTaskStatusFromValue(lCharacters.getBehaviorsTaskStatus())); lCharacterInfoQuestionsDTO .setInterviewMode(lCharacters.getBehaviorsInterview().equals("Y") ? true : false); break; case IDEAS: lCharacterInfoQuestionsDTO.setFreeText(lCharacters.getIdeasFreeText()); lCharacterInfoQuestionsDTO .setTaskStatus(TaskStatus.getTaskStatusFromValue(lCharacters.getIdeasTaskStatus())); lCharacterInfoQuestionsDTO .setInterviewMode(lCharacters.getIdeasInterview().equals("Y") ? true : false); break; case PERSONAL_DATA: lCharacterInfoQuestionsDTO.setFreeText(lCharacters.getPersonalDataFreeText()); lCharacterInfoQuestionsDTO .setTaskStatus(TaskStatus.getTaskStatusFromValue(lCharacters.getPersonalDataTaskStatus())); lCharacterInfoQuestionsDTO .setInterviewMode(lCharacters.getPersonalDataInterview().equals("Y") ? true : false); break; case PHYSIONOMY: lCharacterInfoQuestionsDTO.setFreeText(lCharacters.getPhysionomyFreeText()); lCharacterInfoQuestionsDTO .setTaskStatus(TaskStatus.getTaskStatusFromValue(lCharacters.getPhysionomyTaskStatus())); lCharacterInfoQuestionsDTO .setInterviewMode(lCharacters.getPhysionomyInterview().equals("Y") ? true : false); break; case PSYCHOLOGY: lCharacterInfoQuestionsDTO.setFreeText(lCharacters.getPsychologyFreeText()); lCharacterInfoQuestionsDTO .setTaskStatus(TaskStatus.getTaskStatusFromValue(lCharacters.getPsychologyTaskStatus())); lCharacterInfoQuestionsDTO .setInterviewMode(lCharacters.getPsychologyInterview().equals("Y") ? true : false); break; case SOCIOLOGY: lCharacterInfoQuestionsDTO.setFreeText(lCharacters.getSociologyFreeText()); lCharacterInfoQuestionsDTO .setTaskStatus(TaskStatus.getTaskStatusFromValue(lCharacters.getSociologyTaskStatus())); lCharacterInfoQuestionsDTO .setInterviewMode(lCharacters.getSociologyInterview().equals("Y") ? true : false); break; default: break; } // get answers CharacterInfosExample lCharacterInfosExample = new CharacterInfosExample(); lCharacterInfosExample.createCriteria().andCharacterInfoTypeEqualTo(pCharacterInfoQuestions.name()) .andIdCharacterEqualTo(lCharacters.getIdCharacter().intValue()); lCharacterInfosExample.setOrderByClause("question"); CharacterInfosMapper lCharacterInfosMapper = lSqlSession.getMapper(CharacterInfosMapper.class); List<CharacterInfos> lListCharacterInfos = lCharacterInfosMapper .selectByExampleWithBLOBs(lCharacterInfosExample); List<String> lListAnswers = new ArrayList<String>(); for (CharacterInfos lCharacterInfos : lListCharacterInfos) { lListAnswers.add(StringUtils.defaultString(lCharacterInfos.getInfo())); } lCharacterInfoQuestionsDTO.setAnswerList(lListAnswers); } catch (Throwable t) { mLog.error(t); throw new BibiscoException(t, BibiscoException.SQL_EXCEPTION); } finally { lSqlSession.close(); } mLog.debug("End loadCharacterInfo(CharacterInfoQuestions, Integer)"); return lCharacterInfoQuestionsDTO; }
From source file:com.itemanalysis.psychometrics.statistics.TwoWayTable.java
public void addValue(Integer rowValue, Integer colValue) { addValue(Long.valueOf(rowValue.longValue()), Long.valueOf(colValue.longValue())); }
From source file:com.juliazozulia.wordusage.Utils.Frequency.java
public List<Comparable<?>> getMode() { long mostPopular = 0; // frequencies are always positive // Get the max count first, so we avoid having to recreate the List each time for (Integer l : freqTable.values()) { long frequency = l.longValue(); if (frequency > mostPopular) { mostPopular = frequency;/*w w w . j a va 2s . c o m*/ } } List<Comparable<?>> modeList = new ArrayList<Comparable<?>>(); for (Entry<String, Integer> ent : freqTable.entrySet()) { Integer frequency = ent.getValue(); if (frequency == mostPopular) { modeList.add(ent.getKey()); } } return modeList; }