1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package com.xpn.xwiki.objects; |
21 |
|
|
22 |
|
import org.xwiki.model.reference.DocumentReference; |
23 |
|
import org.xwiki.model.reference.DocumentReferenceResolver; |
24 |
|
import org.xwiki.model.reference.EntityReferenceSerializer; |
25 |
|
|
26 |
|
import com.xpn.xwiki.web.Utils; |
27 |
|
|
|
|
| 59.7% |
Uncovered Elements: 29 (72) |
Complexity: 24 |
Complexity Density: 0.52 |
|
28 |
|
public class ObjectDiff |
29 |
|
{ |
30 |
|
public static final String ACTION_PROPERTYADDED = "added"; |
31 |
|
|
32 |
|
public static final String ACTION_PROPERTYCHANGED = "changed"; |
33 |
|
|
34 |
|
public static final String ACTION_PROPERTYREMOVED = "removed"; |
35 |
|
|
36 |
|
public static final String ACTION_OBJECTADDED = "object-added"; |
37 |
|
|
38 |
|
public static final String ACTION_OBJECTREMOVED = "object-removed"; |
39 |
|
|
40 |
|
private DocumentReferenceResolver<String> currentDocumentReferenceResolver = Utils.getComponent( |
41 |
|
DocumentReferenceResolver.TYPE_STRING, "current"); |
42 |
|
|
43 |
|
private EntityReferenceSerializer<String> localEntityReferenceSerializer = Utils.getComponent( |
44 |
|
EntityReferenceSerializer.TYPE_STRING, "local"); |
45 |
|
|
46 |
|
private DocumentReference xClassReference; |
47 |
|
|
48 |
|
private int number; |
49 |
|
|
50 |
|
private String guid; |
51 |
|
|
52 |
|
private String propName; |
53 |
|
|
54 |
|
private String propType; |
55 |
|
|
56 |
|
private Object prevValue; |
57 |
|
|
58 |
|
private Object newValue; |
59 |
|
|
60 |
|
private String action; |
61 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
62 |
0 |
@Deprecated... |
63 |
|
public ObjectDiff(String className, int number, String action, String propName, Object prevValue, Object newValue) |
64 |
|
{ |
65 |
0 |
this(className, number, "", action, propName, "", prevValue, newValue); |
66 |
|
} |
67 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
|
68 |
0 |
@Deprecated... |
69 |
|
public ObjectDiff(String className, int number, String guid, String action, String propName, String propType, |
70 |
|
Object prevValue, Object newValue) |
71 |
|
{ |
72 |
0 |
this.setClassName(className); |
73 |
0 |
this.setNumber(number); |
74 |
0 |
this.setGuid(guid); |
75 |
0 |
this.setAction(action); |
76 |
0 |
this.setPropName(propName); |
77 |
0 |
this.setPropType(propType); |
78 |
0 |
this.setPrevValue(prevValue); |
79 |
0 |
this.setNewValue(newValue); |
80 |
|
} |
81 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
|
82 |
515 |
public ObjectDiff(DocumentReference xClassReference, int number, String guid, String action, String propName,... |
83 |
|
String propType, Object prevValue, Object newValue) |
84 |
|
{ |
85 |
515 |
this.setXClassReference(xClassReference); |
86 |
515 |
this.setNumber(number); |
87 |
515 |
this.setGuid(guid); |
88 |
515 |
this.setAction(action); |
89 |
515 |
this.setPropName(propName); |
90 |
515 |
this.setPropType(propType); |
91 |
515 |
this.setPrevValue(prevValue); |
92 |
515 |
this.setNewValue(newValue); |
93 |
|
} |
94 |
|
|
|
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
95 |
8 |
public String getClassName()... |
96 |
|
{ |
97 |
8 |
DocumentReference xClassReference = getXClassReference(); |
98 |
|
|
99 |
8 |
return xClassReference != null ? this.localEntityReferenceSerializer.serialize(getXClassReference()) : null; |
100 |
|
} |
101 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
102 |
0 |
public void setClassName(String className)... |
103 |
|
{ |
104 |
0 |
DocumentReference xClassReference = |
105 |
0 |
className != null ? this.currentDocumentReferenceResolver.resolve(className) : null; |
106 |
0 |
setXClassReference(xClassReference); |
107 |
|
} |
108 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
109 |
1384 |
public DocumentReference getXClassReference()... |
110 |
|
{ |
111 |
1384 |
return this.xClassReference; |
112 |
|
} |
113 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
114 |
515 |
public void setXClassReference(DocumentReference xClassReference)... |
115 |
|
{ |
116 |
515 |
this.xClassReference = xClassReference; |
117 |
|
} |
118 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
119 |
1372 |
public int getNumber()... |
120 |
|
{ |
121 |
1372 |
return this.number; |
122 |
|
} |
123 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
124 |
515 |
public void setNumber(int number)... |
125 |
|
{ |
126 |
515 |
this.number = number; |
127 |
|
} |
128 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
129 |
0 |
public String getGuid()... |
130 |
|
{ |
131 |
0 |
return this.guid; |
132 |
|
} |
133 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
134 |
515 |
public void setGuid(String guid)... |
135 |
|
{ |
136 |
515 |
this.guid = guid; |
137 |
|
} |
138 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
139 |
455 |
public String getPropName()... |
140 |
|
{ |
141 |
455 |
return this.propName; |
142 |
|
} |
143 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
144 |
515 |
public void setPropName(String propName)... |
145 |
|
{ |
146 |
515 |
this.propName = propName; |
147 |
|
} |
148 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
149 |
4 |
public String getPropType()... |
150 |
|
{ |
151 |
4 |
return this.propType; |
152 |
|
} |
153 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
154 |
515 |
public void setPropType(String propType)... |
155 |
|
{ |
156 |
515 |
this.propType = propType; |
157 |
|
} |
158 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
159 |
2 |
public Object getPrevValue()... |
160 |
|
{ |
161 |
2 |
return this.prevValue; |
162 |
|
} |
163 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
164 |
515 |
public void setPrevValue(Object prevValue)... |
165 |
|
{ |
166 |
515 |
this.prevValue = prevValue; |
167 |
|
} |
168 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
169 |
2 |
public Object getNewValue()... |
170 |
|
{ |
171 |
2 |
return this.newValue; |
172 |
|
} |
173 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
174 |
515 |
public void setNewValue(Object newValue)... |
175 |
|
{ |
176 |
515 |
this.newValue = newValue; |
177 |
|
} |
178 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
179 |
1811 |
public String getAction()... |
180 |
|
{ |
181 |
1811 |
return this.action; |
182 |
|
} |
183 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
184 |
515 |
public void setAction(String action)... |
185 |
|
{ |
186 |
515 |
this.action = action; |
187 |
|
} |
188 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 1 |
Complexity Density: 0.11 |
|
189 |
0 |
@Override... |
190 |
|
public String toString() |
191 |
|
{ |
192 |
0 |
StringBuilder buffer = new StringBuilder(); |
193 |
|
|
194 |
0 |
buffer.append(getClassName()); |
195 |
0 |
buffer.append("."); |
196 |
0 |
buffer.append(getPropName()); |
197 |
0 |
buffer.append(": "); |
198 |
0 |
buffer.append(getPrevValue().toString()); |
199 |
0 |
buffer.append(" \u21E8 "); |
200 |
0 |
buffer.append(getNewValue().toString()); |
201 |
|
|
202 |
0 |
return buffer.toString(); |
203 |
|
} |
204 |
|
} |