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