public static List<PassIndLinkWrapper> wrapList( List<PassIndLink> passIndLinks, List<Passport> passports, List<Indicator> indicators, List<Measure> measures) { if ((passIndLinks == null) || passIndLinks.isEmpty()) { return null; } else { HashMap<Long, Passport> passportMap = new HashMap<Long, Passport>(); for (Passport passport : passports) { passportMap.put(passport.getId(), passport); } HashMap<Long, Indicator> indicatorMap = new HashMap<Long, Indicator>(); for (Indicator indicator : indicators) { indicatorMap.put(indicator.getId(), indicator); } HashMap<Long, Measure> measureMap = new HashMap<Long, Measure>(); for (Measure measure : measures) { measureMap.put(measure.getId(), measure); } ArrayList<PassIndLinkWrapper> passIndLinkWrappers = new ArrayList<PassIndLinkWrapper>(); for (PassIndLink passIndLink : passIndLinks) { passIndLinkWrappers.add( new PassIndLinkWrapper( passIndLink, passportMap.get(passIndLink.getPassId()), indicatorMap.get(passIndLink.getIndId()), measureMap.get(passIndLink.getMeasureId()))); } return passIndLinkWrappers; } }
public PassportWrapper(Passport passport) { super(); this.setId(passport.getId()); this.setParId(passport.getParId()); this.setRname(passport.getRname()); this.setKname(passport.getKname()); this.setEname(passport.getEname()); this.setPasstype(passport.getPasstype()); }
public String toOption(Long selectedId) { StringBuilder stringBuilder = new StringBuilder("<option ") .append(getId().equals(selectedId) ? " selected " : "") .append(" value=\"") .append(getId() == null ? "" : getId().toString()) .append("\">"); stringBuilder .append(passport.getRname()) .append(" | ") .append(indicator.getRname()) .append(" | ") .append(measure != null ? measure.getRname() : "") .append("</option>"); return stringBuilder.toString(); }