List of usage examples for java.lang Integer equals
public boolean equals(Object obj)
From source file:de.tudarmstadt.ukp.dkpro.discourse.pdtbparser.PDTBDiscourseAnnotator.java
/** * Looks-up existing connective from the list given the parameters * * @param list list/*from www . ja v a 2 s . com*/ * @param relationId relation id * @param connectiveType connective type * @return existing discourse connective from the list * @throws java.lang.IllegalStateException if the discourse connective is not in list or there * are more than one with with the parameters */ static DiscourseConnective findLastConnective(List<DiscourseConnective> list, Integer relationId, String connectiveType) throws IllegalStateException { List<DiscourseConnective> connectives = new ArrayList<>(); for (DiscourseConnective connective : list) { if (relationId.equals(connective.getParentRelationId()) && connectiveType.equals(connective.getConnectiveType())) { // we found it // if (result != null) { // throw new IllegalStateException( // "Two same connectives are in the list with relationId " + relationId // + " and connectiveType " + connectiveType); // } connectives.add(connective); } } if (connectives.size() > 1) { System.out.println("Multiple connectives found: " + connectives); } return connectives.get(connectives.size() - 1); }
From source file:com.wineaccess.winepermit.WinePermitHelper.java
/** * @param winePermitViewPO//from w w w . j av a 2 s .c o m * @return */ public static Map<String, Object> generateViewPermitResponse(WinePermitViewPO winePermitViewPO) { response = new FailureResponse(); Map<String, Object> outputViewPermit = new HashMap<String, Object>(); Long wineId = Long.parseLong(winePermitViewPO.getProductId()); final ProductItemModel productModel = ProductItemRepository.getProductItemById(wineId); if (productModel == null) { response.addError( new WineaccessError(SystemErrorCode.PERMIT_WINE_ERROR, SystemErrorCode.PERMIT_WINE_ERROR_TEXT)); } else { WineModel wineModel = WineRepository.getWineById(productModel.getItemId()); if (wineModel == null) { response.addError(new WineaccessError(SystemErrorCode.PERMIT_WINE_ERROR, SystemErrorCode.PERMIT_WINE_ERROR_TEXT)); } else { WineryModel wineryModel = wineModel.getWineryId(); if (BooleanUtils.isNotTrue(wineModel.getSellInAltStates()) && BooleanUtils.isNotTrue(wineModel.getSellInMainStates()) && (BooleanUtils.isNotFalse(wineryModel.getSellInAltStates()) || BooleanUtils.isNotFalse(wineryModel.getSellInMainStates()))) { copyFulfilModelFromWinery(wineModel); copyPermitModelFromWinery(wineModel); createNoPermitData(wineModel); wineModel.setSellInAltStates(wineryModel.getSellInAltStates()); wineModel.setSellInMainStates(wineryModel.getSellInMainStates()); wineModel.setOptionSelectedAltstates(wineryModel.getOptionSelectedAltstates()); WineRepository.update(wineModel); } WinePermitDetailVO winePermitViewVO = new WinePermitDetailVO(); winePermitViewVO.setWineId(wineModel.getId()); winePermitViewVO.setIsSellInMainStates(wineModel.getSellInMainStates()); SellInAltStatesResultModel sellInAltStatesModel = new SellInAltStatesResultModel(); if (BooleanUtils.isTrue(wineModel.getSellInAltStates())) sellInAltStatesModel.setIsSelected(true); Integer optionSelected = wineModel.getOptionSelectedAltstates(); if (optionSelected != null && optionSelected.equals(0)) { sellInAltStatesModel.setIsOptionSelectedKachinaAlt(true); } if (optionSelected != null && optionSelected.equals(2)) { sellInAltStatesModel.setIsOptionSelectedNoPermit(true); } List<PermitModelResult> permitModelResultsList = new ArrayList<PermitModelResult>(); OptionSelectedAltStatesResult optionSelectedAltStates = new OptionSelectedAltStatesResult(); List<WineLicensePermitAltStates> wineLicensePermitAltStates = WinePermitRepository .findWineLicensePermitAltStates(wineId); for (WineLicensePermitAltStates permitModelFromDB : wineLicensePermitAltStates) { PermitModelResult permitModelResult = new PermitModelResult(); WinePermitModelWithMasterData winePermitModelWithMasterData = new WinePermitModelWithMasterData(); 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(EnumTypes.MasterDataTypeEnum.WineryLicencePermit.name()); masterDataModel.setMasterDataName(permitModelFromDB.getWineryPermit().getName()); winePermitModelWithMasterData.setMasterData(masterDataModel); permitModelResult.setWinePermit(winePermitModelWithMasterData); permitModelResultsList.add(permitModelResult); } optionSelectedAltStates.setPermit(permitModelResultsList); /*}*/ WineLicenseFullfillAltStates fulfilModelFromDB = WinePermitRepository .findFulfilModelByWineId(wineId); 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()); } optionSelectedAltStates.setFulfill(fulfiModel); /*WineLicenseFullfillAltStates wineFullfillAltStatesModel = WinePermitRepository.findFulfilModelByWineId(wineModel.getId()); if(wineFullfillAltStatesModel!=null) { } sellInAltStatesModel.setOptionSelectedAltStates(optionSelectedAltStates); } } wineFullfillAltStatesModel = WinePermitRepository.findFulfilModelByWineId(wineModel.getId()); if(wineFullfillAltStatesModel!=null) { }*/ Long mappedWineryId = wineModel.getMappedWineryWithPermit(); if (mappedWineryId != null) { CustomWineryModel customWineryModel = new CustomWineryModel(); if (WineryRepository.getWineryById(mappedWineryId) != null) { customWineryModel.setWineryId(mappedWineryId); customWineryModel .setWineryName(WineryRepository.getWineryById(mappedWineryId).getWineryName()); optionSelectedAltStates.setMappedWineryWithPermit(customWineryModel); } } sellInAltStatesModel.setOptionSelectedAltStates(optionSelectedAltStates); Integer optionSelect = wineModel.getOptionSelectedAltstates(); if (optionSelect != null) { if (0 == optionSelect) { sellInAltStatesModel.setIsOptionSelectedKachinaAlt(true); } } List<WineLicenseNoPermit> wineLicenseNoPermit = WinePermitRepository .findWineLicenseNoPermitAltStates(wineId); List<OptionSelectedNoPermitResult> optionSelectedNoPermitResult = new ArrayList<OptionSelectedNoPermitResult>(); for (WineLicenseNoPermit wineLicenseNoPermitList : wineLicenseNoPermit) { OptionSelectedNoPermitResult noPermitResult = new OptionSelectedNoPermitResult(); WinePermitModelWithMasterData winePermitModelWithMasterData = new WinePermitModelWithMasterData(); MasterDataModel masterDataModel = new MasterDataModel(); Long masterDataForNoPermit = wineLicenseNoPermitList.getWineNoPermit().getId(); noPermitResult.setPriceFiled(wineLicenseNoPermitList.getPriceFiled()); noPermitResult.setSc3TStatus(wineLicenseNoPermitList.getStatus()); noPermitResult.setIsSelected(wineLicenseNoPermitList.getIsSelected()); masterDataModel.setId(masterDataForNoPermit); masterDataModel .setMasterDataTypeName(EnumTypes.MasterDataTypeEnum.WineryLicenceNoPermit.name()); masterDataModel.setMasterDataName(wineLicenseNoPermitList.getWineNoPermit().getName()); winePermitModelWithMasterData.setMasterData(masterDataModel); noPermitResult.setWinePermit(winePermitModelWithMasterData); optionSelectedNoPermitResult.add(noPermitResult); } sellInAltStatesModel.setOptionSelectedNoPermit(optionSelectedNoPermitResult); winePermitViewVO.setSellInAltStates(sellInAltStatesModel); /*}*/ response = new com.wineaccess.response.SuccessResponse(winePermitViewVO, 200); } } outputViewPermit.put("FINAL-RESPONSE", response); return outputViewPermit; }
From source file:com.aurel.track.admin.customize.category.CategoryBL.java
/** * Replaces and deletes a node//from w ww . j a v a2 s .c om * @param node * @param replacementID */ static void replaceAndDelete(String node, Integer replacementID) { CategoryTokens categoryTokens = CategoryTokens.decodeNode(node); String categoryType = categoryTokens.getCategoryType(); Integer type = categoryTokens.getType(); Integer objectID = categoryTokens.getObjectID(); if (type.equals(Integer.valueOf(TYPE.LEAF))) { LeafFacade leafFacade = CategoryFacadeFactory.getInstance().getLeafFacade(categoryType); leafFacade.replace(objectID, replacementID); } else { CategoryFacade categoryFacade = CategoryFacadeFactory.getInstance().getCategoryFacade(categoryType); categoryFacade.replace(objectID, replacementID); } }
From source file:cz.cvut.kbss.wpa.back.LeagueDetailBean.java
public String getStyle(Integer i, Integer j) { if (i.equals(j)) { return "tableCellDark"; } else if (((i + j) % 2) == 1) { return "tableCellBlue"; } else if (((i + j) % 2) == 0) { return "tableCellGray"; }//from w w w. j a va 2 s. co m return ""; }
From source file:com.aurel.track.item.ItemDetailBL.java
private static boolean editableExpense(TCostBean costBean, Integer personID, boolean isProjectActive, boolean personIsProjectAdmin) { return isProjectActive && (personIsProjectAdmin || personID.equals(costBean.getChangedByID())); }
From source file:org.openmhealth.shim.ihealth.mapper.IHealthBloodPressureDataPointMapper.java
/** * @param measureUnitMagicNumber The number from the iHealth response representing the unit of measure. * @return The corresponding OMH schema unit of measure for blood pressure. *///from w ww . j av a 2 s . co m protected double getBloodPressureValueInMmHg(double rawBpValue, Integer measureUnitMagicNumber) { if (measureUnitMagicNumber.equals(MMHG_UNIT_MAGIC_NUMBER)) { return rawBpValue; } else if (measureUnitMagicNumber.equals(KPA_UNIT_MAGIC_NUMBER)) { return rawBpValue * KPA_TO_MMHG_CONVERSION_RATE; } else { throw new UnsupportedOperationException(); } }
From source file:br.com.bropenmaps.util.Util.java
/** * Valida um formulrio. Dois parmetros so passados. O primeiro um estrutura que representa os campos do formulrio, esta estrutura formada por * uma coleo de pares nome do campo/valor do campo. O segundo parmtetro tambm uma coleo formada por pares nome do campo/tipo de validao. * @param params - parmetros do formulrio a serem validados * @param tipo - tipo de validao para cada parmetro * @return Estrutura contendo os erros encontrados, que uma coleo de pares nome do campo/erro encontrado. *//*www . j a va 2 s. co m*/ public static HashMap<String, String> validaForm(final HashMap<String, String> params, final HashMap<String, Integer[]> tipo) { Set<String> chaves = params.keySet(); HashMap<String, String> erros = new HashMap<String, String>(); Integer[] ts = null; String tk[] = null; for (String s : chaves) { ts = tipo.get(s); for (Integer t : ts) { if (t.equals(OBRIGATORIO)) { if (params.get(s) == null || params.get(s).equals("")) { erros.put(s, "Campo obrigatrio."); } } else if (t.equals(EMAIL)) { if (params.get(s) != null) { tk = StringUtils.split(params.get(s), ","); for (int i = 0; i < tk.length; i++) { if (!validaEmail(StringUtils.trim(tk[i]))) { erros.put(s, "Informe email(s) vlido(s)."); break; } } } } } } return erros; }
From source file:org.openmhealth.shim.ihealth.mapper.IHealthBloodGlucoseDataPointMapper.java
/** * @param measureUnitMagicNumber The number from the iHealth response representing the unit of measure. * @return The corresponding OMH schema unit of measure for blood glucose. *///from w w w .j a va 2s . c om protected BloodGlucoseUnit getBloodGlucoseUnitFromMagicNumber(Integer measureUnitMagicNumber) { if (measureUnitMagicNumber.equals(MG_PER_DL_MAGIC_NUMBER)) { return MILLIGRAMS_PER_DECILITER; } else if (measureUnitMagicNumber.equals(MMOL_PER_L_MAGIC_NUMBER)) { return MILLIMOLES_PER_LITER; } else { throw new UnsupportedOperationException(); } }
From source file:edu.ku.brc.specify.datamodel.DataModelObjBase.java
/** * @param dataObject/*from w ww.j a v a 2 s.c o m*/ * @param fieldName * @param ref * @return */ public static boolean removeFromCollectionById(final Object dataObject, final String fieldName, final FormDataObjIFace ref) { if (ref.getId() != null) { try { DataObjectGettable getter = DataObjectGettableFactory.get(dataObject.getClass().getName(), FormHelper.DATA_OBJ_GETTER); Object dataMember = getter.getFieldValue(dataObject, fieldName); if (dataMember != null && dataMember instanceof Set<?>) { Set<?> dataSet = (Set<?>) dataMember; for (Object obj : dataSet) { if (obj instanceof DataModelObjBase) { Integer id1 = ((DataModelObjBase) ref).getId(); Integer id2 = ref.getId(); if (id2 != null && id1.equals(id2)) { dataSet.remove(ref); return true; } } } } } catch (Exception ex) { edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount(); edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(DataModelObjBase.class, ex); ex.printStackTrace(); } } return false; }
From source file:pl.edu.agh.samm.db.impl.mapper.ActionExecutionExtractor.java
@Override public Object extractData(ResultSet rs) throws SQLException, DataAccessException { List<ActionExecution> ael = new LinkedList<ActionExecution>(); ActionExecution currentActionExecution = null; HashMap<String, String> currentParameters = null; Action currentAction = null;//from ww w . j a va2s . co m Integer currentActionExecId = null; while (rs.next()) { Integer id = rs.getInt("id"); if (!id.equals(currentActionExecId)) { if (currentActionExecution != null) { ael.add(currentActionExecution); } // this is new execution currentActionExecId = id; Date start = new Date(rs.getTimestamp("start_time").getTime());// FIXME // why // the // heck // it // has // to // be // like // that // to // get // correct // date?? // HSQL? Date end = new Date(rs.getTimestamp("end_time").getTime()); currentAction = new Action(); currentAction.setActionURI(rs.getString("action_uri")); currentParameters = new HashMap<String, String>(); currentAction.setParameterValues(currentParameters); currentActionExecution = new ActionExecution(currentAction, start, end); } String paramName = rs.getString("param_name"); String paramValue = rs.getString("param_value"); currentParameters.put(paramName, paramValue); } if (!ael.contains(currentActionExecution)) { ael.add(currentActionExecution); } return ael; }