Salome HOME
PMD plugin is refreshed. Some code is modified to respect PMD rules. Ant build proced...
[tools/siman.git] / Workspace / Siman-Common / src / org / splat / service / dto / KnowledgeElementDTO.java
1 package org.splat.service.dto;
2
3 /**
4  * 
5  * @author    Daniel Brunier-Coulin
6  * @copyright OPEN CASCADE 2012
7  */
8
9 import java.text.DecimalFormat;
10 import java.util.ArrayList;
11 import java.util.Date;
12 import java.util.List;
13
14 import org.splat.dal.bo.som.ProgressState;
15 import org.splat.som.Step;
16
17 /**
18  * DTO for an open knowledge element.
19  */
20 public class KnowledgeElementDTO {
21
22         /**
23          * Primary key.
24          */
25         private long _index;
26         /**
27          * User extendable knowledge type.
28          */
29         private KnowledgeElementTypeDTO _type;
30         /**
31          * Knowledge element progress state.
32          */
33         private ProgressState _progressState;
34         /**
35          * Knowledge title.
36          */
37         private String _title;
38         /**
39          * Knowledge text.
40          */
41         private String _value;
42         /**
43          * Knowledge author.
44          */
45         private UserDTO _author;
46         /**
47          * Knowledge modification date.
48          */
49         private Date _date;
50         /**
51          * Study steps involving this knowledge.
52          */
53         private transient final List<Step> _involving = new ArrayList<Step>();
54         /**
55          * Parent study title.
56          */
57         private String _studyTitle;
58         /**
59          * Parent scenario title.
60          */
61         private String _scenarioTitle;
62
63         // ==============================================================================================================================
64         // Public member functions
65         // ==============================================================================================================================
66
67         /**
68          * Compare this knowledge element with the given one.
69          * 
70          * @param given
71          *            the knowledge element to compare to
72          * @return true if knowledge elements are equal
73          */
74         public boolean equals(final KnowledgeElementDTO given) { //NOPMD: RKV: TODO: to be refined
75                 return (this.getType().equals(given.getType()) && this.getValue()
76                                 .equals(given.getValue()));
77         }
78
79         /**
80          * Get knowledge author.
81          * 
82          * @return the author as user DTO
83          */
84         public UserDTO getAuthor() {
85                 return _author;
86         }
87
88         /**
89          * Get knowledge modification date.
90          * 
91          * @return the modification date
92          */
93         public Date getDate() {
94                 return _date;
95         }
96
97         /**
98          * Get knowledge progress state.
99          * 
100          * @return the knowledge state
101          */
102         public ProgressState getProgressState() {
103                 return _progressState;
104         }
105
106         /**
107          * Get knowledge title.
108          * 
109          * @return the title
110          */
111         public String getTitle() {
112                 return _title;
113         }
114
115         /**
116          * Get knowledge reference.
117          * 
118          * @return the reference
119          */
120         public String getReference() {
121                 DecimalFormat toString = new DecimalFormat("00000"); // Supports 99 999 knowledge elements
122                 return "KE" + toString.format(this.getIndex());
123         }
124
125         /**
126          * Get knowledge type.
127          * 
128          * @return the knowledge type
129          */
130         public KnowledgeElementTypeDTO getType() {
131                 return _type;
132         }
133
134         /**
135          * Get knowledge text.
136          * 
137          * @return the knowledge text
138          */
139         public String getValue() {
140                 return _value;
141         }
142
143         /**
144          * Set a status of this knowledge.
145          * 
146          * @param aState
147          *            knowledge element progress state to set
148          */
149         public void setProgressState(final ProgressState aState) {
150                 _progressState = aState;
151         }
152
153         /**
154          * Set a title of the knowledge.
155          * 
156          * @param aTitle
157          *            a title to set
158          */
159         public void setTitle(final String aTitle) {
160                 _title = aTitle;
161         }
162
163         /**
164          * Set the value.
165          * 
166          * @param value
167          *            the value to set
168          */
169         public void setValue(final String value) {
170                 this._value = value;
171         }
172
173         /**
174          * Get list of involving steps.
175          * 
176          * @return list of steps
177          */
178         public List<Step> getInvolving() {
179                 return _involving;
180         }
181
182         /**
183          * Get title of the parent study.
184          * 
185          * @return study title
186          */
187         public String getStudyTitle() {
188                 return _studyTitle;
189         }
190
191         /**
192          * Get title of the parent scenario.
193          * 
194          * @return scenario title
195          */
196         public String getScenarioTitle() {
197                 return _scenarioTitle;
198         }
199
200         /**
201          * Get the rid.
202          * 
203          * @return the rid
204          */
205         public long getIndex() {
206                 return _index;
207         }
208
209         /**
210          * Set the rid.
211          * 
212          * @param rid
213          *            the rid to set
214          */
215         public void setIndex(final long rid) {
216                 this._index = rid;
217         }
218
219         /**
220          * Set the studyTitle.
221          * 
222          * @param studyTitle
223          *            the studyTitle to set
224          */
225         public void setStudyTitle(final String studyTitle) {
226                 this._studyTitle = studyTitle;
227         }
228
229         /**
230          * Set the scenarioTitle.
231          * 
232          * @param scenarioTitle
233          *            the scenarioTitle to set
234          */
235         public void setScenarioTitle(final String scenarioTitle) {
236                 this._scenarioTitle = scenarioTitle;
237         }
238
239         /**
240          * Set the type.
241          * 
242          * @param type
243          *            the type to set
244          */
245         public void setType(final KnowledgeElementTypeDTO type) {
246                 this._type = type;
247         }
248
249         /**
250          * Set the author.
251          * 
252          * @param author
253          *            the author to set
254          */
255         public void setAuthor(final UserDTO author) {
256                 this._author = author;
257         }
258
259         /**
260          * Set the date.
261          * 
262          * @param date
263          *            the date to set
264          */
265         public void setDate(final Date date) {
266                 this._date = date;
267         }
268 }