1 /*****************************************************************************
5 * Creation date 05.10.2012
8 *****************************************************************************/
10 package org.splat.service.technical;
12 import java.io.IOException;
13 import java.sql.SQLException;
14 import java.util.HashSet;
15 import java.util.List;
18 import org.splat.dal.bo.som.ProjectElement;
19 import org.splat.service.technical.ProjectSettingsServiceImpl.FileNaming;
20 import org.splat.service.technical.ProjectSettingsServiceImpl.ProjectSettingsValidationCycle;
23 * Project settings service interface.
25 public interface ProjectSettingsService {
28 * Transient study step data.
32 * The sequential number of the step.
37 * The owner of the step: study or scenario.
39 private Class<? extends ProjectElement> _level;
41 * Set of Document and/or Knowledge applicable on this step.
43 protected Set<Class<?>> _contents;
45 * Data path for this step.
49 * Executable module for this step.
51 private String _module;
54 * Create a transient study step definition.
57 * the step sequential number
59 * the level (study or scenario) the step is applied to
63 Step(final int number, final Class<? extends ProjectElement> level,
65 this.initialize(number, level, path);
69 * Create a transient study step definition.
72 * the step sequential number
74 * the level (study or scenario) the step is applied to
76 * the set of applicable data types
80 @SuppressWarnings("unused")
81 private Step(final int number,
82 final Class<? extends ProjectElement> level,
83 final Class<?> contents, final String path) {
84 this.initialize(number, level, path);
85 this._contents.add(contents);
89 * Initialize the study step.
92 * the step sequential number
94 * the level (study or scenario) the step is applied to
98 private void initialize(final int number,
99 final Class<? extends ProjectElement> level, final String path) {
100 this._number = number;
102 this._path = path + "/";
103 this._contents = new HashSet<Class<?>>();
107 * Check if the step is applied to a study or a scenario level.
110 * the study or a scenario to check the step applicability
111 * @return true if the step is applied to the given level
113 public boolean appliesTo(final Class<? extends ProjectElement> level) {
114 return (level == this._level);
118 * Check if the step can contain documents or knowledges of the given type.
122 * @return true if the step can contain data of the given type
124 public boolean mayContain(final Class<?> type) {
125 return _contents.contains(type);
129 * Get the sequential number of the step.
131 * @return the sequential number of the step
133 public int getNumber() {
138 * Get data path for this step.
140 * @return data path for this step
142 public String getPath() {
150 public String getModule() {
156 * @param module the module to set
158 public void setModule(final String module) {
164 * Return the validation cycles of result documents defined in the workflow, ordered by study activities and ending by the default
165 * validation cycle, if defined.
167 * @return the validation cycles of the workflow
169 List<ProjectSettingsValidationCycle> getAllValidationCycles();
172 * Get a study step by its sequential number.
178 ProjectSettingsService.Step getStep(final int number);
181 * Get ordered list of (transient) study steps.
183 * @return the list of steps from project settings
185 List<ProjectSettingsService.Step> getAllSteps();
188 * Get file naming scheme setting.
190 * @return file naming scheme
191 * @see org.splat.service.technical.ProjectSettingsServiceImpl.FileNaming
193 FileNaming getFileNamingScheme();
196 * Get a pattern of study references.
198 * @return the reference pattern
200 String getReferencePattern();
203 * Get a pattern of the presentation of version numbers.
205 * @return the version numbers presentation pattern
207 String getRevisionPattern();
210 * Load workflow configuration from the given file. <br/> Create necessary default staff in the database if it is not initialized yet.
213 * the workflow configuration file
214 * @throws IOException
215 * if there is a file reading or index creation problem
216 * @throws SQLException
217 * if there is a database population problem
219 void configure(String filename) throws IOException, SQLException;
222 * Get steps of the given project element (study or scenario).
225 * the project element (study or scenario)
226 * @return the list of steps
228 List<ProjectSettingsService.Step> getStepsOf(
229 Class<? extends ProjectElement> level);