Пример #1
0
 public List<SponsorDTO> getMatchingSponsors(SponsorCriteriaDto searchCriteria) {
   List<SponsorDTO> results = new ArrayList<SponsorDTO>();
   Collection<Sponsor> sponsors;
   if (ObjectUtils.isNull(searchCriteria)
       || (StringUtils.isEmpty(searchCriteria.getSponsorCode())
           && StringUtils.isEmpty(searchCriteria.getCustomerNumber()))) {
     sponsors = getBusinessObjectService().findAll(Sponsor.class);
   } else if (StringUtils.isNotEmpty(searchCriteria.getSponsorCode())) {
     sponsors =
         legacyDataAdapter.findCollectionBySearchHelper(
             Sponsor.class,
             Collections.singletonMap("sponsorCode", searchCriteria.getSponsorCode()),
             Collections.<String>emptyList(),
             true,
             false,
             0);
   } else {
     sponsors =
         legacyDataAdapter.findCollectionBySearchHelper(
             Sponsor.class,
             Collections.singletonMap("customerNumber", searchCriteria.getCustomerNumber()),
             Collections.<String>emptyList(),
             true,
             false,
             0);
   }
   if (sponsors != null && !sponsors.isEmpty()) {
     for (Sponsor sponsor : sponsors) {
       results.add(sponsorDtoService.buildDto(sponsor));
     }
   }
   return results;
 }
Пример #2
0
 public SponsorDTO getSponsor(String sponsorCode) {
   if (StringUtils.isNotBlank(sponsorCode)) {
     Sponsor sponsor =
         getBusinessObjectService().findBySinglePrimaryKey(Sponsor.class, sponsorCode);
     if (sponsor != null) {
       SponsorDTO result = sponsorDtoService.buildDto(sponsor);
       return result;
     }
   }
   return null;
 }