1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.krms.impl.repository; |
17 | |
|
18 | |
import org.kuali.rice.core.api.util.ConcreteKeyValue; |
19 | |
import org.kuali.rice.core.api.util.KeyValue; |
20 | |
import org.kuali.rice.krad.service.KRADServiceLocator; |
21 | |
import org.kuali.rice.krad.uif.control.UifKeyValuesFinderBase; |
22 | |
import org.kuali.rice.krad.uif.view.ViewModel; |
23 | |
import org.kuali.rice.krad.web.form.MaintenanceForm; |
24 | |
import org.kuali.rice.krms.impl.ui.AgendaEditor; |
25 | |
import org.kuali.rice.krms.impl.util.KrmsImplConstants; |
26 | |
|
27 | |
import java.util.ArrayList; |
28 | |
import java.util.Collection; |
29 | |
import java.util.Collections; |
30 | |
import java.util.List; |
31 | |
import java.util.Map; |
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | 0 | public class ActionTypeValuesFinder extends UifKeyValuesFinderBase { |
37 | |
|
38 | |
private boolean blankOption; |
39 | |
|
40 | |
@Override |
41 | |
public List<KeyValue> getKeyValues(ViewModel model) { |
42 | 0 | List<KeyValue> keyValues = new ArrayList<KeyValue>(); |
43 | |
|
44 | 0 | MaintenanceForm maintenanceForm = (MaintenanceForm) model; |
45 | 0 | AgendaEditor agendaEditor = ((AgendaEditor) maintenanceForm.getDocument().getNewMaintainableObject().getDataObject()); |
46 | |
|
47 | 0 | if(blankOption){ |
48 | 0 | keyValues.add(new ConcreteKeyValue("", "")); |
49 | |
} |
50 | |
|
51 | 0 | Map<String, String> criteria = Collections.singletonMap(KrmsImplConstants.PropertyNames.Context.CONTEXT_ID, |
52 | |
agendaEditor.getAgenda().getContextId()); |
53 | 0 | Collection<ContextValidActionBo> contextValidActions = |
54 | |
KRADServiceLocator.getBusinessObjectService().findMatchingOrderBy( |
55 | |
ContextValidActionBo.class, criteria, "actionType.name", true); |
56 | 0 | for (ContextValidActionBo contextValidAction : contextValidActions) { |
57 | 0 | keyValues.add(new ConcreteKeyValue(contextValidAction.getActionType().getId(), contextValidAction.getActionType().getName())); |
58 | |
} |
59 | 0 | return keyValues; |
60 | |
} |
61 | |
|
62 | |
|
63 | |
|
64 | |
|
65 | |
public boolean isBlankOption() { |
66 | 0 | return this.blankOption; |
67 | |
} |
68 | |
|
69 | |
|
70 | |
|
71 | |
|
72 | |
public void setBlankOption(boolean blankOption) { |
73 | 0 | this.blankOption = blankOption; |
74 | 0 | } |
75 | |
} |