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.io.Serializable;
27 import java.util.List;
28
29
30
31
32
33
34
35 public class SimplePropositionNode extends RuleTreeNode {
36 private static final long serialVersionUID = -629088492909384804L;
37 public static final String NODE_TYPE = "ruleTreeNode simplePropositionNode";
38 protected String parameterDisplayString;
39
40
41 public SimplePropositionNode() {
42 }
43
44 public SimplePropositionNode(PropositionBo proposition){
45 super(proposition);
46 setupParameterDisplayString();
47 }
48
49 private void setupParameterDisplayString(){
50 if (proposition != null && proposition.getPropositionTypeCode().equalsIgnoreCase(PropositionType.SIMPLE.getCode())){
51
52
53 List<PropositionParameterBo> parameters = proposition.getParameters();
54 if (parameters != null && parameters.size() == 3){
55 setParameterDisplayString(getParamValue(parameters.get(0))
56 + " " + getParamValue(parameters.get(2))
57 + " " + getParamValue(parameters.get(1)));
58 } else {
59
60 }
61 }
62 }
63
64 private String getParamValue(PropositionParameterBo prop){
65 if (PropositionParameterType.TERM.getCode().equalsIgnoreCase(prop.getParameterType())){
66
67 String termId = prop.getValue();
68 TermBo term = getBoService().findBySinglePrimaryKey(TermBo.class,termId);
69 if (term!=null){
70 return term.getSpecification().getName();
71 }
72 return "";
73 } else {
74 return prop.getValue();
75 }
76 }
77
78
79
80 public String getParameterDisplayString() {
81 return this.parameterDisplayString;
82 }
83
84
85
86
87 public void setParameterDisplayString(String parameterDisplayString) {
88 this.parameterDisplayString = parameterDisplayString;
89 }
90
91 public BusinessObjectService getBoService() {
92 return KRADServiceLocator.getBusinessObjectService();
93 }
94
95 }