]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - server/runtime/org.argeo.server.jcr/src/main/java/org/argeo/jcr/PropertyDiff.java
67e5d8ac67d28b52a01be8e1c6317b54c878e040
3 import javax
.jcr
.Value
;
5 import org
.argeo
.ArgeoException
;
7 /** The result of the comparison of two JCR properties. */
8 public class PropertyDiff
{
9 public final static Integer MODIFIED
= 0;
10 public final static Integer ADDED
= 1;
11 public final static Integer REMOVED
= 2;
13 private final Integer type
;
14 private final String relPath
;
15 private final Value referenceValue
;
16 private final Value newValue
;
18 public PropertyDiff(Integer type
, String relPath
, Value referenceValue
,
22 if (type
== MODIFIED
) {
23 if (referenceValue
== null || newValue
== null)
24 throw new ArgeoException(
25 "Reference and new values must be specified.");
26 } else if (type
== ADDED
) {
27 if (referenceValue
!= null || newValue
== null)
28 throw new ArgeoException(
29 "New value and only it must be specified.");
30 } else if (type
== REMOVED
) {
31 if (referenceValue
== null || newValue
!= null)
32 throw new ArgeoException(
33 "Reference value and only it must be specified.");
35 throw new ArgeoException("Unkown diff type " + type
);
39 throw new ArgeoException("Relative path must be specified");
42 this.relPath
= relPath
;
43 this.referenceValue
= referenceValue
;
44 this.newValue
= newValue
;
47 public Integer
getType() {
51 public String
getRelPath() {
55 public Value
getReferenceValue() {
56 return referenceValue
;
59 public Value
getNewValue() {