Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
ActionTypeValuesFinder |
|
| 1.6666666666666667;1.667 |
1 | /** | |
2 | * Copyright 2005-2011 The Kuali Foundation | |
3 | * | |
4 | * Licensed under the Educational Community License, Version 2.0 (the "License"); | |
5 | * you may not use this file except in compliance with the License. | |
6 | * You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.opensource.org/licenses/ecl2.php | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | package org.kuali.rice.krms.impl.repository; | |
17 | ||
18 | import org.hibernate.mapping.TableOwner; | |
19 | import org.kuali.rice.core.api.util.ConcreteKeyValue; | |
20 | import org.kuali.rice.core.api.util.KeyValue; | |
21 | import org.kuali.rice.krad.keyvalues.KeyValuesBase; | |
22 | import org.kuali.rice.krad.service.KRADServiceLocator; | |
23 | import org.kuali.rice.krms.impl.util.KrmsImplConstants; | |
24 | ||
25 | import java.util.ArrayList; | |
26 | import java.util.Collection; | |
27 | import java.util.HashMap; | |
28 | import java.util.List; | |
29 | import java.util.Map; | |
30 | ||
31 | /** | |
32 | * This class returns all action types of rules. | |
33 | */ | |
34 | 0 | public class ActionTypeValuesFinder extends KeyValuesBase { |
35 | ||
36 | private boolean blankOption; | |
37 | ||
38 | @Override | |
39 | public List<KeyValue> getKeyValues() { | |
40 | 0 | List<KeyValue> keyValues = new ArrayList<KeyValue>(); |
41 | ||
42 | 0 | if(blankOption){ |
43 | 0 | keyValues.add(new ConcreteKeyValue("", "")); |
44 | } | |
45 | ||
46 | // TODO: Only select the actions for the specific context of the agenda | |
47 | // Map<String, String> fieldValues = new HashMap<String, String>(); | |
48 | // fieldValues.put(KrmsImplConstants.PropertyNames.Context.CONTEXT_ID, form.getAgenda().getContextId); | |
49 | // Collection<ContextValidActionBo> contextValidActions = KRADServiceLocator.getBusinessObjectService().findMatching(ContextValidActionBo.class, fieldValues); | |
50 | 0 | Collection<ContextValidActionBo> contextValidActions = KRADServiceLocator.getBusinessObjectService().findAll(ContextValidActionBo.class); |
51 | 0 | for (ContextValidActionBo contextValidAction : contextValidActions) { |
52 | 0 | keyValues.add(new ConcreteKeyValue(contextValidAction.getActionType().getId(), contextValidAction.getActionType().getName())); |
53 | } | |
54 | 0 | return keyValues; |
55 | } | |
56 | ||
57 | /** | |
58 | * @return the blankOption | |
59 | */ | |
60 | public boolean isBlankOption() { | |
61 | 0 | return this.blankOption; |
62 | } | |
63 | ||
64 | /** | |
65 | * @param blankOption the blankOption to set | |
66 | */ | |
67 | public void setBlankOption(boolean blankOption) { | |
68 | 0 | this.blankOption = blankOption; |
69 | 0 | } |
70 | ||
71 | } |