1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.krms.impl.ui; |
17 | |
|
18 | |
import org.kuali.rice.krad.service.BusinessObjectService; |
19 | |
import org.kuali.rice.krad.service.KRADServiceLocator; |
20 | |
import org.kuali.rice.krms.api.repository.proposition.PropositionParameterType; |
21 | |
import org.kuali.rice.krms.api.repository.proposition.PropositionType; |
22 | |
import org.kuali.rice.krms.impl.repository.PropositionBo; |
23 | |
import org.kuali.rice.krms.impl.repository.PropositionParameterBo; |
24 | |
import org.kuali.rice.krms.impl.repository.TermBo; |
25 | |
|
26 | |
import java.util.List; |
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
public class SimplePropositionEditNode extends RuleTreeNode { |
35 | |
|
36 | |
private static final long serialVersionUID = -5650654824214437325L; |
37 | |
|
38 | |
public static final String NODE_TYPE = "ruleTreeNode simplePropositionEditNode"; |
39 | |
protected String parameterDisplayString; |
40 | |
|
41 | |
public SimplePropositionEditNode(PropositionBo proposition){ |
42 | 0 | super(proposition); |
43 | 0 | setupParameterDisplayString(); |
44 | 0 | } |
45 | |
|
46 | |
private void setupParameterDisplayString(){ |
47 | 0 | if (proposition != null && proposition.getPropositionTypeCode().equalsIgnoreCase(PropositionType.SIMPLE.getCode())){ |
48 | |
|
49 | |
|
50 | 0 | List<PropositionParameterBo> parameters = proposition.getParameters(); |
51 | 0 | if (parameters != null && parameters.size() == 3){ |
52 | 0 | setParameterDisplayString(getParamValue(parameters.get(0)) |
53 | |
+ " " + getParamValue(parameters.get(2)) |
54 | |
+ " " + getParamValue(parameters.get(1))); |
55 | |
} else { |
56 | |
|
57 | |
} |
58 | |
} |
59 | 0 | } |
60 | |
|
61 | |
private String getParamValue(PropositionParameterBo prop){ |
62 | 0 | if (PropositionParameterType.TERM.getCode().equalsIgnoreCase(prop.getParameterType())){ |
63 | |
|
64 | 0 | String termName = ""; |
65 | 0 | String termId = prop.getValue(); |
66 | 0 | if (termId != null && termId.length() > 0){ |
67 | 0 | TermBo term = getBoService().findBySinglePrimaryKey(TermBo.class,termId); |
68 | 0 | if (term != null){ |
69 | 0 | termName = term.getSpecification().getName(); |
70 | |
} |
71 | |
} |
72 | 0 | return termName; |
73 | |
} else { |
74 | 0 | return prop.getValue(); |
75 | |
} |
76 | |
} |
77 | |
|
78 | |
|
79 | |
|
80 | |
public String getParameterDisplayString() { |
81 | 0 | return this.parameterDisplayString; |
82 | |
} |
83 | |
|
84 | |
|
85 | |
|
86 | |
|
87 | |
public void setParameterDisplayString(String parameterDisplayString) { |
88 | 0 | this.parameterDisplayString = parameterDisplayString; |
89 | 0 | } |
90 | |
|
91 | |
public BusinessObjectService getBoService() { |
92 | 0 | return KRADServiceLocator.getBusinessObjectService(); |
93 | |
} |
94 | |
|
95 | |
} |