1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.student.enrollment.class1.krms.util;
17
18 import com.google.common.collect.Maps;
19 import org.kuali.rice.krad.uif.component.BindingInfo;
20 import org.kuali.rice.krad.uif.component.Component;
21 import org.kuali.rice.krad.uif.container.CollectionGroup;
22 import org.kuali.rice.krad.uif.container.Group;
23 import org.kuali.rice.krad.uif.container.NodePrototype;
24 import org.kuali.rice.krad.uif.util.ComponentUtils;
25 import org.kuali.rice.krad.uif.util.ObjectPropertyUtils;
26 import org.kuali.rice.krad.uif.view.View;
27 import org.kuali.rice.krms.dto.AgendaEditor;
28 import org.kuali.rice.krms.dto.RuleEditor;
29 import org.kuali.rice.krms.service.RuleViewHelperService;
30 import org.kuali.rice.krms.util.AgendaBuilder;
31 import org.kuali.rice.krms.util.AgendaSection;
32
33 import java.util.ArrayList;
34 import java.util.List;
35 import java.util.Map;
36
37
38
39
40 public class FinalExamAgendaSection extends AgendaSection {
41
42 private AgendaBuilder agendaBuilder;
43 private Map<String, Group> agendaPrototypeMap;
44
45 public AgendaBuilder getAgendaBuilder() {
46 if (this.agendaBuilder == null) {
47 this.agendaBuilder = new FinalExamAgendaBuilder();
48 }
49 return this.agendaBuilder;
50 }
51
52 public Map<String, Group> getAgendaPrototypeMap() {
53 return agendaPrototypeMap;
54 }
55
56 public void setAgendaPrototypeMap(Map<String, Group> agendaPrototypeMap) {
57 this.agendaPrototypeMap = agendaPrototypeMap;
58 }
59
60 @Override
61 public List<Component> getComponentPrototypes() {
62 List<Component> components = super.getComponentPrototypes();
63 for (Map.Entry<String, Group> agendaPrototypeMapEntry : this.getAgendaPrototypeMap().entrySet()) {
64 components.add(agendaPrototypeMapEntry.getValue());
65 }
66
67 return components;
68 }
69
70
71
72
73 @Override
74 protected <T> void copyProperties(T component) {
75 super.copyProperties(component);
76
77 FinalExamAgendaSection agendaSectionCopy = (FinalExamAgendaSection) component;
78 if (this.agendaPrototypeMap != null) {
79 Map<String, Group> agendaPrototypeMapCopy = Maps.newHashMapWithExpectedSize(
80 this.getAgendaPrototypeMap().size());
81 for (Map.Entry<String, Group> agendaPrototypeMapEntry : agendaPrototypeMap.entrySet()) {
82 Group prototypeCopy = (Group) agendaPrototypeMapEntry.getValue().copy();
83 agendaPrototypeMapCopy.put(agendaPrototypeMapEntry.getKey(), prototypeCopy);
84 }
85
86 agendaSectionCopy.setAgendaPrototypeMap(agendaPrototypeMapCopy);
87 }
88 }
89 }