1 package org.kuali.student.core.krms.tree;
2
3 import org.apache.commons.lang.StringUtils;
4 import org.kuali.rice.krms.dto.PropositionEditor;
5 import org.kuali.rice.krms.tree.RuleEditTreeBuilder;
6 import org.kuali.rice.krms.util.NaturalLanguageHelper;
7 import org.kuali.student.r1.common.rice.StudentIdentityConstants;
8 import org.kuali.student.r2.core.constants.KSKRMSServiceConstants;
9
10 import java.util.Map;
11
12
13
14
15
16
17
18
19 public class KSRuleEditTreeBuilder extends RuleEditTreeBuilder{
20
21 private NaturalLanguageHelper nlHelper;
22
23 protected String getDescription(PropositionEditor proposition) {
24 if (proposition == null) {
25 return StringUtils.EMPTY;
26 }
27
28
29 Map<String, String> nlMap = proposition.getNaturalLanguage();
30 if(!nlMap.containsKey(this.getNaturalLanguageUsageKey())){
31 this.getNlHelper().setNaturalLanguageForUsage(proposition, this.getNaturalLanguageUsageKey(), StudentIdentityConstants.KS_NAMESPACE_CD);
32 }
33
34
35 String description = nlMap.get(this.getNaturalLanguageUsageKey());
36 if (description==null){
37 return StringUtils.EMPTY;
38 }
39
40 return description;
41 }
42
43 public String getNaturalLanguageUsageKey(){
44 return KSKRMSServiceConstants.KRMS_NL_RULE_EDIT;
45 }
46
47 public NaturalLanguageHelper getNlHelper() {
48 return nlHelper;
49 }
50
51 public void setNlHelper(NaturalLanguageHelper nlHelper) {
52 this.nlHelper = nlHelper;
53 }
54
55 }