コード例 #1
0
  @Override
  public List<? extends BusinessObject> getSearchResults(Map<String, String> fieldValues) {
    // need to set backlocation & docformkey here. Otherwise, they are empty
    super.setBackLocationDocFormKey(fieldValues);
    if (this.getParameters().containsKey(USER_ID)) {
      fieldValues.put("projectPersons.personId", ((String[]) this.getParameters().get(USER_ID))[0]);
    }
    Map<String, String> formProps = new HashMap<String, String>();
    if (!StringUtils.isEmpty(fieldValues.get("lookupOspAdministratorName"))) {
      formProps.put("fullName", fieldValues.get("lookupOspAdministratorName"));
      formProps.put("unitAdministratorTypeCode", "2");
    }
    fieldValues.remove("lookupOspAdministratorName");
    if (!formProps.isEmpty()) {
      List<Long> ids = new ArrayList<Long>();
      Collection<AwardUnitContact> persons =
          getLookupService().findCollectionBySearch(AwardUnitContact.class, formProps);
      if (persons.isEmpty()) {
        return new ArrayList<Award>();
      }
      for (AwardUnitContact person : persons) {
        ids.add(person.getAwardContactId());
      }
      fieldValues.put("awardUnitContacts.awardContactId", StringUtils.join(ids, '|'));
    }
    List<Award> unboundedResults = (List<Award>) super.getSearchResultsUnbounded(fieldValues);

    List<Award> returnResults = new ArrayList<Award>();
    try {
      returnResults = filterForActiveAwardsAndAwardWithActiveTimeAndMoney(unboundedResults);
    } catch (WorkflowException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    List<Award> filteredResults = new ArrayList<Award>();

    filteredResults = (List<Award>) filterForPermissions(returnResults);

    return filteredResults;
  }