1 package org.splat.service.dto;
5 * @author Daniel Brunier-Coulin
6 * @copyright OPEN CASCADE 2012-2014
9 import java.text.DecimalFormat;
10 import java.util.ArrayList;
11 import java.util.Date;
12 import java.util.List;
14 import org.splat.dal.bo.som.ProgressState;
15 import org.splat.som.Step;
18 * DTO for an open knowledge element.
20 public class KnowledgeElementDTO {
27 * User extendable knowledge type.
29 private KnowledgeElementTypeDTO _type;
31 * Knowledge element progress state.
33 private ProgressState _progressState;
37 private String _title;
41 private String _value;
45 private UserDTO _author;
47 * Knowledge modification date.
51 * Study steps involving this knowledge.
53 private transient final List<Step> _involving = new ArrayList<Step>();
57 private String _studyTitle;
59 * Parent scenario title.
61 private String _scenarioTitle;
64 * Default constructor.
66 public KnowledgeElementDTO() {
71 * Constructor with fields values.
74 * knowledge element primary key
80 public KnowledgeElementDTO(final long index, final String title,
88 * Compare this knowledge element with the given one.
91 * the knowledge element to compare to
92 * @return true if knowledge elements are equal
94 public boolean equals(final KnowledgeElementDTO given) { // NOPMD: RKV: TODO: to be refined
95 return (this.getType().equals(given.getType()) && this.getValue()
96 .equals(given.getValue()));
100 * Get knowledge author.
102 * @return the author as user DTO
104 public UserDTO getAuthor() {
109 * Get knowledge modification date.
111 * @return the modification date
113 public Date getDate() {
118 * Get knowledge progress state.
120 * @return the knowledge state
122 public ProgressState getProgressState() {
123 return _progressState;
127 * Get knowledge title.
131 public String getTitle() {
136 * Get knowledge reference.
138 * @return the reference
140 public String getReference() {
141 DecimalFormat toString = new DecimalFormat("00000"); // Supports 99 999 knowledge elements
142 return "KE" + toString.format(this.getIndex());
146 * Get knowledge type.
148 * @return the knowledge type
150 public KnowledgeElementTypeDTO getType() {
155 * Get knowledge text.
157 * @return the knowledge text
159 public String getValue() {
164 * Set a status of this knowledge.
167 * knowledge element progress state to set
169 public void setProgressState(final ProgressState aState) {
170 _progressState = aState;
174 * Set a title of the knowledge.
179 public void setTitle(final String aTitle) {
189 public void setValue(final String value) {
194 * Get list of involving steps.
196 * @return list of steps
198 public List<Step> getInvolving() {
203 * Get title of the parent study.
205 * @return study title
207 public String getStudyTitle() {
212 * Get title of the parent scenario.
214 * @return scenario title
216 public String getScenarioTitle() {
217 return _scenarioTitle;
225 public long getIndex() {
235 public void setIndex(final long rid) {
240 * Set the studyTitle.
243 * the studyTitle to set
245 public void setStudyTitle(final String studyTitle) {
246 this._studyTitle = studyTitle;
250 * Set the scenarioTitle.
252 * @param scenarioTitle
253 * the scenarioTitle to set
255 public void setScenarioTitle(final String scenarioTitle) {
256 this._scenarioTitle = scenarioTitle;
265 public void setType(final KnowledgeElementTypeDTO type) {
275 public void setAuthor(final UserDTO author) {
276 this._author = author;
285 public void setDate(final Date date) {