1 /*****************************************************************************
5 * Creation date 06.10.2012
8 *****************************************************************************/
10 package org.splat.service;
12 import java.util.List;
14 import org.splat.dal.bo.som.ConvertsRelation;
15 import org.splat.dal.bo.som.Document;
16 import org.splat.dal.bo.som.DocumentType;
17 import org.splat.dal.bo.som.ProgressState;
18 import org.splat.dal.bo.som.ProjectElement;
19 import org.splat.dal.bo.som.Study;
20 import org.splat.dal.bo.som.Timestamp;
21 import org.splat.dal.bo.som.Document.Properties;
22 import org.splat.kernel.InvalidPropertyException;
23 import org.splat.kernel.MissedPropertyException;
24 import org.splat.kernel.MultiplyDefinedException;
25 import org.splat.kernel.NotApplicableException;
26 import org.splat.service.technical.ProjectSettingsService;
27 import org.splat.som.Revision;
28 import org.splat.som.Step;
31 * Document service interface.
33 * @author <a href="mailto:roman.kozlov@opencascade.com">Roman Kozlov (RKV)</a>
36 public interface DocumentService {
39 * Defines this document.
42 * the document to define
44 * the properties of the document
45 * @throws MissedPropertyException
46 * if a mandatory property is missed
47 * @throws InvalidPropertyException
48 * if a property doesn't exist
49 * @throws NotApplicableException
50 * if the document is undefined
51 * @see Step#createDocument(Properties)
54 public void initialize(Document aDoc, Properties dprop)
55 throws MissedPropertyException, InvalidPropertyException,
56 NotApplicableException;
59 * Find a document by its id.
63 * @return found document
65 public Document selectDocument(long index);
68 * Find a document by its reference and version.
74 * @return found document
76 public Document selectDocument(String refid, String version);
79 * Generate document reference.
84 * document properties (owner project element is used)
86 public void generateDocumentId(Document aDoc, Properties dprop);
89 * Get a directory where the document file is saved.
95 public java.io.File getSaveDirectory(Document aDoc);
98 * Extract title and reference properties from the given file.
102 * @return the extracted properties
104 public Properties extractProperties(java.io.File file);
107 * Create "Converts" relation for the given document and the given format.
113 * @return the created "Converts" relation
115 public ConvertsRelation attach(Document aDoc, String format);
118 * Create "Converts" relation for the given document, format and description.
125 * the description of the relation
126 * @return the created "Converts" relation
128 public ConvertsRelation attach(Document aDoc, String format,
132 * Build a reference (document id) for the given document in the given study basing on the given original document.
135 * the document to set set the new reference to
139 * the original document
140 * @return true if the new reference is set
142 public boolean buildReferenceFrom(Document aDoc, ProjectElement scope,
146 * Build a reference (document id) for the given document in the given study.
149 * the document to set set the new reference to
152 * @return true if the new reference is set
154 public boolean buildReferenceFrom(Document aDoc, Study scope);
160 * the document to demote
161 * @return true if demoting succeeded
163 public boolean demote(Document aDoc);
166 * Promote a document.
169 * the document to promote
171 * the timestamp of the promotion
172 * @return true if promotion succeeded
174 public boolean promote(Document aDoc, Timestamp stamp);
177 * Increments the reference count of this document following its publication in a Study step.
180 * the document to hold
183 public void hold(Document aDoc);
186 * Decrements the reference count of this document following the removal of a Publication from a Study step.
189 * the document to release
192 public void release(Document aDoc);
198 * the document to rename
200 * the new document title
201 * @throws InvalidPropertyException
202 * if the new title is empty
204 public void rename(Document aDoc, String title)
205 throws InvalidPropertyException;
208 * Update a version of the given document.
215 public void updateAs(Document aDoc, Revision newvers);
218 * Update a state of the given document.
225 public void updateAs(Document aDoc, ProgressState state);
228 * Checks if documents of this type are result of a study. A document is the result of a study when it is the result of the last step of
233 * @return true if documents of this type are result of a study.
234 * @see #isStepResult()
235 * @see #isResultOf(org.splat.service.technical.ProjectSettingsServiceImpl.Step)
237 public boolean isStudyResult(DocumentType aType);