1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
package org.kuali.student.common.ui.client.configurable.mvc.binding; |
17 |
|
|
18 |
|
import java.util.Iterator; |
19 |
|
|
20 |
|
import org.kuali.student.common.assembly.data.Data; |
21 |
|
import org.kuali.student.common.assembly.data.QueryPath; |
22 |
|
import org.kuali.student.common.assembly.data.Data.Property; |
23 |
|
import org.kuali.student.common.ui.client.configurable.mvc.multiplicity.MultiplicityGroup; |
24 |
|
import org.kuali.student.common.ui.client.configurable.mvc.multiplicity.MultiplicityGroupItem; |
25 |
|
import org.kuali.student.common.ui.client.mvc.DataModel; |
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
@author |
31 |
|
|
|
|
| 0% |
Uncovered Elements: 48 (48) |
Complexity: 12 |
Complexity Density: 0.4 |
|
32 |
|
public class MultiplicityGroupBinding extends ModelWidgetBindingSupport<MultiplicityGroup> { |
33 |
|
public static MultiplicityGroupBinding INSTANCE = new MultiplicityGroupBinding(); |
34 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
35 |
0
|
public MultiplicityGroupBinding() {};... |
36 |
|
|
37 |
|
|
38 |
|
@see |
39 |
|
|
40 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
41 |
0
|
public void setModelValue(MultiplicityGroup mcWidget, DataModel model, String path) {... |
42 |
0
|
for (MultiplicityGroupItem item : mcWidget.getItems()) { |
43 |
0
|
MultiplicityGroupItemBinding.INSTANCE.setModelValue(item, model, mcWidget.getParentPath()); |
44 |
|
} |
45 |
0
|
for (MultiplicityGroupItem item : mcWidget.getRemovedItems()) { |
46 |
|
|
47 |
|
|
48 |
0
|
if(item.isCreated()==false){ |
49 |
0
|
MultiplicityGroupItemBinding.INSTANCE.setModelValue(item, model, path); |
50 |
|
} |
51 |
|
} |
52 |
|
} |
53 |
|
|
54 |
|
|
55 |
|
@see |
56 |
|
|
57 |
|
|
|
|
| 0% |
Uncovered Elements: 25 (25) |
Complexity: 6 |
Complexity Density: 0.35 |
|
58 |
0
|
public void setWidgetValue(MultiplicityGroup mg, DataModel model, String path) {... |
59 |
0
|
mg.clear(); |
60 |
|
|
61 |
0
|
String fieldPath = mg.translatePath(path); |
62 |
|
|
63 |
0
|
mg.setParentPath(fieldPath); |
64 |
|
|
65 |
0
|
QueryPath qPath = QueryPath.parse(fieldPath); |
66 |
0
|
Data data = null; |
67 |
0
|
if(model!=null){ |
68 |
0
|
data = model.get(qPath); |
69 |
|
} |
70 |
|
|
71 |
0
|
if (data != null) { |
72 |
0
|
Iterator<Property> itr = data.iterator(); |
73 |
0
|
while (itr.hasNext()) { |
74 |
0
|
Property p = (Property) itr.next(); |
75 |
|
|
76 |
0
|
if (p.getKey() instanceof Integer && !isItemDeleted(model, path, (Integer)p.getKey(), mg)) { |
77 |
0
|
MultiplicityGroupItem mgi = mg.createItem(); |
78 |
0
|
mgi.setCreated(false); |
79 |
0
|
mgi.setItemKey((Integer) p.getKey()); |
80 |
0
|
MultiplicityGroupItemBinding.INSTANCE.setWidgetValue(mgi, model, fieldPath); |
81 |
|
} else { |
82 |
0
|
mg.incrementItemKey(); |
83 |
|
} |
84 |
|
} |
85 |
|
} |
86 |
|
} |
87 |
|
|
88 |
|
|
89 |
|
|
90 |
|
|
91 |
|
@param |
92 |
|
@param |
93 |
|
@param |
94 |
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 3 |
Complexity Density: 0.38 |
|
95 |
0
|
public boolean isItemDeleted(DataModel model, String path, Integer index, MultiplicityGroup mcWidget){... |
96 |
0
|
boolean isDeleted = false; |
97 |
|
|
98 |
|
|
99 |
0
|
if (!mcWidget.getConfig().isUpdateable()) { |
100 |
|
|
101 |
0
|
QueryPath runtimeDeletedPath = QueryPath.concat(path, String.valueOf(index), MultiplicityGroupItemBinding.RT_DELETED); |
102 |
|
|
103 |
0
|
Boolean runtimeDeleted = model.get(runtimeDeletedPath); |
104 |
0
|
if (runtimeDeleted != null){ |
105 |
0
|
isDeleted = runtimeDeleted; |
106 |
|
} |
107 |
0
|
return isDeleted; |
108 |
|
} |
109 |
|
|
110 |
0
|
return isDeleted; |
111 |
|
} |
112 |
|
|
113 |
|
|
114 |
|
} |