Salome HOME
ScenarioService.getScenarioInfo method is added.
[tools/siman.git] / Workspace / Siman-Common / src / org / splat / service / ScenarioService.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.util.List;
13
14 import org.splat.dal.bo.kernel.User;
15 import org.splat.dal.bo.som.KnowledgeElement;
16 import org.splat.dal.bo.som.Scenario;
17 import org.splat.dal.bo.som.SimulationContext;
18 import org.splat.dal.bo.som.Study;
19 import org.splat.kernel.InvalidPropertyException;
20 import org.splat.kernel.MissedPropertyException;
21 import org.splat.kernel.MultiplyDefinedException;
22 import org.splat.service.dto.StepDTO;
23 import org.splat.som.Step;
24
25 /**
26  * Scenario service interface.
27  * 
28  * @author <a href="mailto:roman.kozlov@opencascade.com">Roman Kozlov (RKV)</a>
29  */
30 public interface ScenarioService {
31
32         /**
33          * Get lists of scenario steps, documents and files for building siman-salome.conf file.
34          * 
35          * @param scenarioId
36          *            scenario id
37          * @return list of step DTOs
38          */
39         List<StepDTO> getScenarioInfo(long scenarioId);
40
41         /**
42          * Create a new study with one scenario and "product" simulation context.
43          * 
44          * @param sprop
45          *            the study properties
46          * @param oprop
47          *            the scenario properties
48          * @param cprop
49          *            the "product" simulation context properties
50          * @return the created study
51          * @throws MissedPropertyException
52          *             if a mandatory property is missed
53          * @throws InvalidPropertyException
54          *             if a property is invalid
55          * @throws MultiplyDefinedException
56          *             if some property occurs several times
57          */
58         Study createStudy(Study.Properties sprop, Scenario.Properties oprop,
59                         SimulationContext.Properties cprop) throws MissedPropertyException,
60                         InvalidPropertyException, MultiplyDefinedException;
61
62         /**
63          * Add a new scenario to the study.
64          * 
65          * @param aStudy
66          *            the study
67          * @param sprop
68          *            scenario properties
69          * @return the added scenario
70          * @throws MissedPropertyException
71          *             if a mandatory property is missed
72          * @throws InvalidPropertyException
73          *             if some property doesn't exist
74          * @throws MultiplyDefinedException
75          *             if some property occurs several times
76          */
77         Scenario addScenario(Study aStudy, Scenario.Properties sprop)
78                         throws MissedPropertyException, InvalidPropertyException,
79                         MultiplyDefinedException;
80
81         /**
82          * Add a new knowledge element to the scenario.
83          * 
84          * @param aScenario
85          *            the scenario
86          * @param kprop
87          *            knowledge element properties
88          * @return the created knowledge element
89          * @throws MissedPropertyException
90          *             if a mandatory property is missed
91          * @throws InvalidPropertyException
92          *             if some property doesn't exist
93          * @throws MultiplyDefinedException
94          *             if some property is defined several times
95          */
96         KnowledgeElement addKnowledgeElement(Scenario aScenario,
97                         KnowledgeElement.Properties kprop) throws MissedPropertyException,
98                         InvalidPropertyException, MultiplyDefinedException;
99
100         /**
101          * Check in the scenario.
102          * 
103          * @param aScenario
104          *            the scenario to check in
105          */
106         void checkin(Scenario aScenario);
107
108         /**
109          * Check out the scenario.
110          * 
111          * @param aScenario
112          *            the scenario to check out
113          * @param user
114          *            the current user
115          * @return true if check out operation succeeded
116          */
117         boolean checkout(Scenario aScenario, User user);
118
119         /**
120          * Copy contents from other scenario up to its given step into the given scenario.
121          * 
122          * @param scenario
123          *            the target scenario
124          * @param lastep
125          *            the last processed step of the source scenario
126          */
127         void copyContentsUpTo(Scenario scenario, Step lastep);
128
129         /**
130          * Check if the scenario is empty, i.d. no one of its steps doesn't contain any knowledge elements or documents.
131          * 
132          * @param scenario
133          *            the scenario to check
134          * @return true if the scenario is empty
135          */
136         boolean isEmpty(Scenario scenario);
137
138         /**
139          * Remove a knowledge element from a scenario.
140          * 
141          * @param scenario
142          *            the scenario
143          * @param kelm
144          *            the knowledge element to remove
145          * @return true if removal succeeded
146          */
147         boolean removeKnowledgeElement(Scenario scenario, KnowledgeElement kelm);
148 }