1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.student.core.krms.builder;
17
18 import org.kuali.rice.krms.builder.ComponentBuilder;
19 import org.kuali.student.core.krms.dto.KSPropositionEditor;
20 import org.kuali.student.r2.core.constants.KSKRMSServiceConstants;
21
22 import java.util.HashMap;
23 import java.util.List;
24 import java.util.Map;
25
26
27
28
29 public class DurationComponentBuilder implements ComponentBuilder<KSPropositionEditor> {
30
31 @Override
32 public List<String> getComponentIds() {
33 return null;
34 }
35
36 @Override
37 public void resolveTermParameters(KSPropositionEditor propositionEditor, Map<String, String> termParameters) {
38 String durationType = termParameters.get(KSKRMSServiceConstants.TERM_PARAMETER_TYPE_DURATION_TYPE_KEY);
39 String duration = termParameters.get(KSKRMSServiceConstants.TERM_PARAMETER_TYPE_DURATION_KEY);
40 if (durationType != null) {
41 propositionEditor.setDurationType(durationType);
42 }
43 if (duration != null) {
44 propositionEditor.setDuration(Integer.parseInt(duration));
45 }
46
47 }
48
49 @Override
50 public Map<String, String> buildTermParameters(KSPropositionEditor propositionEditor) {
51 Map<String, String> termParameters = new HashMap<String, String>();
52 termParameters.put(KSKRMSServiceConstants.TERM_PARAMETER_TYPE_DURATION_TYPE_KEY, propositionEditor.getDurationType());
53 termParameters.put(KSKRMSServiceConstants.TERM_PARAMETER_TYPE_DURATION_KEY, propositionEditor.getDuration().toString());
54
55 return termParameters;
56 }
57
58 @Override
59 public void onSubmit(KSPropositionEditor propositionEditor) {
60
61 }
62
63 @Override
64 public void validate(KSPropositionEditor propositionEditor) {
65
66 }
67
68 }