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.kernel.User;
16 import org.splat.dal.bo.som.KnowledgeElement;
17 import org.splat.dal.bo.som.Scenario;
18 import org.splat.dal.bo.som.SimulationContext;
19 import org.splat.dal.bo.som.Study;
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.service.dto.StepDTO;
26 import org.splat.som.Step;
29 * Scenario service interface.
31 * @author <a href="mailto:roman.kozlov@opencascade.com">Roman Kozlov (RKV)</a>
33 public interface ScenarioService {
36 * Get lists of scenario steps, documents and files for building siman-salome.conf file.
40 * @return list of step DTOs
42 List<StepDTO> getScenarioInfo(long scenarioId);
52 * study product simulation context value
55 * @return the created study id
56 * @throws InvalidPropertyException
57 * if an invalid value is passed to a property
58 * @throws MissedPropertyException
59 * if a mandatory property is missed
60 * @throws MultiplyDefinedException
61 * if some property is defined several times
63 long createStudy(final String username, final String title,
64 final String productName, final String description)
65 throws InvalidPropertyException, MissedPropertyException, MultiplyDefinedException;
68 * Create a new study with one scenario and "product" simulation context.
71 * the study properties
73 * the scenario properties
75 * the "product" simulation context properties
76 * @return the created study
77 * @throws MissedPropertyException
78 * if a mandatory property is missed
79 * @throws InvalidPropertyException
80 * if a property is invalid
81 * @throws MultiplyDefinedException
82 * if some property occurs several times
84 Study createStudy(Study.Properties sprop, Scenario.Properties oprop,
85 SimulationContext.Properties cprop) throws MissedPropertyException,
86 InvalidPropertyException, MultiplyDefinedException;
89 * Add a new scenario to the study.
95 * @return the added scenario
96 * @throws MissedPropertyException
97 * if a mandatory property is missed
98 * @throws InvalidPropertyException
99 * if an invalid value is passed to a property
100 * @throws MultiplyDefinedException
101 * if some property occurs several times
103 Scenario addScenario(Study aStudy, Scenario.Properties sprop)
104 throws MissedPropertyException, InvalidPropertyException,
105 MultiplyDefinedException;
108 * Add a new knowledge element to the scenario.
113 * knowledge element properties
114 * @return the created knowledge element
115 * @throws MissedPropertyException
116 * if a mandatory property is missed
117 * @throws InvalidPropertyException
118 * if an invalid value is passed to a property
119 * @throws MultiplyDefinedException
120 * if some property is defined several times
122 KnowledgeElement addKnowledgeElement(Scenario aScenario,
123 KnowledgeElement.Properties kprop) throws MissedPropertyException,
124 InvalidPropertyException, MultiplyDefinedException;
127 * Check-in the scenario after SALOME session. If a document to be checked in already exists then create a new version of it. Otherwise
128 * create a new document of the appropriate step result type.
130 * <li>For each new created document version we copy Uses relations from the previous document version. If used document has been also
131 * versioned during this check-in operation then refer to its new version.</li>
132 * <li>For each new document create uses relation to the last versions of results of a previous step.</li>
134 * <b>NOTE:</b> Only the first attached file is processed for each document. <br/>All new documents/versions are created in inWORK
140 * the id of the user who modified documents
142 * the list of scenario steps DTO
143 * @throws InvalidPropertyException
144 * if the scenario hasn't some of given steps or documents
145 * @throws IOException
146 * if a file can't be moved into the vault
147 * @throws MismatchException
148 * if version creation in some of steps is failed
149 * @throws MissedPropertyException
150 * if some mandatory property is missed when new document or new document version is created
151 * @throws MultiplyDefinedException
152 * if some property is defined several times when new document or new document version is created
153 * @throws NotApplicableException
154 * if failed saving of a new publication with a given state
156 void checkin(final long scenId, final long userId,
157 final List<StepDTO> scInfo) throws InvalidPropertyException,
158 MissedPropertyException, MultiplyDefinedException,
159 MismatchException, IOException, NotApplicableException;
162 * Check in the scenario.
165 * the id of the scenario to check in
166 * @throws InvalidPropertyException
167 * if the scenario is not found in the database
169 public void checkin(final long scenarioId) throws InvalidPropertyException;
172 * Check out the scenario.
175 * the scenario to check out
178 * @return true if check out operation succeeded
180 boolean checkout(Scenario aScenario, User user);
183 * Mark the given scenario as checked out by the given user.
188 * the id of the user performing the check out
189 * @throws InvalidPropertyException
190 * if the user or the scenario is not found in the database
191 * @throws NotApplicableException
192 * if the given user can not check out the scenario
194 public void checkout(final long scenarioId, final long userId)
195 throws InvalidPropertyException, NotApplicableException;
198 * Copy contents from other scenario up to its given step into the given scenario.
201 * the target scenario
203 * the last processed step of the source scenario
205 void copyContentsUpTo(Scenario scenario, Step lastep);
208 * Check if the scenario is empty, i.d. no one of its steps doesn't contain any knowledge elements or documents.
211 * the scenario to check
212 * @return true if the scenario is empty
214 boolean isEmpty(Scenario scenario);
217 * Remove a knowledge element from a scenario.
222 * the knowledge element to remove
223 * @return true if removal succeeded
225 boolean removeKnowledgeElement(Scenario scenario, KnowledgeElement kelm);
228 * Rename the scenario.
229 * @param scenario - the scenario with a new title.
231 void renameScenario(final Scenario scenario);