-
Notifications
You must be signed in to change notification settings - Fork 188
/
DeltaSetTripleType.java
116 lines (100 loc) · 3.31 KB
/
DeltaSetTripleType.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/*
* Copyright (c) 2019 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/
package com.evolveum.prism.xml.ns._public.types_3;
import com.evolveum.midpoint.prism.*;
import com.evolveum.midpoint.prism.delta.PrismValueDeltaSetTriple;
import com.evolveum.midpoint.prism.util.CloneUtil;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.namespace.QName;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* Experimental.
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "DeltaSetTripleType", propOrder = {
"zero",
"plus",
"minus"
})
public class DeltaSetTripleType implements Serializable, JaxbVisitable, Cloneable {
@XmlElement
@Raw
private final List<Object> zero = new ArrayList<>();
@XmlElement
@Raw
private final List<Object> plus = new ArrayList<>();
@XmlElement
@Raw
private final List<Object> minus = new ArrayList<>();
public final static QName COMPLEX_TYPE = new QName(PrismConstants.NS_TYPES, "DeltaSetTripleType");
public final static QName F_ZERO = new QName(PrismConstants.NS_TYPES, "zero");
public final static QName F_PLUS = new QName(PrismConstants.NS_TYPES, "plus");
public final static QName F_MINUS = new QName(PrismConstants.NS_TYPES, "minus");
public List<Object> getZero() {
return zero;
}
public List<Object> getPlus() {
return plus;
}
public List<Object> getMinus() {
return minus;
}
@Override
public void accept(JaxbVisitor visitor) {
visitor.visit(this);
visit(zero, visitor);
visit(plus, visitor);
visit(minus, visitor);
}
public void visit(List<Object> set, JaxbVisitor visitor) {
for (Object o : set) {
if (o instanceof JaxbVisitable) {
visitor.visit((JaxbVisitable) o);
}
}
}
@SuppressWarnings("MethodDoesntCallSuperMethod")
public DeltaSetTripleType clone() {
DeltaSetTripleType clone = new DeltaSetTripleType();
for (Object v : zero) {
clone.zero.add(CloneUtil.clone(v));
}
for (Object v : plus) {
clone.plus.add(CloneUtil.clone(v));
}
for (Object v : minus) {
clone.minus.add(CloneUtil.clone(v));
}
return clone;
}
@Override
public String toString() {
return "DeltaSetTripleType{" +
"zero=" + zero +
", plus=" + plus +
", minus=" + minus +
'}';
}
public static <V extends PrismValue> DeltaSetTripleType fromDeltaSetTriple(PrismValueDeltaSetTriple<V> triple, PrismContext prismContext) {
DeltaSetTripleType rv = new DeltaSetTripleType();
for (V v : triple.getZeroSet()) {
rv.zero.add(v.getRealValueOrRawType(prismContext));
}
for (V v : triple.getPlusSet()) {
rv.plus.add(v.getRealValueOrRawType(prismContext));
}
for (V v : triple.getMinusSet()) {
rv.minus.add(v.getRealValueOrRawType(prismContext));
}
return rv;
}
}