コード例 #1
0
  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;
    }
  }
コード例 #2
0
  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("&nbsp;&nbsp;|&nbsp;&nbsp;")
        .append(indicator.getRname())
        .append("&nbsp;&nbsp;|&nbsp;&nbsp;")
        .append(measure != null ? measure.getRname() : "")
        .append("</option>");

    return stringBuilder.toString();
  }