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.request;
20
21 import java.util.Collection;
22 import javax.ws.rs.PathParam;
23 import org.apache.commons.lang3.builder.EqualsBuilder;
24 import org.apache.commons.lang3.builder.HashCodeBuilder;
25 import org.apache.syncope.common.lib.types.ResourceAssociationAction;
26
27
28
29
30 public class ResourceAR extends PasswordPatch {
31
32 private static final long serialVersionUID = 6295778399633883767L;
33
34 public static class Builder extends PasswordPatch.Builder {
35
36 @Override
37 protected ResourceAR newInstance() {
38 return new ResourceAR();
39 }
40
41 @Override
42 protected ResourceAR getInstance() {
43 return (ResourceAR) super.getInstance();
44 }
45
46 @Override
47 public ResourceAR build() {
48 return (ResourceAR) super.build();
49 }
50
51 @Override
52 public Builder onSyncope(final boolean onSyncope) {
53 return (Builder) super.onSyncope(onSyncope);
54 }
55
56 @Override
57 public Builder resource(final String resource) {
58 return (Builder) super.resource(resource);
59 }
60
61 @Override
62 public Builder resources(final Collection<String> resources) {
63 return (Builder) super.resources(resources);
64 }
65
66 @Override
67 public Builder resources(final String... resources) {
68 return (Builder) super.resources(resources);
69 }
70
71 @Override
72 public Builder value(final String value) {
73 return (Builder) super.value(value);
74 }
75
76 public Builder key(final String key) {
77 getInstance().setKey(key);
78 return this;
79 }
80
81 public Builder action(final ResourceAssociationAction action) {
82 getInstance().setAction(action);
83 return this;
84 }
85 }
86
87 private String key;
88
89 private ResourceAssociationAction action;
90
91 public String getKey() {
92 return key;
93 }
94
95 @PathParam("key")
96 public void setKey(final String key) {
97 this.key = key;
98 }
99
100 public ResourceAssociationAction getAction() {
101 return action;
102 }
103
104 @PathParam("action")
105 public void setAction(final ResourceAssociationAction action) {
106 this.action = action;
107 }
108
109 @Override
110 public int hashCode() {
111 return new HashCodeBuilder().
112 appendSuper(super.hashCode()).
113 append(key).
114 append(action).
115 build();
116 }
117
118 @Override
119 public boolean equals(final Object obj) {
120 if (this == obj) {
121 return true;
122 }
123 if (obj == null) {
124 return false;
125 }
126 if (getClass() != obj.getClass()) {
127 return false;
128 }
129 final ResourceAR other = (ResourceAR) obj;
130 return new EqualsBuilder().
131 appendSuper(super.equals(obj)).
132 append(key, other.key).
133 append(action, other.action).
134 build();
135 }
136 }