gICS_2.8.6
PolicyKeyDTO.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 
39 import java.io.Serializable;
40 
47 public class PolicyKeyDTO implements Serializable {
48 
49  private static final long serialVersionUID = 4680960399240307137L;
50  private String domainName;
51  private String name;
52  private String version;
53 
54  public PolicyKeyDTO() {
55  }
56 
57  public PolicyKeyDTO(String domainName, String name, String version) {
58  super();
59  this.domainName = domainName;
60  this.name = name;
61  this.version = version;
62  }
63 
64  public String getDomainName() {
65  return domainName;
66  }
67 
68  public void setDomainName(String domainName) {
69  this.domainName = domainName;
70  }
71 
72  public String getName() {
73  return name;
74  }
75 
76  public void setName(String name) {
77  this.name = name;
78  }
79 
80  public String getVersion() {
81  return version;
82  }
83 
84  public void setVersion(String version) {
85  this.version = version;
86  }
87 
88  @Override
89  public int hashCode() {
90  final int prime = 31;
91  int result = 1;
92  result = prime * result + ((domainName == null) ? 0 : domainName.hashCode());
93  result = prime * result + ((name == null) ? 0 : name.hashCode());
94  result = prime * result + ((version == null) ? 0 : version.hashCode());
95  return result;
96  }
97 
98  @Override
99  public boolean equals(Object obj) {
100  if (this == obj)
101  return true;
102  if (obj == null)
103  return false;
104  if (getClass() != obj.getClass())
105  return false;
106  PolicyKeyDTO other = (PolicyKeyDTO) obj;
107  if (domainName == null) {
108  if (other.domainName != null)
109  return false;
110  } else if (!domainName.equals(other.domainName))
111  return false;
112  if (name == null) {
113  if (other.name != null)
114  return false;
115  } else if (!name.equals(other.name))
116  return false;
117  if (version == null) {
118  if (other.version != null)
119  return false;
120  } else if (!version.equals(other.version))
121  return false;
122  return true;
123  }
124 
125  @Override
126  public String toString() {
127  final StringBuilder sb = new StringBuilder();
128  sb.append("policy with name '");
129  sb.append(name);
130  sb.append("' for domain '");
131  sb.append(domainName);
132  sb.append("' in version ");
133  sb.append(version);
134  return sb.toString();
135  }
136 }