1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.demo.uif.components;
17
18 import org.kuali.rice.core.api.search.SearchOperator;
19 import org.kuali.rice.krad.demo.travel.account.TravelAccount;
20 import org.kuali.rice.krad.service.KRADServiceLocatorWeb;
21 import org.kuali.rice.krad.uif.service.impl.ViewHelperServiceImpl;
22
23 import java.util.ArrayList;
24 import java.util.HashMap;
25 import java.util.List;
26 import java.util.Map;
27
28 public class ComponentViewHelperServiceImpl extends ViewHelperServiceImpl {
29 public List<TravelAccount> retrieveTravelAccounts(String term) {
30 List<TravelAccount> matchingAccounts = new ArrayList<TravelAccount>();
31
32 Map<String, String> lookupCriteria = new HashMap<String, String>();
33 lookupCriteria.put("number", term + SearchOperator.LIKE_MANY.op());
34
35 matchingAccounts = (List<TravelAccount>) KRADServiceLocatorWeb.getLookupService().findCollectionBySearch(
36 TravelAccount.class, lookupCriteria);
37
38 return matchingAccounts;
39 }
40
41 public List<TravelAccount> retrieveTravelAccountsBySubAcctAndTerm(String subAccount, String term) {
42 List<TravelAccount> matchingAccounts = new ArrayList<TravelAccount>();
43
44 Map<String, String> lookupCriteria = new HashMap<String, String>();
45 lookupCriteria.put("subAccount", subAccount);
46 lookupCriteria.put("number", term + SearchOperator.LIKE_MANY.op());
47
48 matchingAccounts = (List<TravelAccount>) KRADServiceLocatorWeb.getLookupService().findCollectionBySearch(
49 TravelAccount.class, lookupCriteria);
50
51 return matchingAccounts;
52 }
53
54 public List<TravelAccount> retrieveTravelAccountsBySubAcct(String subAccount) {
55 List<TravelAccount> matchingAccounts = new ArrayList<TravelAccount>();
56
57 Map<String, String> lookupCriteria = new HashMap<String, String>();
58 lookupCriteria.put("subAccountName", subAccount + SearchOperator.LIKE_MANY.op());
59
60 matchingAccounts = (List<TravelAccount>) KRADServiceLocatorWeb.getLookupService().findCollectionBySearch(
61 TravelAccount.class, lookupCriteria);
62
63 return matchingAccounts;
64 }
65 }