1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.student.core.krms.tree;
17
18 import org.apache.commons.lang.StringUtils;
19 import org.kuali.rice.core.api.util.tree.Node;
20 import org.kuali.rice.core.api.util.tree.Tree;
21 import org.kuali.rice.krms.dto.PropositionEditor;
22 import org.kuali.rice.krms.dto.RuleEditor;
23 import org.kuali.rice.krms.tree.AbstractTreeBuilder;
24 import org.kuali.rice.krms.tree.RuleCompareTreeBuilder;
25 import org.kuali.rice.krms.tree.node.CompareTreeNode;
26 import org.kuali.rice.krms.util.NaturalLanguageHelper;
27 import org.kuali.rice.krms.util.PropositionTreeUtil;
28 import org.kuali.student.r1.common.rice.StudentIdentityConstants;
29 import org.kuali.student.r2.core.constants.KSKRMSServiceConstants;
30
31 import java.util.List;
32 import java.util.Map;
33
34
35
36
37
38
39
40
41 public class KSRuleCompareTreeBuilder extends RuleCompareTreeBuilder {
42
43 private static final long serialVersionUID = 1L;
44
45 private NaturalLanguageHelper nlHelper;
46
47 protected String getDescription(PropositionEditor proposition) {
48 if (proposition == null) {
49 return StringUtils.EMPTY;
50 }
51
52
53 Map<String, String> nlMap = proposition.getNaturalLanguage();
54 if(!nlMap.containsKey(this.getNaturalLanguageUsageKey())){
55 this.getNlHelper().setNaturalLanguageForUsage(proposition, this.getNaturalLanguageUsageKey(), StudentIdentityConstants.KS_NAMESPACE_CD);
56 }
57
58
59 String description = nlMap.get(this.getNaturalLanguageUsageKey());
60 if (description==null){
61 return StringUtils.EMPTY;
62 }
63
64 return description;
65 }
66
67 public String getNaturalLanguageUsageKey(){
68 return KSKRMSServiceConstants.KRMS_NL_RULE_EDIT;
69 }
70
71 public NaturalLanguageHelper getNlHelper() {
72 return nlHelper;
73 }
74
75 public void setNlHelper(NaturalLanguageHelper nlHelper) {
76 this.nlHelper = nlHelper;
77 }
78
79 }