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 * Create a new study with one scenario and "product" simulation context.
48 * the study properties
50 * the scenario properties
52 * the "product" simulation context properties
53 * @return the created study
54 * @throws MissedPropertyException
55 * if a mandatory property is missed
56 * @throws InvalidPropertyException
57 * if a property is invalid
58 * @throws MultiplyDefinedException
59 * if some property occurs several times
61 Study createStudy(Study.Properties sprop, Scenario.Properties oprop,
62 SimulationContext.Properties cprop) throws MissedPropertyException,
63 InvalidPropertyException, MultiplyDefinedException;
66 * Add a new scenario to the study.
72 * @return the added scenario
73 * @throws MissedPropertyException
74 * if a mandatory property is missed
75 * @throws InvalidPropertyException
76 * if some property doesn't exist
77 * @throws MultiplyDefinedException
78 * if some property occurs several times
80 Scenario addScenario(Study aStudy, Scenario.Properties sprop)
81 throws MissedPropertyException, InvalidPropertyException,
82 MultiplyDefinedException;
85 * Add a new knowledge element to the scenario.
90 * knowledge element properties
91 * @return the created knowledge element
92 * @throws MissedPropertyException
93 * if a mandatory property is missed
94 * @throws InvalidPropertyException
95 * if some property doesn't exist
96 * @throws MultiplyDefinedException
97 * if some property is defined several times
99 KnowledgeElement addKnowledgeElement(Scenario aScenario,
100 KnowledgeElement.Properties kprop) throws MissedPropertyException,
101 InvalidPropertyException, MultiplyDefinedException;
104 * Check-in the scenario after SALOME session. If a document to be checked in already exists then create a new version of it. Otherwise
105 * create a new document of the appropriate step result type.
107 * <li>For each new created document version we copy Uses relations from the previous document version. If used document has been also
108 * versioned during this check-in operation then refer to its new version.</li>
109 * <li>For each new document create uses relation to the last versions of results of a previous step.</li>
111 * <b>NOTE:</b> Only the first attached file is processed for each document. <br/>All new documents/versions are created in inWORK
117 * the id of the user who modified documents
119 * the list of scenario steps DTO
120 * @throws InvalidPropertyException
121 * if the scenario hasn't some of given steps or documents
122 * @throws IOException
123 * if a file can't be moved into the vault
124 * @throws MismatchException
125 * if version creation in some of steps is failed
126 * @throws MissedPropertyException
127 * if some mandatory property is missed when new document or new document version is created
128 * @throws MultiplyDefinedException
129 * if some property is defined several times when new document or new document version is created
130 * @throws NotApplicableException
131 * if failed saving of a new publication with a given state
133 void checkin(final long scenId, final long userId,
134 final List<StepDTO> scInfo) throws InvalidPropertyException,
135 MissedPropertyException, MultiplyDefinedException,
136 MismatchException, IOException, NotApplicableException;
139 * Check in the scenario.
142 * the scenario to check in
144 void checkin(Scenario aScenario);
147 * Check out the scenario.
150 * the scenario to check out
153 * @return true if check out operation succeeded
155 boolean checkout(Scenario aScenario, User user);
158 * Copy contents from other scenario up to its given step into the given scenario.
161 * the target scenario
163 * the last processed step of the source scenario
165 void copyContentsUpTo(Scenario scenario, Step lastep);
168 * Check if the scenario is empty, i.d. no one of its steps doesn't contain any knowledge elements or documents.
171 * the scenario to check
172 * @return true if the scenario is empty
174 boolean isEmpty(Scenario scenario);
177 * Remove a knowledge element from a scenario.
182 * the knowledge element to remove
183 * @return true if removal succeeded
185 boolean removeKnowledgeElement(Scenario scenario, KnowledgeElement kelm);