gICS_2.8.6
FreeTextDefDTO.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 FreeTextDefDTO implements Serializable {
49 
50  private static final long serialVersionUID = -5624268522251227994L;
51  private String name;
52  private boolean required;
53  private FreeTextType type;
54  private String converterString;
55  private int pos;
56  private String comment;
57 
58  public FreeTextDefDTO() {
59  }
60 
61  public FreeTextDefDTO(String name, boolean required, FreeTextType type, String converterString, int pos, String comment) {
62  super();
63  this.name = name;
64  this.required = required;
65  this.type = type;
66  this.converterString = converterString;
67  this.pos = pos;
68  this.comment = comment;
69  }
70 
71  public String getName() {
72  return name;
73  }
74 
75  public void setName(String name) {
76  this.name = name;
77  }
78 
79  public boolean getRequired() {
80  return required;
81  }
82 
83  public void setRequired(boolean required) {
84  this.required = required;
85  }
86 
87  public FreeTextType getType() {
88  return type;
89  }
90 
91  public void setType(FreeTextType type) {
92  this.type = type;
93  }
94 
95  public String getConverterString() {
96  return converterString;
97  }
98 
99  public void setConverterString(String converterString) {
100  this.converterString = converterString;
101  }
102 
103  public int getPos() {
104  return pos;
105  }
106 
107  public void setPos(int pos) {
108  this.pos = pos;
109  }
110 
111  public String getComment() {
112  return comment;
113  }
114 
115  public void setComment(String comment) {
116  this.comment = comment;
117  }
118 
119  @Override
120  public int hashCode() {
121  final int prime = 31;
122  int result = 1;
123  result = prime * result + ((comment == null) ? 0 : comment.hashCode());
124  result = prime * result + ((converterString == null) ? 0 : converterString.hashCode());
125  result = prime * result + ((name == null) ? 0 : name.hashCode());
126  result = prime * result + pos;
127  result = prime * result + (required ? 1231 : 1237);
128  result = prime * result + ((type == null) ? 0 : type.hashCode());
129  return result;
130  }
131 
132  @Override
133  public boolean equals(Object obj) {
134  if (this == obj)
135  return true;
136  if (obj == null)
137  return false;
138  if (getClass() != obj.getClass())
139  return false;
140  FreeTextDefDTO other = (FreeTextDefDTO) obj;
141  if (comment == null) {
142  if (other.comment != null)
143  return false;
144  } else if (!comment.equals(other.comment))
145  return false;
146  if (converterString == null) {
147  if (other.converterString != null)
148  return false;
149  } else if (!converterString.equals(other.converterString))
150  return false;
151  if (name == null) {
152  if (other.name != null)
153  return false;
154  } else if (!name.equals(other.name))
155  return false;
156  if (pos != other.pos)
157  return false;
158  if (required != other.required)
159  return false;
160  if (type != other.type)
161  return false;
162  return true;
163  }
164 
165  @Override
166  public String toString() {
167  StringBuilder sb = new StringBuilder();
168  sb.append("FreeTextDTO with name '");
169  sb.append(name);
170  sb.append("', comment '");
171  sb.append(comment);
172  sb.append("' type '");
173  sb.append((type == null) ? "null" : type.toString());
174  sb.append("' converter string '");
175  sb.append(converterString);
176  sb.append("' at pos ");
177  sb.append(pos);
178  sb.append(" which value is ");
179  sb.append(required ? "" : "not ");
180  sb.append("required within a consent");
181  return sb.toString();
182  }
183 }
data type of a free text field of a consent template if extended please pay attention to occurences ...