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);
45 * Assign context to the study.
53 * @throws InvalidPropertyException
54 * if an invalid value is passed to a property
55 * @throws MissedPropertyException
56 * if a mandatory property is missed
57 * @throws MultiplyDefinedException
58 * if some property is defined several times
60 public void assignStudyContext(final Long studyId, final String ctxType,
61 final String ctxValue) throws MissedPropertyException,
62 InvalidPropertyException, MultiplyDefinedException;
72 * study product simulation context value
75 * @return the created study id
76 * @throws InvalidPropertyException
77 * if an invalid value is passed to a property
78 * @throws MissedPropertyException
79 * if a mandatory property is missed
80 * @throws MultiplyDefinedException
81 * if some property is defined several times
83 long createStudy(final String username, final String title,
84 final String productName, final String description)
85 throws InvalidPropertyException, MissedPropertyException,
86 MultiplyDefinedException;
89 * Create a new study with one scenario and "product" simulation context.
92 * the study properties
94 * the scenario properties
96 * the "product" simulation context properties
97 * @return the created study
98 * @throws MissedPropertyException
99 * if a mandatory property is missed
100 * @throws InvalidPropertyException
101 * if a property is invalid
102 * @throws MultiplyDefinedException
103 * if some property occurs several times
105 Study createStudy(Study.Properties sprop, Scenario.Properties oprop,
106 SimulationContext.Properties cprop) throws MissedPropertyException,
107 InvalidPropertyException, MultiplyDefinedException;
110 * Add a new scenario to the study.
115 * scenario properties
116 * @return the added scenario
117 * @throws MissedPropertyException
118 * if a mandatory property is missed
119 * @throws InvalidPropertyException
120 * if an invalid value is passed to a property
121 * @throws MultiplyDefinedException
122 * if some property occurs several times
124 Scenario addScenario(Study aStudy, Scenario.Properties sprop)
125 throws MissedPropertyException, InvalidPropertyException,
126 MultiplyDefinedException;
129 * Add a new knowledge element to the scenario.
134 * knowledge element properties
135 * @return the created knowledge element
136 * @throws MissedPropertyException
137 * if a mandatory property is missed
138 * @throws InvalidPropertyException
139 * if an invalid value is passed to a property
140 * @throws MultiplyDefinedException
141 * if some property is defined several times
143 KnowledgeElement addKnowledgeElement(Scenario aScenario,
144 KnowledgeElement.Properties kprop) throws MissedPropertyException,
145 InvalidPropertyException, MultiplyDefinedException;
148 * Check-in the scenario after SALOME session. If a document to be checked in already exists then create a new version of it. Otherwise
149 * create a new document of the appropriate step result type.
151 * <li>For each new created document version we copy Uses relations from the previous document version. If used document has been also
152 * versioned during this check-in operation then refer to its new version.</li>
153 * <li>For each new document create uses relation to the last versions of results of a previous step.</li>
155 * <b>NOTE:</b> Only the first attached file is processed for each document. <br/>All new documents/versions are created in inWORK
161 * the id of the user who modified documents
163 * the list of scenario steps DTO
164 * @throws InvalidPropertyException
165 * if the scenario hasn't some of given steps or documents
166 * @throws IOException
167 * if a file can't be moved into the vault
168 * @throws MismatchException
169 * if version creation in some of steps is failed
170 * @throws MissedPropertyException
171 * if some mandatory property is missed when new document or new document version is created
172 * @throws MultiplyDefinedException
173 * if some property is defined several times when new document or new document version is created
174 * @throws NotApplicableException
175 * if failed saving of a new publication with a given state
177 void checkin(final long scenId, final long userId,
178 final List<StepDTO> scInfo) throws InvalidPropertyException,
179 MissedPropertyException, MultiplyDefinedException,
180 MismatchException, IOException, NotApplicableException;
183 * Check in the scenario.
186 * the id of the scenario to check in
187 * @throws InvalidPropertyException
188 * if the scenario is not found in the database
190 public void checkin(final long scenarioId) throws InvalidPropertyException;
193 * Check out the scenario.
196 * the scenario to check out
199 * @return true if check out operation succeeded
201 boolean checkout(Scenario aScenario, User user);
204 * Mark the given scenario as checked out by the given user.
209 * the id of the user performing the check out
210 * @throws InvalidPropertyException
211 * if the user or the scenario is not found in the database
212 * @throws NotApplicableException
213 * if the given user can not check out the scenario
215 public void checkout(final long scenarioId, final long userId)
216 throws InvalidPropertyException, NotApplicableException;
219 * Copy contents from other scenario up to its given step into the given scenario.
222 * the target scenario
224 * the last processed step of the source scenario
226 void copyContentsUpTo(Scenario scenario, Step lastep);
229 * Check if the scenario is empty, i.d. no one of its steps doesn't contain any knowledge elements or documents.
232 * the scenario to check
233 * @return true if the scenario is empty
235 boolean isEmpty(Scenario scenario);
238 * Remove a knowledge element from a scenario.
243 * the knowledge element to remove
244 * @return true if removal succeeded
246 boolean removeKnowledgeElement(Scenario scenario, KnowledgeElement kelm);
249 * Rename the scenario.
252 * the scenario with a new title.
254 void renameScenario(final Scenario scenario);