gICS_2.8.6
DomainDTO.java
1 package org.emau.icmvc.ganimed.ttp.cm2.dto;
2 
3 /*
4  * ###license-information-start###
5  * gICS - a Generic Informed Consent Service
6  * __
7  * Copyright (C) 2014 - 2018 The MOSAIC Project - Institut fuer Community
8  * Medicine of the University Medicine Greifswald -
9  * mosaic-projekt@uni-greifswald.de
10  *
11  * concept and implementation
12  * l.geidel
13  * web client
14  * a.blumentritt, m.bialke
15  *
16  * Selected functionalities of gICS were developed as part of the MAGIC Project (funded by the DFG HO 1937/5-1).
17  *
18  * please cite our publications
19  * http://dx.doi.org/10.3414/ME14-01-0133
20  * http://dx.doi.org/10.1186/s12967-015-0545-6
21  * http://dx.doi.org/10.3205/17gmds146
22  * __
23  * This program is free software: you can redistribute it and/or modify
24  * it under the terms of the GNU Affero General Public License as published by
25  * the Free Software Foundation, either version 3 of the License, or
26  * (at your option) any later version.
27  *
28  * This program is distributed in the hope that it will be useful,
29  * but WITHOUT ANY WARRANTY; without even the implied warranty of
30  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31  * GNU General Public License for more details.
32  *
33  * You should have received a copy of the GNU Affero General Public License
34  * along with this program. If not, see <http://www.gnu.org/licenses/>.
35  * ###license-information-end###
36  */
37 
38 import java.io.Serializable;
39 import java.util.Arrays;
40 import java.util.List;
41 
43 
53 public class DomainDTO implements Serializable {
54 
55  private static final long serialVersionUID = 9152603229919432413L;
56  private String name;
57  private String label;
58  private String ctVersionConverter;
59  private String moduleVersionConverter;
60  private String policyVersionConverter;
61  private String properties;
62  private String comment;
63  private String externProperties;
64  private String logo;
65  private List<String> signerIdTypes;
66 
67  public DomainDTO() {
68  }
69 
70  public DomainDTO(String name, String ctVersionConverter, String moduleVersionConverter, String policyVersionConverter,
71  List<String> signerIdTypes) {
72  super();
73  this.name = name;
74  this.ctVersionConverter = ctVersionConverter;
75  this.moduleVersionConverter = moduleVersionConverter;
76  this.policyVersionConverter = policyVersionConverter;
77  if (signerIdTypes != null) {
78  this.signerIdTypes = signerIdTypes;
79  }
80  }
81 
82  public DomainDTO(String name, String label, String ctVersionConverter, String moduleVersionConverter, String policyVersionConverter,
83  String properties, String comment, String externProperties, String logo, List<String> signerIdTypes) {
84  super();
85  this.name = name;
86  this.label = label;
87  this.ctVersionConverter = ctVersionConverter;
88  this.moduleVersionConverter = moduleVersionConverter;
89  this.policyVersionConverter = policyVersionConverter;
90  this.properties = properties;
91  this.comment = comment;
92  this.externProperties = externProperties;
93  this.logo = logo;
94  if (signerIdTypes != null) {
95  this.signerIdTypes = signerIdTypes;
96  }
97  }
98 
99  public String getName() {
100  return name;
101  }
102 
103  public void setName(String name) {
104  this.name = name;
105  }
106 
107  public String getLabel() {
108  return label;
109  }
110 
111  public void setLabel(String label) {
112  this.label = label;
113  }
114 
115  public String getCtVersionConverter() {
116  return ctVersionConverter;
117  }
118 
119  public void setCtVersionConverter(String ctVersionConverter) {
120  this.ctVersionConverter = ctVersionConverter;
121  }
122 
123  public String getModuleVersionConverter() {
124  return moduleVersionConverter;
125  }
126 
127  public void setModuleVersionConverter(String moduleVersionConverter) {
128  this.moduleVersionConverter = moduleVersionConverter;
129  }
130 
131  public String getPolicyVersionConverter() {
132  return policyVersionConverter;
133  }
134 
135  public void setPolicyVersionConverter(String policyVersionConverter) {
136  this.policyVersionConverter = policyVersionConverter;
137  }
138 
139  public String getProperty(String key) {
140  // check if key is valid
141  boolean found = false;
142  for (DomainProperties prop : Arrays.asList(DomainProperties.values())) {
143  if (key.equals(prop.toString())) {
144  found = true;
145  break;
146  }
147  }
148 
149  // check if key-value-pair is found in config
150  if (found) {
151  for (String pair : properties.split(";")) {
152  if (pair.contains(key)) {
153  return pair.split("=")[1].trim();
154  }
155  }
156  }
157  return null;
158  }
159 
160  public String getProperties() {
161  return properties;
162  }
163 
164  public void setProperties(String properties) {
165  this.properties = properties;
166  }
167 
168  public String getComment() {
169  return comment;
170  }
171 
172  public void setComment(String comment) {
173  this.comment = comment;
174  }
175 
176  public String getExternProperties() {
177  return externProperties;
178  }
179 
180  public void setExternProperties(String externProperties) {
181  this.externProperties = externProperties;
182  }
183 
184  public String getLogo() {
185  return logo;
186  }
187 
188  public void setLogo(String logo) {
189  this.logo = logo;
190  }
191 
192  public List<String> getSignerIdTypes() {
193  return signerIdTypes;
194  }
195 
196  public void setSignerIdTypes(List<String> signerIdTypes) {
197  if (signerIdTypes != null) {
198  this.signerIdTypes = signerIdTypes;
199  }
200  }
201 
202  @Override
203  public int hashCode() {
204  final int prime = 31;
205  int result = 1;
206  result = prime * result + ((comment == null) ? 0 : comment.hashCode());
207  result = prime * result + ((ctVersionConverter == null) ? 0 : ctVersionConverter.hashCode());
208  result = prime * result + ((externProperties == null) ? 0 : externProperties.hashCode());
209  result = prime * result + ((logo == null) ? 0 : logo.hashCode());
210  result = prime * result + ((label == null) ? 0 : label.hashCode());
211  result = prime * result + ((moduleVersionConverter == null) ? 0 : moduleVersionConverter.hashCode());
212  result = prime * result + ((name == null) ? 0 : name.hashCode());
213  result = prime * result + ((policyVersionConverter == null) ? 0 : policyVersionConverter.hashCode());
214  result = prime * result + ((properties == null) ? 0 : properties.hashCode());
215  result = prime * result + ((signerIdTypes == null) ? 0 : signerIdTypes.hashCode());
216  return result;
217  }
218 
219  @Override
220  public boolean equals(Object obj) {
221  if (this == obj)
222  return true;
223  if (obj == null)
224  return false;
225  if (getClass() != obj.getClass())
226  return false;
227  DomainDTO other = (DomainDTO) obj;
228  if (comment == null) {
229  if (other.comment != null)
230  return false;
231  } else if (!comment.equals(other.comment))
232  return false;
233  if (ctVersionConverter == null) {
234  if (other.ctVersionConverter != null)
235  return false;
236  } else if (!ctVersionConverter.equals(other.ctVersionConverter))
237  return false;
238  if (externProperties == null) {
239  if (other.externProperties != null)
240  return false;
241  } else if (!externProperties.equals(other.externProperties))
242  return false;
243  if (logo == null) {
244  if (other.logo != null)
245  return false;
246  } else if (!logo.equals(other.logo))
247  return false;
248  if (label == null) {
249  if (other.label != null)
250  return false;
251  } else if (!label.equals(other.label))
252  return false;
253  if (moduleVersionConverter == null) {
254  if (other.moduleVersionConverter != null)
255  return false;
256  } else if (!moduleVersionConverter.equals(other.moduleVersionConverter))
257  return false;
258  if (name == null) {
259  if (other.name != null)
260  return false;
261  } else if (!name.equals(other.name))
262  return false;
263  if (policyVersionConverter == null) {
264  if (other.policyVersionConverter != null)
265  return false;
266  } else if (!policyVersionConverter.equals(other.policyVersionConverter))
267  return false;
268  if (properties == null) {
269  if (other.properties != null)
270  return false;
271  } else if (!properties.equals(other.properties))
272  return false;
273  if (signerIdTypes == null) {
274  if (other.signerIdTypes != null)
275  return false;
276  } else if (!signerIdTypes.equals(other.signerIdTypes))
277  return false;
278  return true;
279  }
280 
281  @Override
282  public String toString() {
283  StringBuilder sb = new StringBuilder();
284  sb.append("domain with name '");
285  sb.append(name);
286  sb.append("', label '");
287  sb.append(label);
288  sb.append("', ct version converter '");
289  sb.append(ctVersionConverter);
290  sb.append("', module version converter '");
291  sb.append(moduleVersionConverter);
292  sb.append("', policy version converter '");
293  sb.append(policyVersionConverter);
294  sb.append("', comment '");
295  sb.append(comment);
296  sb.append("', extern properties '");
297  sb.append(externProperties);
298  sb.append("', the following properties: '");
299  sb.append(properties);
300  sb.append((logo != null && !logo.isEmpty()) ? ", a logo" : ", no logo");
301  sb.append("' and signerIdTypes:");
302  for (String signerIdType : signerIdTypes) {
303  sb.append(" '");
304  sb.append(signerIdType);
305  sb.append("'");
306  }
307  return sb.toString();
308  }
309 }
name - identifier label - label for the web-interface properties - semicolon separated key-value pa...
Definition: DomainDTO.java:53
possible properties for a consent domain