1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krms.impl.repository.language;
17
18 import java.util.Map;
19 import org.kuali.rice.krms.api.repository.language.NaturalLanguageTemplate;
20 import org.kuali.rice.krms.api.repository.language.NaturalLanguageTemplaterContract;
21
22
23
24
25
26 public class SimpleNaturalLanguageTemplater implements NaturalLanguageTemplaterContract {
27
28 @Override
29 public String translate(NaturalLanguageTemplate naturalLanguageTemplate, Map<String, Object> contextMap) {
30 StringBuilder sb = new StringBuilder (naturalLanguageTemplate.getTemplate());
31 sb.append(" applied with the following ");
32 sb.append (contextMap.size());
33 sb.append(" variables: ");
34 String comma = "";
35 for (String key : contextMap.keySet()) {
36 sb.append (comma);
37 comma = ",";
38 sb.append ("[");
39 sb.append (key);
40 sb.append ("=");
41 sb.append (contextMap.get(key));
42 sb.append ("]");
43 }
44 return sb.toString();
45 }
46
47 }