]> SALOME platform Git repositories - tools/siman.git/blob - Workspace/Siman-Common/src/org/splat/service/StepService.java
Salome HOME
a4071b12dda117775b3674fea6d429dcf7287783
[tools/siman.git] / Workspace / Siman-Common / src / org / splat / service / StepService.java
1 /*****************************************************************************
2  * Company         OPEN CASCADE
3  * Application     SIMAN
4  * File            $Id$ 
5  * Creation date   06.10.2012
6  * @author         $Author$
7  * @version        $Revision$
8  *****************************************************************************/
9
10 package org.splat.service;
11
12 import java.io.IOException;
13 import java.util.List;
14
15 import org.splat.dal.bo.som.Document;
16 import org.splat.dal.bo.som.DocumentType;
17 import org.splat.dal.bo.som.Publication;
18 import org.splat.dal.bo.som.SimulationContext;
19 import org.splat.exception.DocumentIsUsedException;
20 import org.splat.kernel.InvalidPropertyException;
21 import org.splat.kernel.MismatchException;
22 import org.splat.kernel.MissedPropertyException;
23 import org.splat.kernel.MultiplyDefinedException;
24 import org.splat.kernel.NotApplicableException;
25 import org.splat.som.Step;
26
27 /**
28  * Step service interface.
29  * 
30  * @author <a href="mailto:roman.kozlov@opencascade.com">Roman Kozlov (RKV)</a>
31  */
32 public interface StepService {
33
34         /**
35          * Create a new document published in the given study step.
36          * 
37          * @param aStep
38          *            the target study step
39          * @param dprop
40          *            properties of the new document
41          * @return the created publication of the new document
42          * @throws MissedPropertyException
43          *             if a mandatory property is missed
44          * @throws InvalidPropertyException
45          *             if some property doesn't exist
46          * @throws MultiplyDefinedException
47          *             if some property is defined several times
48          * @throws IOException
49          *             if a file system error occurs
50          */
51         Publication createDocument(Step aStep, Document.Properties dprop)
52                         throws MissedPropertyException, InvalidPropertyException,
53                         MultiplyDefinedException, IOException;
54
55         /**
56          * Publish an existing document in the given study step.
57          * 
58          * @param aStep
59          *            the target study step
60          * @param dprop
61          *            new properties of the document
62          * @return the created publication of the document
63          * @throws MissedPropertyException
64          *             if a mandatory property is missed
65          * @throws InvalidPropertyException
66          *             if some property doesn't exist
67          * @throws NotApplicableException
68          *             if the document is undefined
69          */
70         Publication assignDocument(Step aStep, Document.Properties dprop)
71                         throws MissedPropertyException, InvalidPropertyException,
72                         NotApplicableException;
73
74         /**
75          * Create a new version of a document in the given study step.
76          * 
77          * @param aStep
78          *            the study step
79          * @param base
80          *            the base document published version
81          * @param dprop
82          *            properties of the new version
83          * @return the new version publication
84          * @throws MissedPropertyException
85          *             if a mandatory property is missed
86          * @throws InvalidPropertyException
87          *             if some property doesn't exist
88          * @throws MultiplyDefinedException
89          *             if some property is defined several times
90          * @throws IOException
91          *             if a file system error occurs
92          * @throws MismatchException
93          *             if the document is not applicable to the given study step
94          */
95         Publication versionDocument(Step aStep, Publication base,
96                         Document.Properties dprop) throws MissedPropertyException,
97                         InvalidPropertyException, MultiplyDefinedException, IOException,
98                         MismatchException;
99
100         /**
101          * Add simulation context to the study step.
102          * 
103          * @param aStep
104          *            the study step
105          * @param dprop
106          *            properties of the simulation context to add
107          * @return the added simulation context
108          * @throws MissedPropertyException
109          *             if a mandatory property is missed
110          * @throws InvalidPropertyException
111          *             if some property doesn't exist
112          * @throws MultiplyDefinedException
113          *             if some property is defined several times
114          */
115         SimulationContext addSimulationContext(Step aStep,
116                         SimulationContext.Properties dprop) throws MissedPropertyException,
117                         InvalidPropertyException, MultiplyDefinedException;
118
119         /**
120          * Add simulation context to the study step.
121          * 
122          * @param firstStep
123          *            the study step
124          * @param context
125          *            the simulation context to add
126          * @return the added simulation context
127          */
128         SimulationContext addSimulationContext(Step firstStep,
129                         SimulationContext context);
130
131         /**
132          * Remove a simulation context from the study step.
133          * 
134          * @param aStep
135          *            the study step
136          * @param context
137          *            the simulation context to remove
138          * @return true if removal succeeded
139          */
140         boolean removeSimulationContext(Step aStep, SimulationContext context);
141
142         /**
143          * Add a document publication to the given step.
144          * 
145          * @param aStep
146          *            the target study step
147          * @param newdoc
148          *            the document publication to add
149          * @return true if publication succeeded
150          */
151         boolean add(Step aStep, Publication newdoc);
152
153         /**
154          * Remove a document publication from the given step.
155          * 
156          * @param aStep
157          *            the study step
158          * @param oldoc
159          *            the document publication to remove
160          * @return true if removing of the publication succeeded
161          */
162         boolean remove(Step aStep, Publication oldoc);
163
164         /**
165          * Remove a document from the given step and from the database if it is no more used.
166          * 
167          * @param aStep
168          *            the study step
169          * @param docId
170          *            the document id
171          * @return true if removing of the document succeeded
172          * @throws DocumentIsUsedException
173          *             if the document is used by other documents
174          */
175         boolean removeDocument(Step aStep, long docId)
176                         throws DocumentIsUsedException;
177
178         /**
179          * Get document types which are applicable for the given study step (activity).
180          * 
181          * @param aStep
182          *            the study step
183          * @return the list of document types
184          */
185         List<DocumentType> getValidDocumentTypes(Step aStep);
186 }