gICS_2.8.6
ConsentTemplateStructureDTO.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.ArrayList;
40 import java.util.HashMap;
41 import java.util.List;
42 import java.util.Map;
43 
50 public class ConsentTemplateStructureDTO implements Serializable {
51 
52  private static final long serialVersionUID = -225883360204639462L;
53  private List<ModuleKeyDTO> firstLevelModules = new ArrayList<ModuleKeyDTO>();
54  private Map<ModuleKeyDTO, ArrayList<ModuleKeyDTO>> children = new HashMap<ModuleKeyDTO, ArrayList<ModuleKeyDTO>>();
55 
57  }
58 
59  public List<ModuleKeyDTO> getFirstLevelModules() {
60  return firstLevelModules;
61  }
62 
63  public void setFirstLevelModules(List<ModuleKeyDTO> firstLevelModules) {
64  if (firstLevelModules != null) {
65  this.firstLevelModules = firstLevelModules;
66  }
67  }
68 
69  public Map<ModuleKeyDTO, ArrayList<ModuleKeyDTO>> getChildren() {
70  return children;
71  }
72 
73  public void setChildren(Map<ModuleKeyDTO, ArrayList<ModuleKeyDTO>> children) {
74  if (children != null) {
75  this.children = children;
76  }
77  }
78 
79  @Override
80  public int hashCode() {
81  final int prime = 31;
82  int result = 1;
83  result = prime * result + ((children == null) ? 0 : children.hashCode());
84  result = prime * result + ((firstLevelModules == null) ? 0 : firstLevelModules.hashCode());
85  return result;
86  }
87 
88  @Override
89  public boolean equals(Object obj) {
90  if (this == obj)
91  return true;
92  if (obj == null)
93  return false;
94  if (getClass() != obj.getClass())
95  return false;
97  if (children == null) {
98  if (other.children != null)
99  return false;
100  } else if (!children.equals(other.children))
101  return false;
102  if (firstLevelModules == null) {
103  if (other.firstLevelModules != null)
104  return false;
105  } else if (!firstLevelModules.equals(other.firstLevelModules))
106  return false;
107  return true;
108  }
109 
110  @Override
111  public String toString() {
112  StringBuilder sb = new StringBuilder();
113  sb.append("ConsentTemplateStructureDTO with ");
114  sb.append(firstLevelModules.size());
115  sb.append(" first level modules");
116  return sb.toString();
117  }
118 }