List of usage examples for java.lang Integer equals
public boolean equals(Object obj)
From source file:com.aurel.track.admin.user.person.PersonConfigBL.java
/** * Whether a non system administrator (probably system manager) tries to change a system administrator * @param currentUser//from w ww . j a v a 2s . c o m * @param selectedPersonIDList * @param locale * @return */ private static String getSystemAdminChangeError(TPersonBean currentUser, List<Integer> selectedPersonIDList, Locale locale) { Integer currentUserUserLevel = currentUser.getUserLevel(); if (currentUserUserLevel == null || !currentUserUserLevel.equals(TPersonBean.USERLEVEL.SYSADMIN)) { for (Integer selectedPersonID : selectedPersonIDList) { TPersonBean selectedPersonBean = LookupContainer.getPersonBean(selectedPersonID); if (selectedPersonBean != null) { Integer selectedPersonUserLevel = selectedPersonBean.getUserLevel(); if (selectedPersonUserLevel != null && selectedPersonUserLevel.equals(TPersonBean.USERLEVEL.SYSADMIN)) { return LocalizeUtil.getLocalizedTextFromApplicationResources( "admin.user.manage.err.systemAdmin", locale); } } } } return null; }
From source file:de.tudarmstadt.ukp.experiments.argumentation.convincingness.sampling.Step4MTurkOutputCollector.java
/** * Creates .success files for updating HITs in order to require more assignments. * * @param assignmentsPerHits actual assignments per HIT * @param hitTypeID type//from ww w.j a v a 2 s . c om * @param resultFile source MTurk file * @throws IOException IO exception */ static void prepareUpdateHITsFiles(Map<String, Integer> assignmentsPerHits, String hitTypeID, File resultFile) throws IOException { TreeSet<Integer> assignmentNumbers = new TreeSet<>(assignmentsPerHits.values()); System.out.println(assignmentsPerHits); // how many is required to be fully annotated final int fullyAnnotated = 5; assignmentNumbers.remove(fullyAnnotated); for (Integer i : assignmentNumbers) { // output file int annotationsRequired = fullyAnnotated - i; File file = new File(resultFile + "_requires_extra_assignments_" + annotationsRequired + ".success"); PrintWriter pw = new PrintWriter(file, "utf-8"); pw.println("hitid\thittypeid"); for (Map.Entry<String, Integer> entry : assignmentsPerHits.entrySet()) { if (i.equals(entry.getValue())) { pw.println(entry.getKey() + "\t" + hitTypeID); } } pw.close(); System.out.println( "Extra annotations required (" + annotationsRequired + "), saved to " + file.getAbsolutePath()); } }
From source file:com.aurel.track.admin.user.person.PersonConfigBL.java
/** * Whether it should be counted/*from w w w. j a v a 2 s.co m*/ * @param onlyFull * @param newUserLeve * @return */ private static boolean addInCount(boolean onlyFull, Integer newUserLevel) { if (onlyFull) { //count only the full users if (newUserLevel == null || !newUserLevel.equals(TPersonBean.USERLEVEL.CLIENT)) { return true; } else { return false; } } else { //count all users return true; } }
From source file:com.wineaccess.winerypermit.WineryPermitHelper.java
/** * @param winePermitViewPO/*from w ww. j a v a2s.c o m*/ * @return */ public static Map<String, Object> generateViewPermitResponse(WineryPermitViewPO wineryPermitViewPO) { response = new FailureResponse(); Map<String, Object> outputViewPermit = new HashMap<String, Object>(); Long wineryId = Long.parseLong(wineryPermitViewPO.getWineryId()); WineryModel wineryModel = WineryRepository.getWineryById(wineryId); if (wineryModel == null) { response.addError(new WineaccessError(SystemErrorCode.PERMIT_WINERY_ERROR, SystemErrorCode.PERMIT_WINERY_ERROR_TEXT)); } else { WineryPermitDetailVO wineryPermitViewVO = new WineryPermitDetailVO(); wineryPermitViewVO.setWineryId(wineryModel.getId()); wineryPermitViewVO.setIsSellInMainStates(wineryModel.getSellInMainStates()); /*if(BooleanUtils.isTrue(wineryModel.getSellInAltStates())) {*/ SellInAltStatesResultModel sellInAltStatesModel = new SellInAltStatesResultModel(); if (BooleanUtils.isTrue(wineryModel.getSellInAltStates())) sellInAltStatesModel.setIsSelected(true); Integer optionSelected = wineryModel.getOptionSelectedAltstates(); if (optionSelected != null && optionSelected.equals(0)) { sellInAltStatesModel.setIsOptionSelectedKachinaAlt(true); } if (optionSelected != null && optionSelected.equals(2)) { sellInAltStatesModel.setOptionSelectedNoPermit(true); } /*else if(optionSelected.equals(1)) {*/ List<PermitModelResult> permitModelResultsList = new ArrayList<PermitModelResult>(); OptionSelectedAltStatesResult optionSelectedAltStates = new OptionSelectedAltStatesResult(); List<WineryLicensePermitAltStates> wineryLicensePermitAltStates = WineryPermitRepository .findWineryLicensePermitAltStates(wineryId); /*if(wineLicensePermitAltStates != null && !wineLicensePermitAltStates.isEmpty()) {*/ //Set<MasterData> wineryPermitMasterDataList = MasterDataTypeAdapterHelper.getMasterDataListByMasterTypeName("Winery Licence Permit"); for (WineryLicensePermitAltStates permitModelFromDB : wineryLicensePermitAltStates) { PermitModelResult permitModelResult = new PermitModelResult(); WineryPermitModelWithMasterData wineryPermitModelWithMasterData = new WineryPermitModelWithMasterData(); MasterDataModel masterDataModel = new MasterDataModel(); Long masterDataForPermit = permitModelFromDB.getWineryPermit().getId(); permitModelResult.setDtcPermitEndDate(permitModelFromDB.getDtcPermitEndDate()); permitModelResult.setDtcPermitStartDate(permitModelFromDB.getDtcPermitStartDate()); permitModelResult.setDtcPermitNumber(permitModelFromDB.getDtcPermitNumber()); permitModelResult.setIsSelected(permitModelFromDB.getIsSelected()); permitModelResult.setPermitDurationInMonths(permitModelFromDB.getDtcPermitDurationInMonths()); masterDataModel.setId(masterDataForPermit); masterDataModel.setMasterDataTypeName("WineryLicencePermit"); masterDataModel.setMasterDataName(permitModelFromDB.getWineryPermit().getName()); wineryPermitModelWithMasterData.setMasterData(masterDataModel); //wineryPermitModelWithMasterData.setPermitModelResult(permitModelResult); permitModelResult.setWineryPermit(wineryPermitModelWithMasterData); permitModelResultsList.add(permitModelResult); } optionSelectedAltStates.setPermit(permitModelResultsList); /*}*/ WineryLicenseFullfillAltStates fulfilModelFromDB = WineryPermitRepository .findFulfilModelByWineryId(wineryId); FulFillModel fulfiModel = new FulFillModel(); if (fulfilModelFromDB != null) { if (BooleanUtils.isTrue(fulfilModelFromDB.getWaWillNotFullFill())) { } fulfiModel.setIsSelected(BooleanUtils.toStringTrueFalse(fulfilModelFromDB.getIsSelected())); fulfiModel.setEscrowContract(BooleanUtils.toStringTrueFalse(fulfilModelFromDB.getEscrowContract())); fulfiModel.setWaPlatformContract( BooleanUtils.toStringTrueFalse(fulfilModelFromDB.getWaPlatformContract())); fulfiModel.setIsStorageContact( BooleanUtils.toStringTrueFalse(fulfilModelFromDB.getWineryStorageContract())); optionSelectedAltStates.setFulfillDirectlyNotWA(fulfilModelFromDB.getWaWillNotFullFill()); } /*else if() optionSelectedAltStates.setFulfillDirectlyNotWA(true);*/ optionSelectedAltStates.setFulfill(fulfiModel); /*WineLicenseFullfillAltStates wineFullfillAltStatesModel = WinePermitRepository.findFulfilModelByWineId(wineModel.getId()); if(wineFullfillAltStatesModel!=null) { } sellInAltStatesModel.setOptionSelectedAltStates(optionSelectedAltStates); } } wineFullfillAltStatesModel = WinePermitRepository.findFulfilModelByWineId(wineModel.getId()); if(wineFullfillAltStatesModel!=null) { }*/ sellInAltStatesModel.setOptionSelectedAltStates(optionSelectedAltStates); Integer optionSelect = wineryModel.getOptionSelectedAltstates(); if (optionSelect != null) { if (0 == optionSelect) { sellInAltStatesModel.setIsOptionSelectedKachinaAlt(true); } else if (2 == optionSelect) { sellInAltStatesModel.setOptionSelectedNoPermit(true); } } wineryPermitViewVO.setSellInAltStates(sellInAltStatesModel); /*}*/ response = new com.wineaccess.response.SuccessResponse(wineryPermitViewVO, 200); } outputViewPermit.put("FINAL-RESPONSE", response); return outputViewPermit; }
From source file:mas.MAS_TOP_PAPERS.java
private static void filterCitations(List<Integer> paper_ids) { final List<String> lines = IOUtils.readFileLineByLine("data-vldb/citations_all_conf.csv", false); StringBuffer sb = new StringBuffer(); for (String l : lines) { String[] split = l.split("\\t"); if (split.length == 2) { Integer src = Integer.parseInt(split[0]); Integer dest = Integer.parseInt(split[1]); if (paper_ids.contains(dest) && !src.equals(dest)) { sb.append(l).append("\n"); }// w w w . ja va 2s. c om } } IOUtils.writeDataIntoFile(sb.toString(), "data-vldb/citations_all_conf_filtered.csv"); }
From source file:mas.MAS_VLDB.java
private static void filterCitations(List<Integer> paper_ids, String infile, String outfile) { final List<String> lines = IOUtils.readFileLineByLine(infile, false); StringBuilder sb = new StringBuilder(); for (String l : lines) { String[] split = l.split("\\t"); if (split.length == 2) { Integer src = Integer.parseInt(split[0]); Integer dest = Integer.parseInt(split[1]); if (paper_ids.contains(src) && !src.equals(dest)) { sb.append(l).append("\n"); }/*from www. ja v a 2 s. c o m*/ } } IOUtils.writeDataIntoFile(sb.toString(), outfile); }
From source file:com.aurel.track.fieldType.runtime.custom.select.CustomSelectBaseRT.java
/** * Verify that the each value is part of the datasource * @param actualValue//from ww w. j av a 2s . c o m * @param possibleValues * @param forcePreselect * @return */ protected static Integer[] getValidValues(Integer[] actualValue, List<IBeanID> possibleValues, boolean forcePreselect) { if (possibleValues == null || possibleValues.isEmpty()) { return null; } List<Integer> validValues = new LinkedList<Integer>(); if (actualValue != null && actualValue.length > 0) { for (int i = 0; i < actualValue.length; i++) { Integer intValue = actualValue[i]; if (intValue != null) { for (IBeanID labelBean : possibleValues) { if (intValue.equals(labelBean.getObjectID())) { validValues.add(intValue); break; } } } } } if (validValues.isEmpty() && forcePreselect) { //get the first from the list return new Integer[] { possibleValues.get(0).getObjectID() }; } else { return GeneralUtils.createIntegerArrFromCollection(validValues); } }
From source file:ispyb.client.common.util.FileUtil.java
public static boolean isJpgForImage(Image3VO imageVO, HttpServletRequest request) throws Exception { boolean isJpg = false; Integer proposalId = (Integer) request.getSession().getAttribute(Constants.PROPOSAL_ID); if (proposalId == null) { try {//from w w w . j av a 2s. co m proposalId = new Integer(request.getParameter(Constants.PROPOSAL_ID)); } catch (NumberFormatException e) { if (Confidentiality.isManager(request) || Confidentiality.isLocalContact(request)) { // isLocalContact or isManager = true; String sourceFileName = imageVO.getJpegFileFullPath(); sourceFileName = PathUtils.FitPathToOS(sourceFileName); isJpg = FileUtil.fileExists(sourceFileName); return isJpg; } return false; } } // Ejb3ServiceLocator ejb3ServiceLocator = Ejb3ServiceLocator.getInstance(); // Image3Service imageService = (Image3Service) ejb3ServiceLocator.getLocalService(Image3Service.class); // two variables to guarantee the user fecths only its own images // ArrayList imageFetchedList = (ArrayList) imgFacade.findByImageIdAndProposalId(imageId, proposalId); // List<Image3VO> imageFetchedList = imageService.findByImageIdAndProposalId(imageId, proposalId); // Image3VO imgValue = imageService.findByPk(imageId); Integer proposalIdFromImage = imageVO.getDataCollectionVO().getDataCollectionGroupVO().getSessionVO() .getProposalVOId(); if (proposalIdFromImage.equals(proposalId)) { String sourceFileName = imageVO.getJpegFileFullPath(); sourceFileName = PathUtils.FitPathToOS(sourceFileName); isJpg = FileUtil.fileExists(sourceFileName); } return isJpg; }
From source file:de.hybris.platform.acceleratorstorefrontcommons.tags.Functions.java
protected static boolean doesPromotionExistForOrderEntry(final Integer entryNumberToFind, final PromotionResultData productPromotion) { final List<PromotionOrderEntryConsumedData> consumedEntries = productPromotion.getConsumedEntries(); if (consumedEntries != null && !consumedEntries.isEmpty()) { for (final PromotionOrderEntryConsumedData consumedEntry : consumedEntries) { if (entryNumberToFind.equals(consumedEntry.getOrderEntryNumber())) { return true; }//from ww w. jav a 2 s.c om } } return false; }
From source file:com.jeet.cli.Admin.java
private static void deleteFile(Map fileMap) { System.out.print("Enter File Index(0 to cancel): "); String choise = null;/*from w ww .j ava 2 s .c o m*/ try { choise = bufferRead.readLine(); } catch (IOException ioe) { System.err.println("Error in reading option."); System.err.println("Please try again."); deleteFile(fileMap); } if (choise != null && NumberUtils.isDigits(choise)) { Integer choiseInt = Integer.parseInt(choise); if (fileMap.containsKey(choiseInt)) { try { String key = fileMap.get(choiseInt).toString(); FileUtil.deleteFile(key); System.out.println("File Deleted"); } catch (Exception ex) { ex.printStackTrace(); System.err.println("Error in deleting file."); } askFileListInputs(fileMap); } else if (choiseInt.equals(0)) { System.out.println("Delete file canceled."); askFileListInputs(fileMap); } else { System.err.println("Please select from provided options only."); deleteFile(fileMap); } } else { System.err.println("Please enter digits only."); deleteFile(fileMap); } }