Salome HOME
Processing instruction is defined now in getScenarioInfo using document types mappings.
[tools/siman.git] / Workspace / Siman-Common / src / org / splat / service / dto / FileDTO.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 /**
14  * Document's file DTO.
15  */
16 public class FileDTO {
17
18         /**
19          * True if the file is a result file for a document.
20          */
21         private boolean _isResult; // RKV: NOPMD: isResult method is used as getter
22         /**
23          * File state: "Y" - actual, "O" - outdated, "N" - taken from other study.
24          */
25         private char _state;
26         /**
27          * Automatic processing instruction: "file-import", "file-download", etc.
28          */
29         private String _processing;
30         /**
31          * File path from the repository root.
32          */
33         private String _path;
34
35         /**
36          * Constructor with initialization.
37          * 
38          * @param relativePath
39          *            relative file path
40          * @param state
41          *            file state
42          * @param processing
43          *            processing instruction: file-download or file-import
44          * @param isResult
45          *            true if the file is result
46          */
47         public FileDTO(final String relativePath, final char state,
48                         final String processing, final boolean isResult) {
49                 _path = relativePath;
50                 _state = state;
51                 _processing = processing;
52                 _isResult = isResult;
53         }
54
55         /**
56          * Get the isResult.
57          * 
58          * @return the isResult
59          */
60         public boolean isResult() {
61                 return _isResult;
62         }
63
64         /**
65          * Set the isResult.
66          * 
67          * @param isResult
68          *            the isResult to set
69          */
70         public void setResult(final boolean isResult) {
71                 _isResult = isResult;
72         }
73
74         /**
75          * Get the state.
76          * 
77          * @return the state
78          */
79         public char getState() {
80                 return _state;
81         }
82
83         /**
84          * Set the state.
85          * 
86          * @param state
87          *            the state to set
88          */
89         public void setState(final char state) {
90                 _state = state;
91         }
92
93         /**
94          * Get the processing.
95          * 
96          * @return the processing
97          */
98         public String getProcessing() {
99                 return _processing;
100         }
101
102         /**
103          * Set the processing.
104          * 
105          * @param processing
106          *            the processing to set
107          */
108         public void setProcessing(final String processing) {
109                 _processing = processing;
110         }
111
112         /**
113          * Get the path.
114          * 
115          * @return the path
116          */
117         public String getPath() {
118                 return _path;
119         }
120
121         /**
122          * Set the path.
123          * 
124          * @param path
125          *            the path to set
126          */
127         public void setPath(final String path) {
128                 _path = path;
129         }
130
131         /**
132          * {@inheritDoc}
133          * 
134          * @see java.lang.Object#toString()
135          */
136         @Override
137         public String toString() {
138                 StringBuffer buf = new StringBuffer();
139                 String indent = "        ";
140                 String ftype = "Source";
141                 if (isResult()) {
142                         ftype = "Result";
143                 }
144                 String fstate = "file-actual";
145                 if (getState() == 'O') {
146                         fstate = "file-outdated";
147                 }
148                 buf.append(indent).append(ftype).append(" file: ").append(getPath())
149                                 .append('\n').append(indent).append(
150                                                 "    Automatic processing: ").append(getProcessing())
151                                 .append('\n').append(indent).append("    State: ").append(
152                                                 fstate).append('\n');
153                 return buf.toString();
154         }
155 }