1 /*****************************************************************************
5 * Creation date 06.10.2012
8 *****************************************************************************/
10 package org.splat.service;
12 import java.io.FileNotFoundException;
13 import java.util.Date;
15 import org.splat.dal.bo.som.ConvertsRelation;
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.Publication;
20 import org.splat.dal.bo.som.Study;
21 import org.splat.dal.bo.som.Timestamp;
22 import org.splat.kernel.InvalidPropertyException;
23 import org.splat.kernel.NotApplicableException;
24 import org.splat.som.DocumentRights;
25 import org.splat.som.Revision;
26 import org.splat.som.Step;
29 * Publication service interface.
31 * @author <a href="mailto:roman.kozlov@opencascade.com">Roman Kozlov (RKV)</a>
33 public interface PublicationService {
36 * Copy the publication to the given project element.
39 * the publication to copy
41 * the target project element
42 * @return the created copy of the publication
44 public Publication copy(Publication aPublication, ProjectElement publisher);
47 * Returns the study Step into which the document version referenced by this publication has been published.
50 * the document publication
53 public Step getInvolvedStep(Publication aPublication);
56 * Promotes the document referenced by this publication from In-Check to Approved state, if not out-dated, and attaches the
57 * corresponding time-stamp to the document.<br/>
58 * If the promoted document is the final result of the owner study, the study is itself is promoted as well.<br/>
60 * Limitation: the way this promotion is propagated to the study supposes that the study has only ONE final result document.
63 * the document publication
65 * the date of approval
66 * @return true if the approval succeeded
67 * @see #getProgressState()
68 * @see DocumentRights#canApprove()
69 * @see DocumentType#isStudyResult()
70 * @see Study#getApproverOf(Publication)
72 public Timestamp approve(Publication aPublication, Date adate);
75 * Demotes the document referenced by this publication to In-Work state, and removes the Promoter of the document, if exist.<br/>
76 * The In-Draft state is skipped (direct demotion to In-Work) if the validation cycle of the document does not include the review step.<br/>
77 * If the demoted document is the final result of the owner study, the study is itself is demoted as well.<br/>
79 * Limitation: the way this demotion is propagated to the study supposes that the study has only ONE final result document.
82 * the document publication
83 * @return true if the demotion succeeded
84 * @see #getProgressState()
85 * @see DocumentRights#canDemote()
86 * @see DocumentType#isStudyResult()
88 public boolean demote(Publication aPublication);
91 * Undo the review operation by demoting the document referenced by this publication from In-Check to In-Draft state and removing the
93 * If the demoted document is the final result of the owner study, the study is itself is demoted as well.<br/>
95 * Limitation: the way this demotion is propagated to the study supposes that the study has only ONE final result document.
98 * the document publication
99 * @return true if the demotion succeeded
100 * @see #getProgressState()
102 * @see DocumentRights#canInvalidate()
103 * @see DocumentType#isStudyResult()
105 public boolean invalidate(Publication aPublication);
108 * Promotes the document referenced by this publication from In-Work to In-Draft or In-Check state, if not out-dated, and attaches the
109 * corresponding time-stamp to the document.<br/>
110 * The In-Draft state is skipped (direct promotion to In-Check) if the validation cycle of the document does not include the review
112 * Also, if the promoted document is the final result of the owner study, the study is itself promoted as well.<br/>
113 * This operation can be undo-ed by demote().<br/>
115 * Limitation: the way this promotion is propagated to the study supposes that the study has only ONE final result document.
117 * @param aPublication
118 * the document publication
120 * the date of promotion
121 * @return true if the promotion succeeded
122 * @see #getProgressState()
124 * @see DocumentRights#canPromote()
125 * @see DocumentType#isStudyResult()
127 public Timestamp promote(Publication aPublication, Date pdate);
130 * Promotes the document referenced by this publication from In-Draft to In-Check state, if not out-dated, and attaches the
131 * corresponding time-stamp to the document.<br/>
132 * If the promoted document is the final result of the owner study, the study is itself is promoted as well.<br/>
133 * This operation can be undo-ed by invalidate().<br/>
135 * Limitation: the way this promotion is propagated to the study supposes that the study has only ONE final result document.
137 * @param aPublication
138 * the document publication
141 * @return true if the review succeeded
142 * @see #getProgressState()
144 * @see DocumentRights#canReview()
145 * @see DocumentType#isStudyResult()
146 * @see Study#getReviewerOf(Publication)
148 public Timestamp review(Publication aPublication, Date rdate);
151 * Publishes the document referenced by this publication into the owner Project Element under the given state, the revision number of
152 * the document being automatically set accordingly. If the given state is In-Draft and the document is final result of the owner study,
153 * this automatically promotes the study to In-Draft.
155 * @param aPublication
156 * the document publication
158 * the required progress state
159 * @throws FileNotFoundException
160 * If the referenced document is empty
161 * @throws NotApplicableException
162 * If the referenced document is undefined
164 public void saveAs(Publication aPublication, ProgressState state)
165 throws FileNotFoundException, NotApplicableException;
168 * Publishes the document referenced by this publication into the owner Project Element under the given revision number.<br/>
169 * The state of the referenced document is supposed being automatically set according to the given revision number, but, due to the
170 * versioning scheme, as it is not possible to differentiate In-Work and In-Draft states, this function has been deprecated (it is
171 * currently used only for the need of integration of Microsoft Office which anyway has to be redesigned). <br/>
172 * Note: in the context of branch versioning, the given revision may be modified by an update of the branch name.
174 * @param aPublication
175 * the document publication
177 * the required revision number
178 * @throws FileNotFoundException
179 * If the referenced document is empty
180 * @throws NotApplicableException
181 * If the referenced document is undefined
184 public void saveAs(Publication aPublication, Revision newvers)
185 throws FileNotFoundException, NotApplicableException;
188 * Rename the published document.
190 * @param aPublication
191 * the publication of the document
193 * the new document title
194 * @throws InvalidPropertyException
195 * if the new title is empty
197 public void rename(Publication aPublication, String title)
198 throws InvalidPropertyException;
201 * Create "Converts" relation for the given document publication and format.
203 * @param aPublication
204 * the document publication
207 * @return the created "Converts" relation
209 public ConvertsRelation attach(Publication aPublication, String format);
212 * Create "Converts" relation for the given document publication, format and description.
214 * @param aPublication
215 * the document publication
219 * the description of the relation
220 * @return the created "Converts" relation
222 public ConvertsRelation attach(Publication aPublication, String format,
226 * Undo the out-date operation.
228 * @param aPublication
230 * @return true if the acceptance succeeds
232 * @see DocumentRights#canAccept()
234 public boolean actualize(Publication aPublication);
237 * Out-dates this publication and recursively all publications using this one. Typically, a publication is out-dated when modifying a
238 * document to which it depends.
240 * @param aPublication
243 * @see #getProgressState()
246 public void outdate(Publication aPublication);