1 /*****************************************************************************
5 * Creation date 02.10.2012
6 * @author Author: Maria KRUCHININA
8 *****************************************************************************/
10 package org.splat.service;
12 import org.splat.dal.bo.kernel.User;
13 import org.splat.dal.bo.som.DocumentType;
14 import org.splat.dal.bo.som.Publication;
15 import org.splat.dal.bo.som.Scenario;
16 import org.splat.dal.bo.som.SimulationContext;
17 import org.splat.dal.bo.som.Study;
18 import org.splat.dal.bo.som.ValidationCycle;
19 import org.splat.dal.bo.som.Study.Properties;
20 import org.splat.kernel.InvalidPropertyException;
21 import org.splat.kernel.MissedPropertyException;
22 import org.splat.kernel.MultiplyDefinedException;
25 * This class defines all methods for creation, modification the study.
27 * @author Maria KRUCHININA
30 public interface StudyService {
33 * Increment total number of study documents including versions (docount) and update it in the study.
34 * @param aStudy the study
35 * @return incremented docount value
37 public int generateLocalIndex(Study aStudy);
40 * Get study by its id.
44 * @return found study or null
46 public Study selectStudy(long index);
52 * properties of the new study
53 * @return the created study
54 * @throws MissedPropertyException
55 * if a mandatory property is missed
56 * @throws InvalidPropertyException
57 * if some property doesn't exist
58 * @throws MultiplyDefinedException
59 * if some property is defined several times
61 public Study createStudy(Study.Properties sprop)
62 throws MissedPropertyException, InvalidPropertyException,
63 MultiplyDefinedException;
66 * Add a simulation context to the first step of the study. If the context doesn't yet saved it is created in the database.
71 * the simulation context properties
72 * @return the added simulation context
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 public SimulationContext addProjectContext(Study aStudy,
81 SimulationContext.Properties cprop) throws MissedPropertyException,
82 InvalidPropertyException, MultiplyDefinedException;
85 * Add a simulation context to the first step of the study. If the context doesn't yet saved it is created in the database.
90 * the simulation context to add
91 * @return the added simulation context
93 public SimulationContext addProjectContext(Study aStudy,
94 SimulationContext context);
97 * Add a new scenario to the study.
102 * scenario properties
103 * @return the added scenario
104 * @throws MissedPropertyException
105 * if a mandatory property is missed
106 * @throws InvalidPropertyException
107 * if some property doesn't exist
108 * @throws MultiplyDefinedException
109 * if some property occurs several times
111 public Scenario addScenario(Study aStudy, Scenario.Properties sprop)
112 throws MissedPropertyException, InvalidPropertyException,
113 MultiplyDefinedException;
116 * Remove a simulation context from a study.
117 * @param aStudy the study
118 * @param context the simulation context to remove
119 * @return true if removing succeeded
121 public boolean removeProjectContext(Study aStudy, SimulationContext context);
124 * Demotes this study from In-Check to In-Draft then In-Work states. This function is called internally when demoting the final result
125 * document of the study.
128 * the study to demote
129 * @return true if the demotion succeeded.
131 public boolean demote(Study aStudy);
134 * Promotes this study from In-Work to In-Draft then In-Check and APPROVED states. This function is called internally when promoting the
135 * final result document of the study.
138 * the study to promote
139 * @return true if the promotion succeeded.
141 public boolean promote(Study aStudy);
144 * Add a contributor to the study.
150 * @return true if addition succeeded
152 public boolean addContributor(Study aStudy, User user);
155 * Remove contributors from the study.
161 * @return true if removing succeeded
163 public boolean removeContributor(Study aStudy, User... users);
166 * Set a validation cycle for documents of the given type in the given study.
173 * validation cycle properties
175 public void setValidationCycle(Study aStudy, DocumentType type,
176 ValidationCycle.Properties vprop);
179 * Moves this study from the Private to the Public area of the repository.
183 * @return true if the move succeeded.
186 public boolean moveToPublic(Study aStudy);
189 * Moves this study from the Public to the Reference area of the repository. For being moved to the Reference area, the study must
190 * previously be approved.
194 * @return true if the move succeeded.
195 * @see #moveToPublic()
197 * @see Publication#approve(Date)
199 public boolean moveToReference(Study aStudy);
205 * the study to update
207 * new properties of the study
208 * @return true if the study has been updated successfully
209 * @throws InvalidPropertyException
210 * if some property doesn't exist
212 public boolean update(Study aStudy, Properties sprop)
213 throws InvalidPropertyException;