Salome HOME
DTO is introduced for knowledge elements. BeanHelper is modified so that setters...
[tools/siman.git] / Workspace / Siman-Common / src / org / splat / service / dto / KnowledgeElementDTO.java
1 package org.splat.service.dto;
2 /**
3  * 
4  * @author    Daniel Brunier-Coulin
5  * @copyright OPEN CASCADE 2012
6  */
7
8 import java.text.DecimalFormat;
9 import java.util.Date;
10 import java.util.List;
11 import java.util.Vector;
12
13 import org.splat.dal.bo.som.ProgressState;
14 import org.splat.som.Step;
15
16
17 public class KnowledgeElementDTO {
18
19         private long                     rid;
20         private KnowledgeElementTypeDTO  type;     // User extendable types
21     private ProgressState            state;
22     private String                   title;
23     private String                   value;
24     private UserDTO                  author;
25     private Date                     date;
26     private List<Step>               involving = new Vector<Step>();
27         private String                   studyTitle;
28         private String                   scenarioTitle;
29
30 //  ==============================================================================================================================
31 //  Public member functions
32 //  ==============================================================================================================================
33
34     /**
35      * @param given
36      * @return
37      */
38     public boolean equals (KnowledgeElementDTO given) {
39       if (!this.getType().equals(given.getType())) return false;
40       if (this.getValue().equals(given.getValue())) return true;
41       return false;      
42     }
43
44     public UserDTO getAuthor () {
45       return author;
46     }
47
48     public Date getDate () {
49       return date;
50     }
51
52     public ProgressState getProgressState () {
53       return state;
54     }
55
56     public String getTitle () {
57       return title;
58     }
59
60     public String getReference () {
61       DecimalFormat toString = new DecimalFormat("00000");   // Supports 99 999 knowledge elements
62       return "KE" + toString.format(this.getIndex());
63     }
64
65     public KnowledgeElementTypeDTO getType () {
66       return type;
67     }
68
69     public String getValue () {
70       return value;
71     }
72
73         /**
74          * Set a status of 
75          * @param aState knowledge element progress state to set
76          */
77         public void setProgressState(ProgressState aState) {
78                 state = aState;
79         }
80         /**
81          * Set a title of the knowledge.
82          * @param aTitle a title to set
83          */
84         public void setTitle(String aTitle) {
85                 title = aTitle;
86         }
87         /**
88          * Set the value.
89          * @param value the value to set
90          */
91         public void setValue(String value) {
92                 this.value = value;
93         }
94         /**
95          * Get list of involving steps.
96          * @return list of steps
97          */
98         public List<Step> getInvolving() {
99                 return involving;
100         }
101         /**
102          * Get title of the parent study.
103          * @return study title
104          */
105         public String getStudyTitle() {
106                 return studyTitle;
107         }
108         /**
109          * Get title of the parent scenario.
110          * @return scenario title
111          */
112         public String getScenarioTitle() {
113                 return scenarioTitle;
114         }
115
116         /**
117          * Get the rid.
118          * @return the rid
119          */
120         public long getIndex() {
121                 return rid;
122         }
123
124         /**
125          * Set the rid.
126          * @param rid the rid to set
127          */
128         public void setIndex(long rid) {
129                 this.rid = rid;
130         }
131
132         /**
133          * Set the studyTitle.
134          * @param studyTitle the studyTitle to set
135          */
136         public void setStudyTitle(String studyTitle) {
137                 this.studyTitle = studyTitle;
138         }
139
140         /**
141          * Set the scenarioTitle.
142          * @param scenarioTitle the scenarioTitle to set
143          */
144         public void setScenarioTitle(String scenarioTitle) {
145                 this.scenarioTitle = scenarioTitle;
146         }
147
148         /**
149          * Set the type.
150          * @param type the type to set
151          */
152         public void setType(KnowledgeElementTypeDTO type) {
153                 this.type = type;
154         }
155
156         /**
157          * Set the author.
158          * @param author the author to set
159          */
160         public void setAuthor(UserDTO author) {
161                 this.author = author;
162         }
163
164         /**
165          * Set the date.
166          * @param date the date to set
167          */
168         public void setDate(Date date) {
169                 this.date = date;
170         }
171 }