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