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