1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.web.bind;
17
18 import org.kuali.rice.krad.uif.view.ViewModel;
19 import org.springframework.beans.BeanWrapper;
20 import org.springframework.util.Assert;
21 import org.springframework.validation.BeanPropertyBindingResult;
22
23 import java.util.ArrayList;
24 import java.util.Collections;
25 import java.util.HashSet;
26 import java.util.List;
27 import java.util.Set;
28
29
30
31
32
33
34 public class UifBeanPropertyBindingResult extends BeanPropertyBindingResult {
35 private static final long serialVersionUID = -3740046436620585003L;
36
37 private final Set<String> modifiedPaths = new HashSet<String>();
38
39 private boolean changeTracking = false;
40
41 public UifBeanPropertyBindingResult(Object target, String objectName, boolean autoGrowNestedPaths,
42 int autoGrowCollectionLimit) {
43 super(target, objectName, autoGrowNestedPaths, autoGrowCollectionLimit);
44 }
45
46
47
48
49
50
51 @Override
52 protected UifViewBeanWrapper createBeanWrapper() {
53 Assert.state(super.getTarget() != null,
54 "Cannot access properties on null bean instance '" + getObjectName() + "'!");
55 Assert.state(super.getTarget() instanceof ViewModel,
56 "Object must be instance of ViewModel to use Uif Bean Wrapper");
57
58 return new UifViewBeanWrapper((ViewModel) super.getTarget(), this);
59 }
60
61 public Set<String> getModifiedPaths() {
62 return Collections.unmodifiableSet(this.modifiedPaths);
63 }
64
65 public void addModifiedPath(String path) {
66 this.modifiedPaths.add(path);
67 }
68
69 public boolean isChangeTracking() {
70 return changeTracking;
71 }
72
73 public void setChangeTracking(boolean changeTracking) {
74 this.changeTracking = changeTracking;
75 }
76
77 }