1 /*****************************************************************************
5 * Creation date 02.10.2012
6 * @author Author: Maria KRUCHININA
8 *****************************************************************************/
10 package org.splat.service;
12 import java.util.List;
14 import org.splat.dal.bo.kernel.User;
15 import org.splat.dal.bo.som.DocumentType;
16 import org.splat.dal.bo.som.Publication;
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.dal.bo.som.ValidationCycle;
21 import org.splat.dal.bo.som.Study.Properties;
22 import org.splat.kernel.InvalidPropertyException;
23 import org.splat.kernel.MissedPropertyException;
24 import org.splat.kernel.MultiplyDefinedException;
27 * This class defines all methods for creation, modification the study.
29 * @author Maria KRUCHININA
32 public interface StudyService {
35 * Increment total number of study documents including versions (docount) and update it in the study.
39 * @return incremented docount value
41 public int generateLocalIndex(Study aStudy);
44 * Get study by its id.
48 * @return found study or null
50 public Study selectStudy(long index);
56 * properties of the new study
57 * @return the created study
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 is defined several times
65 public Study createStudy(Study.Properties sprop)
66 throws MissedPropertyException, InvalidPropertyException,
67 MultiplyDefinedException;
70 * Add a simulation context to the first step of the study. If the context doesn't yet saved it is created in the database.
75 * the simulation context properties
76 * @return the added simulation context
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 occurs several times
84 public SimulationContext addProjectContext(Study aStudy,
85 SimulationContext.Properties cprop) throws MissedPropertyException,
86 InvalidPropertyException, MultiplyDefinedException;
89 * Add a simulation context to the first step of the study. If the context doesn't yet saved it is created in the database.
94 * the simulation context to add
95 * @return the added simulation context
97 public SimulationContext addProjectContext(Study aStudy,
98 SimulationContext context);
101 * Remove a simulation context from a study.
106 * the simulation context to remove
107 * @return true if removing succeeded
109 public boolean removeProjectContext(Study aStudy, SimulationContext context);
112 * Demotes this study from In-Check to In-Draft then In-Work states. This function is called internally when demoting the final result
113 * document of the study.
116 * the study to demote
117 * @return true if the demotion succeeded.
119 public boolean demote(Study aStudy);
122 * Promotes this study from In-Work to In-Draft then In-Check and APPROVED states. This function is called internally when promoting the
123 * final result document of the study.
126 * the study to promote
127 * @return true if the promotion succeeded.
129 public boolean promote(Study aStudy);
132 * Add a contributor to the study.
138 * @return true if addition succeeded
140 public boolean addContributor(Study aStudy, User user);
143 * Remove contributors from the study.
149 * @return true if removing succeeded
151 public boolean removeContributor(Study aStudy, User... users);
154 * Set a validation cycle for documents of the given type in the given study.
161 * validation cycle properties
163 public void setValidationCycle(Study aStudy, DocumentType type,
164 ValidationCycle.Properties vprop);
167 * Moves this study from the Private to the Public area of the repository.
171 * @return true if the move succeeded.
174 public boolean moveToPublic(Study aStudy);
177 * Moves this study from the Public to the Reference area of the repository. For being moved to the Reference area, the study must
178 * previously be approved.
182 * @return true if the move succeeded.
183 * @see #moveToPublic()
185 * @see Publication#approve(Date)
187 public boolean moveToReference(Study aStudy);
193 * the study to update
195 * new properties of the study
196 * @return true if the study has been updated successfully
197 * @throws InvalidPropertyException
198 * if some property doesn't exist
200 public boolean update(Study aStudy, Properties sprop)
201 throws InvalidPropertyException;
204 * Initialize shortcuts of the study as its transient collections.
209 public void loadWorkflow(Study aStudy);
212 * Returns the validation cycle of the given document type.
217 * the document type being subject of validation
218 * @return the validation cycle of the document, or null if not defined.
220 public ValidationCycle getValidationCycleOf(Study aStudy, DocumentType type);
223 * Checks if the given user participates to this study. The Study staff includes the author and contributors.
228 * the user to look for
229 * @return true if the given user is actor of this study.
230 * @see #getContributors()
232 public boolean isStaffedBy(Study aStudy, User user);
235 * Checks if the given user is actor of this study. Actors include contributors, reviewers and approvers.
240 * the user to look for
241 * @return true if the given user is actor of this study.
244 public boolean hasActor(Study aStudy, User user);
247 * Returns unmodifiable initialized transient list of contributors of this study.
251 * @return the unmodifiable not null transient list of contributors of this study
253 public List<User> getContributors(Study aStudy);