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.dataobject.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
29
30
31
32
33 public class ComponentViewHelperServiceImpl extends ViewHelperServiceImpl implements ComponentViewHelperService {
34
35 private static final long serialVersionUID = -3952713360851782891L;
36
37
38
39
40 @Override
41 public List<TravelAccount> retrieveTravelAccounts(String term) {
42 List<TravelAccount> matchingAccounts = new ArrayList<TravelAccount>();
43
44 Map<String, String> lookupCriteria = new HashMap<String, String>();
45 lookupCriteria.put("number", term + SearchOperator.LIKE_MANY.op());
46
47 matchingAccounts = (List<TravelAccount>) KRADServiceLocatorWeb.getLookupService().findCollectionBySearch(
48 TravelAccount.class, lookupCriteria);
49
50 return matchingAccounts;
51 }
52
53
54
55
56 @Override
57 public List<TravelAccount> retrieveTravelAccountsBySubAcctAndTerm(String subAccount, String term) {
58 List<TravelAccount> matchingAccounts = new ArrayList<TravelAccount>();
59
60 Map<String, String> lookupCriteria = new HashMap<String, String>();
61 lookupCriteria.put("subAccounts.subAccount", subAccount);
62 lookupCriteria.put("number", term + SearchOperator.LIKE_MANY.op());
63
64 matchingAccounts = (List<TravelAccount>) KRADServiceLocatorWeb.getLookupService().findCollectionBySearch(
65 TravelAccount.class, lookupCriteria);
66
67 return matchingAccounts;
68 }
69
70
71
72
73 @Override
74 public List<TravelAccount> retrieveTravelAccountsByName(String name) {
75 List<TravelAccount> matchingAccounts = new ArrayList<TravelAccount>();
76
77 Map<String, String> lookupCriteria = new HashMap<String, String>();
78 lookupCriteria.put("name", name + SearchOperator.LIKE_MANY.op());
79
80 matchingAccounts = (List<TravelAccount>) KRADServiceLocatorWeb.getLookupService().findCollectionBySearch(
81 TravelAccount.class, lookupCriteria);
82
83 return matchingAccounts;
84 }
85
86 }