gICS_2.8.6
ConsentStatus.java
1 package org.emau.icmvc.ganimed.ttp.cm2.dto.enums;
2 
3 import java.util.ArrayList;
4 import java.util.List;
5 
6 /*
7  * ###license-information-start###
8  * gICS - a Generic Informed Consent Service
9  * __
10  * Copyright (C) 2014 - 2018 The MOSAIC Project - Institut fuer Community
11  * Medicine of the University Medicine Greifswald -
12  * mosaic-projekt@uni-greifswald.de
13  *
14  * concept and implementation
15  * l.geidel
16  * web client
17  * a.blumentritt, m.bialke
18  *
19  * Selected functionalities of gICS were developed as part of the MAGIC Project (funded by the DFG HO 1937/5-1).
20  *
21  * please cite our publications
22  * http://dx.doi.org/10.3414/ME14-01-0133
23  * http://dx.doi.org/10.1186/s12967-015-0545-6
24  * http://dx.doi.org/10.3205/17gmds146
25  * __
26  * This program is free software: you can redistribute it and/or modify
27  * it under the terms of the GNU Affero General Public License as published by
28  * the Free Software Foundation, either version 3 of the License, or
29  * (at your option) any later version.
30  *
31  * This program is distributed in the hope that it will be useful,
32  * but WITHOUT ANY WARRANTY; without even the implied warranty of
33  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
34  * GNU General Public License for more details.
35  *
36  * You should have received a copy of the GNU Affero General Public License
37  * along with this program. If not, see <http://www.gnu.org/licenses/>.
38  * ###license-information-end###
39  */
40 
47 public enum ConsentStatus {
48  // achtung! zusaetzliche werte unbedingt am ende einfuegen - wird in der db als ordinal gespeichert
49  ACCEPTED(ConsentStatusType.ACCEPTED), DECLINED(ConsentStatusType.DECLINED), UNKNOWN(ConsentStatusType.UNKNOWN), NOT_ASKED(
50  ConsentStatusType.UNKNOWN), NOT_CHOOSEN(ConsentStatusType.UNKNOWN), REVOKED(ConsentStatusType.DECLINED), INVALIDATED(
51  ConsentStatusType.DECLINED), REFUSED(ConsentStatusType.UNKNOWN), EXPIRED(ConsentStatusType.UNKNOWN);
52 
53  private final ConsentStatusType csType;
54 
55  private ConsentStatus(ConsentStatusType csType) {
56  this.csType = csType;
57  }
58 
59  public ConsentStatusType getConsentStatusType() {
60  return csType;
61  }
62 
63  public static List<ConsentStatus> getAllConsentStatusForType(ConsentStatusType csType) {
64  List<ConsentStatus> result = new ArrayList<ConsentStatus>();
65  for (ConsentStatus cs : values()) {
66  if (cs.getConsentStatusType().equals(csType)) {
67  result.add(cs);
68  }
69  }
70  return result;
71  }
72 
73  public static String getStringForType(ConsentStatusType csType) {
74  StringBuilder sb = new StringBuilder("[");
75  List<ConsentStatus> csList = getAllConsentStatusForType(csType);
76  if (!csList.isEmpty()) {
77  sb.append(csList.get(0).name());
78  for (int i = 1; i < csList.size(); i++) {
79  sb.append(", ");
80  sb.append(csList.get(i).name());
81  }
82  }
83  sb.append("]");
84  return sb.toString();
85  }
86 }
wie wurde ein modul (und damit die enthaltenen policies) innerhalb eines consents konsentiert...
ordnet die verschiedenen status nach "zugestimmt", "verweigert" und "unbekannt" see ConsentStatus ...