1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.syncope.common.lib.to;
20
21 import org.apache.commons.lang3.builder.EqualsBuilder;
22 import org.apache.commons.lang3.builder.HashCodeBuilder;
23 import org.apache.syncope.common.lib.BaseBean;
24
25 public class RelationshipTO implements BaseBean {
26
27 private static final long serialVersionUID = 360672942026613929L;
28
29 public static class Builder {
30
31 private final RelationshipTO instance = new RelationshipTO();
32
33 public Builder(final String type) {
34 instance.setType(type);
35 }
36
37 public Builder otherEnd(final String otherEndType, final String otherEndKey) {
38 instance.setOtherEndType(otherEndType);
39 instance.setOtherEndKey(otherEndKey);
40 return this;
41 }
42
43 public Builder otherEnd(final String otherEndType, final String otherEndKey, final String otherEndName) {
44 instance.setOtherEndType(otherEndType);
45 instance.setOtherEndKey(otherEndKey);
46 instance.setOtherEndName(otherEndName);
47 return this;
48 }
49
50 public RelationshipTO build() {
51 return instance;
52 }
53 }
54
55 private String type;
56
57 private String otherEndType;
58
59 private String otherEndKey;
60
61 private String otherEndName;
62
63 public String getType() {
64 return type;
65 }
66
67 public void setType(final String type) {
68 this.type = type;
69 }
70
71 public String getOtherEndType() {
72 return otherEndType;
73 }
74
75 public void setOtherEndType(final String otherEndType) {
76 this.otherEndType = otherEndType;
77 }
78
79 public String getOtherEndKey() {
80 return otherEndKey;
81 }
82
83 public void setOtherEndKey(final String otherEndKey) {
84 this.otherEndKey = otherEndKey;
85 }
86
87 public String getOtherEndName() {
88 return otherEndName;
89 }
90
91 public void setOtherEndName(final String otherEndName) {
92 this.otherEndName = otherEndName;
93 }
94
95 @Override
96 public int hashCode() {
97 return new HashCodeBuilder().
98 append(type).
99 append(otherEndType).
100 append(otherEndKey).
101 append(otherEndName).
102 build();
103 }
104
105 @Override
106 public boolean equals(final Object obj) {
107 if (this == obj) {
108 return true;
109 }
110 if (obj == null) {
111 return false;
112 }
113 if (getClass() != obj.getClass()) {
114 return false;
115 }
116 final RelationshipTO other = (RelationshipTO) obj;
117 return new EqualsBuilder().
118 append(type, other.type).
119 append(otherEndType, other.otherEndType).
120 append(otherEndKey, other.otherEndKey).
121 append(otherEndName, other.otherEndName).
122 build();
123 }
124 }