]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - org.argeo.jcr/src/org/argeo/jcr/PropertyDiff.java
3 import javax
.jcr
.Value
;
5 /** The result of the comparison of two JCR properties. */
6 public class PropertyDiff
{
7 public final static Integer MODIFIED
= 0;
8 public final static Integer ADDED
= 1;
9 public final static Integer REMOVED
= 2;
11 private final Integer type
;
12 private final String relPath
;
13 private final Value referenceValue
;
14 private final Value newValue
;
16 public PropertyDiff(Integer type
, String relPath
, Value referenceValue
, Value newValue
) {
19 if (type
== MODIFIED
) {
20 if (referenceValue
== null || newValue
== null)
21 throw new IllegalArgumentException("Reference and new values must be specified.");
22 } else if (type
== ADDED
) {
23 if (referenceValue
!= null || newValue
== null)
24 throw new IllegalArgumentException("New value and only it must be specified.");
25 } else if (type
== REMOVED
) {
26 if (referenceValue
== null || newValue
!= null)
27 throw new IllegalArgumentException("Reference value and only it must be specified.");
29 throw new IllegalArgumentException("Unkown diff type " + type
);
33 throw new IllegalArgumentException("Relative path must be specified");
36 this.relPath
= relPath
;
37 this.referenceValue
= referenceValue
;
38 this.newValue
= newValue
;
41 public Integer
getType() {
45 public String
getRelPath() {
49 public Value
getReferenceValue() {
50 return referenceValue
;
53 public Value
getNewValue() {