Пример #1
0
  protected static SortedMap<Integer, AgreementSummaryInstance> getAgreementSummaryList(
      List<Object[]> objects, boolean primary, boolean siteSearch) throws Exception {
    SortedMap<Integer, AgreementSummaryInstance> agreementMap =
        new TreeMap<Integer, AgreementSummaryInstance>();
    AgreementSummaryInstance instance = null;
    for (Object[] row : objects) {
      if (row.length >= 1 && row[0] instanceof Agreement) {
        Agreement agreement = (Agreement) row[0];
        if (agreementMap.containsKey(agreement.getId())) {
          instance = agreementMap.get(agreement.getId());
        } else {
          instance = getAgreementSummaryInstance(agreement, primary, siteSearch);
          agreementMap.put(instance.getId(), instance);
        }
      }
      if (row.length == 2
          && row[0] instanceof Agreement
          && row[1] != null
          && row[1] instanceof AgreementTerm) {
        AgreementTerm agreementTerm = (AgreementTerm) row[1];
        applyAgreementTerm(instance, agreementTerm);
      } else if (row.length != 2
          || !(row[0] instanceof Agreement)
          || !(row[1] == null || row[1] instanceof Agreement))
        throw new Exception("Unexpected SQL result in getAgreementSummaryList");
    }

    return agreementMap;

    //        List<AgreementSummaryInstance> results = new ArrayList<AgreementSummaryInstance>();
    //        results.addAll(agreementMap.values());
    //
    //        return results;
  }
Пример #2
0
  protected static AgreementSummaryInstance getAgreementSummaryInstance(
      Agreement agreement, boolean primary, boolean siteSearch) {
    AgreementSummaryInstance instance = new AgreementSummaryInstance();

    instance.setId(agreement.getId());
    instance.setBillUcn(agreement.getBillUcn());
    instance.setCommissionCode(agreement.getCommissionCode());
    instance.setAgreementTypeCode(agreement.getAgreementTypeCode());
    instance.setDeleteReasonCode(agreement.getDeleteReasonCode());
    instance.setStatus(agreement.getStatus());
    instance.setCreatedDate(agreement.getCreatedDatetime());
    instance.setFromPrimaryOnly(primary);
    instance.setFromSiteSearch(siteSearch);

    return instance;
  }
Пример #3
0
  public static AgreementInstance getInstance(Agreement dbInstance) {
    AgreementInstance instance = new AgreementInstance();

    instance.setId(dbInstance.getId());
    instance.setBillUcn(dbInstance.getBillUcn());
    instance.setBillUcnSuffix(dbInstance.getBillUcnSuffix());
    instance.setAgreementTypeCode(dbInstance.getAgreementTypeCode());
    instance.setAgreementLinkId(dbInstance.getAgreementLinkId());
    instance.setBuildings(dbInstance.getBuildings());
    instance.setEnrollment(dbInstance.getEnrollment());
    instance.setPopulation(dbInstance.getPopulation());
    instance.setWorkstations(dbInstance.getWorkstations());
    instance.setCommissionCode(dbInstance.getCommissionCode());
    instance.setDeleteReasonCode(instance.getDeleteReasonCode());
    instance.setOrgPath(dbInstance.getOrgPath());
    instance.setNote(dbInstance.getNote());
    instance.setCreatedDatetime(dbInstance.getCreatedDatetime());
    instance.setStatus(dbInstance.getStatus());

    return instance;
  }