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.
36 * The step's key name.
41 * The owner of the step: study or scenario.
43 private Class<? extends ProjectElement> _level;
45 * Set of Document and/or Knowledge applicable on this step.
47 protected Set<Class<?>> _contents;
49 * Data path for this step.
53 * Executable module for this step.
55 private String _module;
58 * Create a transient study step definition.
61 * the step sequential number
63 * the level (study or scenario) the step is applied to
67 Step(final int number, final Class<? extends ProjectElement> level,
69 this.initialize(number, level, path);
73 * Create a transient study step definition.
76 * the step sequential number
78 * the level (study or scenario) the step is applied to
80 * the set of applicable data types
84 @SuppressWarnings("unused")
85 private Step(final int number,
86 final Class<? extends ProjectElement> level,
87 final Class<?> contents, final String path) {
88 this.initialize(number, level, path);
89 this._contents.add(contents);
93 * Initialize the study step.
96 * the step sequential number
98 * the level (study or scenario) the step is applied to
102 private void initialize(final int number,
103 final Class<? extends ProjectElement> level, final String path) {
104 this._number = number;
106 this._path = path + "/";
107 this._contents = new HashSet<Class<?>>();
111 * Check if the step is applied to a study or a scenario level.
114 * the study or a scenario to check the step applicability
115 * @return true if the step is applied to the given level
117 public boolean appliesTo(final Class<? extends ProjectElement> level) {
118 return (level == this._level);
122 * Check if the step can contain documents or knowledges of the given type.
126 * @return true if the step can contain data of the given type
128 public boolean mayContain(final Class<?> type) {
129 return _contents.contains(type);
133 * Get the sequential number of the step.
135 * @return the sequential number of the step
137 public int getNumber() {
142 * Get data path for this step.
144 * @return data path for this step
146 public String getPath() {
154 public String getModule() {
160 * @param module the module to set
162 public void setModule(final String module) {
170 public String getKey() {
176 * @param key the key to set
178 public void setKey(final String key) {
184 * Return the validation cycles of result documents defined in the workflow, ordered by study activities and ending by the default
185 * validation cycle, if defined.
187 * @return the validation cycles of the workflow
189 List<ProjectSettingsValidationCycle> getAllValidationCycles();
192 * Get a study step by its sequential number.
198 ProjectSettingsService.Step getStep(final int number);
201 * Get ordered list of (transient) study steps.
203 * @return the list of steps from project settings
205 List<ProjectSettingsService.Step> getAllSteps();
208 * Get file naming scheme setting.
210 * @return file naming scheme
211 * @see org.splat.service.technical.ProjectSettingsServiceImpl.FileNaming
213 FileNaming getFileNamingScheme();
216 * Get a pattern of study references.
218 * @return the reference pattern
220 String getReferencePattern();
223 * Get a pattern of the presentation of version numbers.
225 * @return the version numbers presentation pattern
227 String getRevisionPattern();
230 * Load workflow configuration from the given file. <br/> Create necessary default staff in the database if it is not initialized yet.
233 * the workflow configuration file
234 * @throws IOException
235 * if there is a file reading or index creation problem
236 * @throws SQLException
237 * if there is a database population problem
239 void configure(String filename) throws IOException, SQLException;
242 * Get steps of the given project element (study or scenario).
245 * the project element (study or scenario)
246 * @return the list of steps
248 List<ProjectSettingsService.Step> getStepsOf(
249 Class<? extends ProjectElement> level);