]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - PropertyDiff.java
3c43e52b3c3228c025cdef2376da1c4c0015a2f7
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
,
20 if (type
== MODIFIED
) {
21 if (referenceValue
== null || newValue
== null)
22 throw new ArgeoJcrException(
23 "Reference and new values must be specified.");
24 } else if (type
== ADDED
) {
25 if (referenceValue
!= null || newValue
== null)
26 throw new ArgeoJcrException(
27 "New value and only it must be specified.");
28 } else if (type
== REMOVED
) {
29 if (referenceValue
== null || newValue
!= null)
30 throw new ArgeoJcrException(
31 "Reference value and only it must be specified.");
33 throw new ArgeoJcrException("Unkown diff type " + type
);
37 throw new ArgeoJcrException("Relative path must be specified");
40 this.relPath
= relPath
;
41 this.referenceValue
= referenceValue
;
42 this.newValue
= newValue
;
45 public Integer
getType() {
49 public String
getRelPath() {
53 public Value
getReferenceValue() {
54 return referenceValue
;
57 public Value
getNewValue() {