gICS_2.8.6
SignedPolicyDTO.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 
41 
48 public class SignedPolicyDTO implements Serializable {
49 
50  private static final long serialVersionUID = 6530761208022474879L;
51  private ConsentStatus status;
52  private PolicyKeyDTO policyKey;
53  private ConsentKeyDTO consentKey;
54 
55  public SignedPolicyDTO() {
56  }
57 
58  public SignedPolicyDTO(ConsentStatus status, PolicyKeyDTO policyKey, ConsentKeyDTO consentKey) {
59  super();
60  this.status = status;
61  this.policyKey = policyKey;
62  this.consentKey = consentKey;
63  }
64 
65  public ConsentStatus getStatus() {
66  return status;
67  }
68 
69  public void setStatus(ConsentStatus status) {
70  this.status = status;
71  }
72 
73  public PolicyKeyDTO getPolicyKey() {
74  return policyKey;
75  }
76 
77  public void setPolicyKey(PolicyKeyDTO policyKey) {
78  this.policyKey = policyKey;
79  }
80 
81  public ConsentKeyDTO getConsentKey() {
82  return consentKey;
83  }
84 
85  public void setConsentKey(ConsentKeyDTO consentKey) {
86  this.consentKey = consentKey;
87  }
88 
89  @Override
90  public int hashCode() {
91  final int prime = 31;
92  int result = 1;
93  result = prime * result + ((consentKey == null) ? 0 : consentKey.hashCode());
94  result = prime * result + ((policyKey == null) ? 0 : policyKey.hashCode());
95  result = prime * result + ((status == null) ? 0 : status.hashCode());
96  return result;
97  }
98 
99  @Override
100  public boolean equals(Object obj) {
101  if (this == obj)
102  return true;
103  if (obj == null)
104  return false;
105  if (getClass() != obj.getClass())
106  return false;
107  SignedPolicyDTO other = (SignedPolicyDTO) obj;
108  if (consentKey == null) {
109  if (other.consentKey != null)
110  return false;
111  } else if (!consentKey.equals(other.consentKey))
112  return false;
113  if (policyKey == null) {
114  if (other.policyKey != null)
115  return false;
116  } else if (!policyKey.equals(other.policyKey))
117  return false;
118  if (status != other.status)
119  return false;
120  return true;
121  }
122 
123  @Override
124  public String toString() {
125  StringBuffer sb = new StringBuffer();
126  sb.append("policy '");
127  sb.append(policyKey);
128  sb.append("' is signed with value: ");
129  sb.append((status == null) ? "'null'" : status.toString());
130  sb.append(" within consent '");
131  sb.append(consentKey);
132  sb.append("'");
133  return sb.toString();
134  }
135 }
wie wurde ein modul (und damit die enthaltenen policies) innerhalb eines consents konsentiert...
objekt fuer die m-n tabelle consent<->policy