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.DocumentType;
19 import org.splat.dal.bo.som.ProjectElement;
20 import org.splat.service.technical.ProjectSettingsServiceImpl.FileNaming;
21 import org.splat.service.technical.ProjectSettingsServiceImpl.ProjectSettingsValidationCycle;
24 * Project settings service interface.
26 public interface ProjectSettingsService {
29 * Transient study step data.
33 * The sequential number of the step.
37 * The step's key name.
42 * The owner of the step: study or scenario.
44 private Class<? extends ProjectElement> _level;
46 * Set of Document and/or Knowledge applicable on this step.
48 protected Set<Class<?>> _contents;
50 * Data path for this step.
54 * Executable module for this step.
56 private String _module;
59 * Create a transient study step definition.
62 * the step sequential number
64 * the level (study or scenario) the step is applied to
68 Step(final int number, final Class<? extends ProjectElement> level,
70 this.initialize(number, level, path);
74 * Create a transient study step definition.
77 * the step sequential number
79 * the level (study or scenario) the step is applied to
81 * the set of applicable data types
85 @SuppressWarnings("unused")
86 private Step(final int number,
87 final Class<? extends ProjectElement> level,
88 final Class<?> contents, final String path) {
89 this.initialize(number, level, path);
90 this._contents.add(contents);
94 * Initialize the study step.
97 * the step sequential number
99 * the level (study or scenario) the step is applied to
103 private void initialize(final int number,
104 final Class<? extends ProjectElement> level, final String path) {
105 this._number = number;
107 this._path = path + "/";
108 this._contents = new HashSet<Class<?>>();
112 * Check if the step is applied to a study or a scenario level.
115 * the study or a scenario to check the step applicability
116 * @return true if the step is applied to the given level
118 public boolean appliesTo(final Class<? extends ProjectElement> level) {
119 return (level == this._level);
123 * Check if the step can contain documents or knowledges of the given type.
127 * @return true if the step can contain data of the given type
129 public boolean mayContain(final Class<?> type) {
130 return _contents.contains(type);
134 * Get the sequential number of the step.
136 * @return the sequential number of the step
138 public int getNumber() {
143 * Get data path for this step.
145 * @return data path for this step
147 public String getPath() {
156 public String getModule() {
166 public void setModule(final String module) {
175 public String getKey() {
185 public void setKey(final String key) {
191 * Return the validation cycles of result documents defined in the workflow, ordered by study activities and ending by the default
192 * validation cycle, if defined.
194 * @return the validation cycles of the workflow
196 List<ProjectSettingsValidationCycle> getAllValidationCycles();
199 * Get a study step by its sequential number.
205 ProjectSettingsService.Step getStep(final int number);
208 * Get ordered list of (transient) study steps.
210 * @return the list of steps from project settings
212 List<ProjectSettingsService.Step> getAllSteps();
215 * Get file naming scheme setting.
217 * @return file naming scheme
218 * @see org.splat.service.technical.ProjectSettingsServiceImpl.FileNaming
220 FileNaming getFileNamingScheme();
223 * Get a pattern of study references.
225 * @return the reference pattern
227 String getReferencePattern();
230 * Get a pattern of the presentation of version numbers.
232 * @return the version numbers presentation pattern
234 String getRevisionPattern();
237 * Load workflow configuration from the given file. <br/> Create necessary default staff in the database if it is not initialized yet.
240 * the workflow configuration file
241 * @throws IOException
242 * if there is a file reading or index creation problem
243 * @throws SQLException
244 * if there is a database population problem
246 void configure(String filename) throws IOException, SQLException;
249 * Check if a file of the given format should be imported during check-in of a document of the given type.
255 * @return true if file should be imported
257 boolean doImport(final String type, final String format);
260 * Get default document type for the given file format on the given study step.
265 * the file format (extension)
266 * @return document type
268 DocumentType getDefaultDocumentType(final Step step, final String format);
271 * Get the list of default formats for the given study step.
275 * @return list of formats (file extensions)
277 List<String> getDefaultFormats(final Step step);