]> SALOME platform Git repositories - tools/siman.git/blob - Workspace/Siman-Common/src/org/splat/service/dto/StepDTO.java
Salome HOME
toString method is redefined.
[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
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          * Get the key.
73          * 
74          * @return the key
75          */
76         public String getKey() {
77                 return _key;
78         }
79
80         /**
81          * Set the key.
82          * 
83          * @param key
84          *            the key to set
85          */
86         public void setKey(final String key) {
87                 _key = key;
88         }
89
90         /**
91          * Get the number.
92          * 
93          * @return the number
94          */
95         public int getNumber() {
96                 return _number;
97         }
98
99         /**
100          * Set the number.
101          * 
102          * @param number
103          *            the number to set
104          */
105         public void setNumber(final int number) {
106                 _number = number;
107         }
108
109         /**
110          * Get the module.
111          * 
112          * @return the module
113          */
114         public String getModule() {
115                 return _module;
116         }
117
118         /**
119          * Set the module.
120          * 
121          * @param module
122          *            the module to set
123          */
124         public void setModule(final String module) {
125                 _module = module;
126         }
127
128         /**
129          * {@inheritDoc}
130          * 
131          * @see java.lang.Object#toString()
132          */
133         @Override
134         public String toString() {
135                 StringBuffer buf = new StringBuffer();
136                 buf.append("Activity ID: " + getNumber() + "\nSALOME module: "
137                                 + getModule() + "\n");
138                 for (DocumentDTO doc : getDocs()) {
139                         buf.append(doc);
140                 }
141                 return buf.toString();
142         }
143 }