1 /*****************************************************************************
5 * Creation date 06.10.2012
8 *****************************************************************************/
10 package org.splat.service;
12 import java.io.IOException;
13 import java.util.List;
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;
28 * Step service interface.
30 * @author <a href="mailto:roman.kozlov@opencascade.com">Roman Kozlov (RKV)</a>
32 public interface StepService {
35 * Create a new document published in the given study step.
38 * the target study step
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
49 * if a file system error occurs
51 Publication createDocument(Step aStep, Document.Properties dprop)
52 throws MissedPropertyException, InvalidPropertyException,
53 MultiplyDefinedException, IOException;
56 * Publish an existing document in the given study step.
59 * the target study step
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
70 Publication assignDocument(Step aStep, Document.Properties dprop)
71 throws MissedPropertyException, InvalidPropertyException,
72 NotApplicableException;
75 * Create a new version of a document in the given study step.
80 * the base document published version
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
91 * if a file system error occurs
92 * @throws MismatchException
93 * if the document is not applicable to the given study step
95 Publication versionDocument(Step aStep, Publication base,
96 Document.Properties dprop) throws MissedPropertyException,
97 InvalidPropertyException, MultiplyDefinedException, IOException,
101 * Add simulation context to the study step.
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
115 SimulationContext addSimulationContext(Step aStep,
116 SimulationContext.Properties dprop) throws MissedPropertyException,
117 InvalidPropertyException, MultiplyDefinedException;
120 * Add simulation context to the study step.
125 * the simulation context to add
126 * @return the added simulation context
128 SimulationContext addSimulationContext(Step firstStep,
129 SimulationContext context);
132 * Remove a simulation context from the study step.
137 * the simulation context to remove
138 * @return true if removal succeeded
140 boolean removeSimulationContext(Step aStep, SimulationContext context);
143 * Add a document publication to the given step.
146 * the target study step
148 * the document publication to add
149 * @return true if publication succeeded
151 boolean add(Step aStep, Publication newdoc);
154 * Remove a document publication from the given step.
159 * the document publication to remove
160 * @return true if removing of the publication succeeded
162 boolean remove(Step aStep, Publication oldoc);
165 * Remove a document from the given step and from the database if it is no more used.
171 * @return true if removing of the document succeeded
172 * @throws DocumentIsUsedException
173 * if the document is used by other documents
175 boolean removeDocument(Step aStep, long docId)
176 throws DocumentIsUsedException;
179 * Get document types which are applicable for the given study step (activity).
183 * @return the list of document types
185 List<DocumentType> getValidDocumentTypes(Step aStep);