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.
30 public static class Step {
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 Set<Class<?>> contents;
45 * Data path for this step.
50 * Create a transient study step definition.
53 * the step sequential number
55 * the level (study or scenario) the step is applied to
59 Step(final int number, final Class<? extends ProjectElement> level,
61 this.initialize(number, level, path);
65 * Create a transient study step definition.
68 * the step sequential number
70 * the level (study or scenario) the step is applied to
72 * the set of applicable data types
76 @SuppressWarnings("unused")
77 private Step(final int number,
78 final Class<? extends ProjectElement> level,
79 final Class<?> contents, final String path) {
80 this.initialize(number, level, path);
81 this.contents.add(contents);
85 * Initialize the study step.
88 * the step sequential number
90 * the level (study or scenario) the step is applied to
94 private void initialize(final int number,
95 final Class<? extends ProjectElement> level, final String path) {
98 this.path = path + "/";
99 this.contents = new HashSet<Class<?>>();
103 * Check if the step is applied to a study or a scenario level.
106 * the study or a scenario to check the step applicability
107 * @return true if the step is applied to the given level
109 public boolean appliesTo(final Class<? extends ProjectElement> level) {
110 return (level == this.level);
114 * Check if the step can contain documents or knowledges of the given type.
118 * @return true if the step can contain data of the given type
120 public boolean mayContain(final Class<?> type) {
121 return contents.contains(type);
125 * Get the sequential number of the step.
127 * @return the sequential number of the step
129 public int getNumber() {
134 * Get data path for this step.
136 * @return data path for this step
138 public String getPath() {
144 * Return the validation cycles of result documents defined in the workflow, ordered by study activities and ending by the default
145 * validation cycle, if defined.
147 * @return the validation cycles of the workflow
149 public List<ProjectSettingsValidationCycle> getAllValidationCycles();
152 * Get a study step by its sequential number.
158 public ProjectSettingsService.Step getStep(final int number);
161 * Get ordered list of (transient) study steps.
163 * @return the list of steps from project settings
165 public List<ProjectSettingsService.Step> getAllSteps();
168 * Get file naming scheme setting.
170 * @return file naming scheme
171 * @see org.splat.service.technical.ProjectSettingsServiceImpl.FileNaming
173 public FileNaming getFileNamingScheme();
176 * Get a pattern of study references.
178 * @return the reference pattern
180 public String getReferencePattern();
183 * Get a pattern of the presentation of version numbers.
185 * @return the version numbers presentation pattern
187 public String getRevisionPattern();
190 * Load workflow configuration from the given file. <br/> Create necessary default staff in the database if it is not initialized yet.
193 * the workflow configuration file
194 * @throws IOException
195 * if there is a file reading or index creation problem
196 * @throws SQLException
197 * if there is a database population problem
199 public void configure(String filename) throws IOException, SQLException;
202 * Get steps of the given project element (study or scenario).
205 * the project element (study or scenario)
206 * @return the list of steps
208 public List<ProjectSettingsService.Step> getStepsOf(
209 Class<? extends ProjectElement> level);