1 package org.splat.service.dto;
5 * @author Daniel Brunier-Coulin
6 * @copyright OPEN CASCADE 2012
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;
63 // ==============================================================================================================================
64 // Public member functions
65 // ==============================================================================================================================
68 * Compare this knowledge element with the given one.
71 * the knowledge element to compare to
72 * @return true if knowledge elements are equal
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()));
80 * Get knowledge author.
82 * @return the author as user DTO
84 public UserDTO getAuthor() {
89 * Get knowledge modification date.
91 * @return the modification date
93 public Date getDate() {
98 * Get knowledge progress state.
100 * @return the knowledge state
102 public ProgressState getProgressState() {
103 return _progressState;
107 * Get knowledge title.
111 public String getTitle() {
116 * Get knowledge reference.
118 * @return the reference
120 public String getReference() {
121 DecimalFormat toString = new DecimalFormat("00000"); // Supports 99 999 knowledge elements
122 return "KE" + toString.format(this.getIndex());
126 * Get knowledge type.
128 * @return the knowledge type
130 public KnowledgeElementTypeDTO getType() {
135 * Get knowledge text.
137 * @return the knowledge text
139 public String getValue() {
144 * Set a status of this knowledge.
147 * knowledge element progress state to set
149 public void setProgressState(final ProgressState aState) {
150 _progressState = aState;
154 * Set a title of the knowledge.
159 public void setTitle(final String aTitle) {
169 public void setValue(final String value) {
174 * Get list of involving steps.
176 * @return list of steps
178 public List<Step> getInvolving() {
183 * Get title of the parent study.
185 * @return study title
187 public String getStudyTitle() {
192 * Get title of the parent scenario.
194 * @return scenario title
196 public String getScenarioTitle() {
197 return _scenarioTitle;
205 public long getIndex() {
215 public void setIndex(final long rid) {
220 * Set the studyTitle.
223 * the studyTitle to set
225 public void setStudyTitle(final String studyTitle) {
226 this._studyTitle = studyTitle;
230 * Set the scenarioTitle.
232 * @param scenarioTitle
233 * the scenarioTitle to set
235 public void setScenarioTitle(final String scenarioTitle) {
236 this._scenarioTitle = scenarioTitle;
245 public void setType(final KnowledgeElementTypeDTO type) {
255 public void setAuthor(final UserDTO author) {
256 this._author = author;
265 public void setDate(final Date date) {