Salome HOME
Import document action is fixed: uses relations are created now in the same transacti...
[tools/siman.git] / Workspace / Siman-Common / src / org / splat / service / PublicationService.java
index 85a16042b06c2c106693caaf54f58b20779faa02..b3b4e4fbc1a156586dac7579a8f41809ca260ae8 100644 (file)
@@ -11,7 +11,9 @@ 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;
@@ -46,34 +48,59 @@ public interface PublicationService {
         *            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
+        * 
+        * @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
         */
-       public 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;
+       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.
@@ -82,7 +109,7 @@ public interface PublicationService {
         *            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
@@ -100,7 +127,7 @@ public interface PublicationService {
         * @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
@@ -115,7 +142,7 @@ public interface PublicationService {
         * @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
@@ -130,7 +157,7 @@ public interface PublicationService {
         * @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
@@ -149,7 +176,7 @@ public interface PublicationService {
         * @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
@@ -168,12 +195,12 @@ public interface PublicationService {
         * @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
@@ -184,7 +211,7 @@ public interface PublicationService {
         * @throws NotApplicableException
         *             If the referenced document is undefined
         */
-       public void saveAs(Publication aPublication, ProgressState state)
+       void saveAs(Publication aPublication, ProgressState state)
                        throws FileNotFoundException, NotApplicableException;
 
        /**
@@ -192,7 +219,7 @@ public interface PublicationService {
         * 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
@@ -204,7 +231,8 @@ public interface PublicationService {
         *             If the referenced document is undefined
         * @deprecated
         */
-       public void saveAs(Publication aPublication, Revision newvers)
+       @Deprecated
+       void saveAs(Publication aPublication, Revision newvers)
                        throws FileNotFoundException, NotApplicableException;
 
        /**
@@ -217,7 +245,7 @@ public interface PublicationService {
         * @throws InvalidPropertyException
         *             if the new title is empty
         */
-       public void rename(Publication aPublication, String title)
+       void rename(Publication aPublication, String title)
                        throws InvalidPropertyException;
 
        /**
@@ -229,7 +257,7 @@ public interface PublicationService {
         *            the format
         * @return the created "Converts" relation
         */
-       public ConvertsRelation attach(Publication aPublication, String format);
+       ConvertsRelation attach(Publication aPublication, String format);
 
        /**
         * Create "Converts" relation for the given document publication, format and description.
@@ -242,7 +270,7 @@ public interface PublicationService {
         *            the description of the relation
         * @return the created "Converts" relation
         */
-       public ConvertsRelation attach(Publication aPublication, String format,
+       ConvertsRelation attach(Publication aPublication, String format,
                        String description);
 
        /**
@@ -254,7 +282,7 @@ public interface PublicationService {
         * @see #outdate()
         * @see DocumentRights#canAccept()
         */
-       public boolean actualize(Publication aPublication);
+       boolean actualize(Publication aPublication);
 
        /**
         * Out-dates this publication and recursively all publications using this one. Typically, a publication is out-dated when modifying a
@@ -266,5 +294,5 @@ public interface PublicationService {
         * @see #getProgressState()
         * @see #actualize()
         */
-       public void outdate(Publication aPublication);
+       void outdate(Publication aPublication);
 }