Salome HOME
Copyrights update 2015.
[tools/siman.git] / Workspace / Siman-Common / src / org / splat / service / dto / StepDTO.java
1 /*****************************************************************************
2  * Company         OPEN CASCADE
3  * Application     SIMAN
4  * File            $Id$ 
5  * Creation date   14.11.2012
6  * @author         $Author$
7  * @version        $Revision$
8  * @copyright      OPEN CASCADE 2012-2015
9  *****************************************************************************/
10
11 package org.splat.service.dto;
12
13 import java.util.ArrayList;
14 import java.util.List;
15
16 /**
17  * Study activity (step) DTO. This is a container of step documents.
18  */
19 public class StepDTO {
20         /**
21          * The step's key name.
22          */
23         private String _key;
24         /**
25          * The sequential number of the step.
26          */
27         private int _number;
28         /**
29          * Executable module for this step.
30          */
31         private String _module;
32         /**
33          * Documents of the step.
34          */
35         private List<DocumentDTO> _docs = new ArrayList<DocumentDTO>();
36
37         /**
38          * Get the docs.
39          * 
40          * @return the docs
41          */
42         public List<DocumentDTO> getDocs() {
43                 return _docs;
44         }
45
46         /**
47          * Set the docs.
48          * 
49          * @param docs
50          *            the docs to set
51          */
52         public void setDocs(final List<DocumentDTO> docs) {
53                 _docs = docs;
54         }
55
56         /**
57          * Add a document DTO to the step DTO.
58          * 
59          * @param index
60          *            the document persistent id
61          * @param title
62          *            the document title
63          * @return the added document DTO
64          */
65         public DocumentDTO addDoc(final long index, final String title) {
66                 DocumentDTO doc = new DocumentDTO(index, title);
67                 _docs.add(doc);
68                 return doc;
69         }
70         
71         /**
72          * Add a document DTO to the step DTO.
73          * 
74          * @param document
75          *            the document to be added
76          */
77         public void addDoc(final DocumentDTO document) {
78                 _docs.add(document);
79         }
80
81         /**
82          * Get the key.
83          * 
84          * @return the key
85          */
86         public String getKey() {
87                 return _key;
88         }
89
90         /**
91          * Set the key.
92          * 
93          * @param key
94          *            the key to set
95          */
96         public void setKey(final String key) {
97                 _key = key;
98         }
99
100         /**
101          * Get the number.
102          * 
103          * @return the number
104          */
105         public Integer getNumber() {
106                 return _number;
107         }
108
109         /**
110          * Set the number.
111          * 
112          * @param number
113          *            the number to set
114          */
115         public void setNumber(final int number) {
116                 _number = number;
117         }
118
119         /**
120          * Get the module.
121          * 
122          * @return the module
123          */
124         public String getModule() {
125                 return _module;
126         }
127
128         /**
129          * Set the module.
130          * 
131          * @param module
132          *            the module to set
133          */
134         public void setModule(final String module) {
135                 _module = module;
136         }
137
138         /**
139          * {@inheritDoc}
140          * 
141          * @see java.lang.Object#toString()
142          */
143         @Override
144         public String toString() {
145                 StringBuffer buf = new StringBuffer();
146                 buf.append("Activity ID: " + getNumber() + "\nSALOME module: "
147                                 + getModule() + "\n");
148                 for (DocumentDTO doc : getDocs()) {
149                         buf.append(doc);
150                 }
151                 return buf.toString();
152         }
153 }