/*****************************************************************************
- * Company EURIWARE
+ * Company OPEN CASCADE
* Application SIMAN
* File $Id$
* Creation date 06.10.2012
package org.splat.service;
import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.text.ParseException;
import java.util.Date;
+import java.util.List;
+import org.splat.dal.bo.kernel.User;
+import org.splat.dal.bo.som.ConvertsRelation;
import org.splat.dal.bo.som.DocumentType;
import org.splat.dal.bo.som.ProgressState;
import org.splat.dal.bo.som.ProjectElement;
import org.splat.dal.bo.som.Publication;
import org.splat.dal.bo.som.Study;
import org.splat.dal.bo.som.Timestamp;
+import org.splat.kernel.InvalidPropertyException;
+import org.splat.kernel.MismatchException;
+import org.splat.kernel.MissedPropertyException;
+import org.splat.kernel.MultiplyDefinedException;
import org.splat.kernel.NotApplicableException;
import org.splat.som.DocumentRights;
import org.splat.som.Revision;
* the target project element
* @return the created copy of the publication
*/
- public Publication copy(Publication aPublication, ProjectElement publisher);
+ Publication copy(Publication aPublication, ProjectElement publisher);
+
+ public Publication createDoc(final long ownerId, final Step step,
+ final long documentTypeId, final long userId, final String fname,
+ final String doctitle, final ProgressState docstate,
+ final String reference, final String version, final Date docDate,
+ final List<Long> docuses) throws MissedPropertyException,
+ InvalidPropertyException, MultiplyDefinedException, IOException,
+ NotApplicableException, InterruptedException, ParseException;
+
+ /**
+ * Create a new version of the document.
+ *
+ * @param step
+ * the study step where the document is published
+ * @param user
+ * the current user
+ * @param filename
+ * the new version file name
+ * @param docIndex
+ * the publication id
+ * @param docver
+ * new document version string, empty for external documents
+ * @param summary
+ * the version comment
+ * @param state
+ * the new state of the document
+ * @param date
+ * the new modification date
+ * @param docuses
+ * the array of documents ids used by the versioned document
+ * @param docusedby
+ * the array of impacted documents ids
+ * @throws MissedPropertyException
+ * if some mandatory property is missed
+ * @throws InvalidPropertyException
+ * if some property has invalid value
+ * @throws MultiplyDefinedException
+ * if some property occurs several times
+ * @throws IOException
+ * if file moving is failed
+ * @throws MismatchException
+ * if step number in properties doesn't match to the given step
+ * @throws NotApplicableException
+ * if publication's document is undefined
+ * @throws InterruptedException
+ * by Thread.sleep if interrupted
+ */
+ void versionDocument(Step step, User user, String filename, long docIndex,
+ String docver, String summary, ProgressState state, Date date,
+ String[] docuses, long[] docusedby) throws MissedPropertyException,
+ InvalidPropertyException, MultiplyDefinedException, IOException,
+ MismatchException, NotApplicableException, InterruptedException;
/**
* Returns the study Step into which the document version referenced by this publication has been published.
* the document publication
* @return study step
*/
- public Step getInvolvedStep(Publication aPublication);
+ Step getInvolvedStep(Publication aPublication);
/**
* Promotes the document referenced by this publication from In-Check to Approved state, if not out-dated, and attaches the
* @see DocumentType#isStudyResult()
* @see Study#getApproverOf(Publication)
*/
- public Timestamp approve(Publication aPublication, Date adate);
+ Timestamp approve(Publication aPublication, Date adate);
/**
* Demotes the document referenced by this publication to In-Work state, and removes the Promoter of the document, if exist.<br/> The
* @see DocumentRights#canDemote()
* @see DocumentType#isStudyResult()
*/
- public boolean demote(Publication aPublication);
+ boolean demote(Publication aPublication);
/**
* Undo the review operation by demoting the document referenced by this publication from In-Check to In-Draft state and removing the
* @see DocumentRights#canInvalidate()
* @see DocumentType#isStudyResult()
*/
- public boolean invalidate(Publication aPublication);
+ boolean invalidate(Publication aPublication);
/**
* Promotes the document referenced by this publication from In-Work to In-Draft or In-Check state, if not out-dated, and attaches the
* @see DocumentRights#canPromote()
* @see DocumentType#isStudyResult()
*/
- public Timestamp promote(Publication aPublication, Date pdate);
+ Timestamp promote(Publication aPublication, Date pdate);
/**
* Promotes the document referenced by this publication from In-Draft to In-Check state, if not out-dated, and attaches the
* @see DocumentType#isStudyResult()
* @see Study#getReviewerOf(Publication)
*/
- public Timestamp review(Publication aPublication, Date rdate);
+ Timestamp review(Publication aPublication, Date rdate);
/**
* Publishes the document referenced by this publication into the owner Project Element under the given state, the revision number of
* the document being automatically set accordingly. If the given state is In-Draft and the document is final result of the owner study,
- * this automatically promotes the study to In-Draft.
+ * this automatically promotes the study to In-Draft. The old publication is removed from the scenario.
*
* @param aPublication
* the document publication
* @throws NotApplicableException
* If the referenced document is undefined
*/
- public void saveAs(Publication aPublication, ProgressState state)
+ void saveAs(Publication aPublication, ProgressState state)
throws FileNotFoundException, NotApplicableException;
/**
* of the referenced document is supposed being automatically set according to the given revision number, but, due to the versioning
* scheme, as it is not possible to differentiate In-Work and In-Draft states, this function has been deprecated (it is currently used
* only for the need of integration of Microsoft Office which anyway has to be redesigned). <br/> Note: in the context of branch
- * versioning, the given revision may be modified by an update of the branch name.
+ * versioning, the given revision may be modified by an update of the branch name. The old publication is removed from the scenario.
*
* @param aPublication
* the document publication
* If the referenced document is undefined
* @deprecated
*/
- public void saveAs(Publication aPublication, Revision newvers)
+ @Deprecated
+ void saveAs(Publication aPublication, Revision newvers)
throws FileNotFoundException, NotApplicableException;
+
+ /**
+ * Rename the published document.
+ *
+ * @param aPublication
+ * the publication of the document
+ * @param title
+ * the new document title
+ * @throws InvalidPropertyException
+ * if the new title is empty
+ */
+ void rename(Publication aPublication, String title)
+ throws InvalidPropertyException;
+
+ /**
+ * Create "Converts" relation for the given document publication and format.
+ *
+ * @param aPublication
+ * the document publication
+ * @param format
+ * the format
+ * @return the created "Converts" relation
+ */
+ ConvertsRelation attach(Publication aPublication, String format);
+
+ /**
+ * Create "Converts" relation for the given document publication, format and description.
+ *
+ * @param aPublication
+ * the document publication
+ * @param format
+ * the format
+ * @param description
+ * the description of the relation
+ * @return the created "Converts" relation
+ */
+ ConvertsRelation attach(Publication aPublication, String format,
+ String description);
+
+ /**
+ * Undo the out-date operation.
+ *
+ * @param aPublication
+ * the publication
+ * @return true if the acceptance succeeds
+ * @see #outdate()
+ * @see DocumentRights#canAccept()
+ */
+ boolean actualize(Publication aPublication);
+
+ /**
+ * Out-dates this publication and recursively all publications using this one. Typically, a publication is out-dated when modifying a
+ * document to which it depends.
+ *
+ * @param aPublication
+ * the publication
+ * @see #isOutdated()
+ * @see #getProgressState()
+ * @see #actualize()
+ */
+ void outdate(Publication aPublication);
}