1 package com.atlassian.plugins.rest.doclet.generators.schema.beans.permissionscheme;
2
3 import com.atlassian.rest.annotation.RestProperty;
4 import com.google.common.base.Objects;
5 import com.google.common.collect.ImmutableList;
6 import org.codehaus.jackson.annotate.JsonProperty;
7
8 import java.net.URI;
9 import java.util.ArrayList;
10 import java.util.List;
11
12 public final class PermissionSchemeBean
13 {
14 @JsonProperty
15 @RestProperty(scope = RestProperty.Scope.RESPONSE)
16 private String expand = "permissions";
17
18 @JsonProperty
19 @RestProperty(scope = RestProperty.Scope.RESPONSE)
20 private Long id;
21 @JsonProperty
22 @RestProperty(scope = RestProperty.Scope.RESPONSE)
23 private URI self;
24 @JsonProperty
25 private String name;
26 @JsonProperty
27 private String description;
28 @JsonProperty
29 private List<PermissionGrantBean> permissions;
30
31 @Deprecated
32 public PermissionSchemeBean() {}
33
34 private PermissionSchemeBean(final Long id, final URI self, final String name, final String description, final Iterable<PermissionGrantBean> permissions)
35 {
36 this.id = id;
37 this.self = self;
38 this.name = name;
39 this.description = description;
40 this.permissions = permissions != null ? ImmutableList.copyOf(permissions) : null;
41 }
42
43
44
45
46
47 public PermissionSchemeBean input() {
48 this.expand = null;
49 return this;
50 }
51
52 public Long getId()
53 {
54 return id;
55 }
56
57 public void setId(final Long id)
58 {
59 this.id = id;
60 }
61
62 public URI getSelf()
63 {
64 return self;
65 }
66
67 public void setSelf(final URI self)
68 {
69 this.self = self;
70 }
71
72 public String getName()
73 {
74 return name;
75 }
76
77 public void setName(final String name)
78 {
79 this.name = name;
80 }
81
82 public String getDescription()
83 {
84 return description;
85 }
86
87 public void setDescription(final String description)
88 {
89 this.description = description;
90 }
91
92 public List<PermissionGrantBean> getPermissions()
93 {
94 return permissions;
95 }
96
97 public void setPermissions(final ArrayList<PermissionGrantBean> permissions)
98 {
99 this.permissions = permissions;
100 }
101
102 public String getExpand()
103 {
104 return expand;
105 }
106
107 @Override
108 public boolean equals(Object o)
109 {
110 if (this == o) { return true; }
111 if (o == null || getClass() != o.getClass()) { return false; }
112
113 PermissionSchemeBean that = (PermissionSchemeBean) o;
114
115 return Objects.equal(this.id, that.id) &&
116 Objects.equal(this.self, that.self) &&
117 Objects.equal(this.name, that.name) &&
118 Objects.equal(this.description, that.description) &&
119 Objects.equal(this.permissions, that.permissions);
120 }
121
122 @Override
123 public int hashCode()
124 {
125 return Objects.hashCode(id, self, name, description, permissions);
126 }
127
128 public static Builder builder()
129 {
130 return new Builder();
131 }
132
133 public static class Builder
134 {
135 private Long id;
136 private URI self;
137 private String name;
138 private String description;
139 private Iterable<PermissionGrantBean> permissions;
140
141 private Builder() {}
142
143 public Builder setId(final Long id)
144 {
145 this.id = id;
146 return this;
147 }
148
149 public Builder setSelf(final URI self)
150 {
151 this.self = self;
152 return this;
153 }
154
155 public Builder setName(final String name)
156 {
157 this.name = name;
158 return this;
159 }
160
161 public Builder setDescription(final String description)
162 {
163 this.description = description;
164 return this;
165 }
166
167 public Builder setPermissions(final Iterable<PermissionGrantBean> permissions)
168 {
169 this.permissions = permissions;
170 return this;
171 }
172
173 public PermissionSchemeBean build()
174 {
175 return new PermissionSchemeBean(id, self, name, description, permissions);
176 }
177 }
178 }