/*****************************************************************************
- * Company EURIWARE
+ * Company OPEN CASCADE
* Application SIMAN
* File $Id$
* Creation date 06.10.2012
package org.splat.service;
+import java.util.List;
+
+import org.splat.dal.bo.som.ConvertsRelation;
import org.splat.dal.bo.som.Document;
+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.Study;
+import org.splat.dal.bo.som.Timestamp;
import org.splat.dal.bo.som.Document.Properties;
import org.splat.kernel.InvalidPropertyException;
import org.splat.kernel.MissedPropertyException;
+import org.splat.kernel.MultiplyDefinedException;
import org.splat.kernel.NotApplicableException;
+import org.splat.service.technical.ProjectSettingsService;
+import org.splat.som.Revision;
import org.splat.som.Step;
/**
* Document service interface.
*
- * @author <a href="mailto:roman.kozlov@opencascade.com">Roman Kozlov (RKV)</a>
+ * @author <a href="mailto:roman.kozlov@opencascade.com">Roman Kozlov (RKV)</a>
*
*/
public interface DocumentService {
* document properties (owner project element is used)
*/
public void generateDocumentId(Document aDoc, Properties dprop);
-
+
/**
* Get a directory where the document file is saved.
- * @param aDoc the document
+ *
+ * @param aDoc
+ * the document
* @return a directory
*/
public java.io.File getSaveDirectory(Document aDoc);
+
+ /**
+ * Extract title and reference properties from the given file.
+ *
+ * @param file
+ * the file to parse
+ * @return the extracted properties
+ */
+ public Properties extractProperties(java.io.File file);
+
+ /**
+ * Create "Converts" relation for the given document and the given format.
+ *
+ * @param aDoc
+ * the document
+ * @param format
+ * the format
+ * @return the created "Converts" relation
+ */
+ public ConvertsRelation attach(Document aDoc, String format);
+
+ /**
+ * Create "Converts" relation for the given document, format and description.
+ *
+ * @param aDoc
+ * the document
+ * @param format
+ * the format
+ * @param description
+ * the description of the relation
+ * @return the created "Converts" relation
+ */
+ public ConvertsRelation attach(Document aDoc, String format,
+ String description);
+
+ /**
+ * Build a reference (document id) for the given document in the given study basing on the given original document.
+ *
+ * @param aDoc
+ * the document to set set the new reference to
+ * @param scope
+ * the study
+ * @param lineage
+ * the original document
+ * @return true if the new reference is set
+ */
+ public boolean buildReferenceFrom(Document aDoc, ProjectElement scope,
+ Document lineage);
+
+ /**
+ * Build a reference (document id) for the given document in the given study.
+ *
+ * @param aDoc
+ * the document to set set the new reference to
+ * @param scope
+ * the study
+ * @return true if the new reference is set
+ */
+ public boolean buildReferenceFrom(Document aDoc, Study scope);
+
+ /**
+ * Demote a document.
+ *
+ * @param aDoc
+ * the document to demote
+ * @return true if demoting succeeded
+ */
+ public boolean demote(Document aDoc);
+
+ /**
+ * Promote a document.
+ *
+ * @param aDoc
+ * the document to promote
+ * @param stamp
+ * the timestamp of the promotion
+ * @return true if promotion succeeded
+ */
+ public boolean promote(Document aDoc, Timestamp stamp);
+
+ /**
+ * Increments the reference count of this document following its publication in a Study step.
+ *
+ * @param aDoc
+ * the document to hold
+ * @see #release()
+ */
+ public void hold(Document aDoc);
+
+ /**
+ * Decrements the reference count of this document following the removal of a Publication from a Study step.
+ *
+ * @param aDoc
+ * the document to release
+ * @see #hold()
+ */
+ public void release(Document aDoc);
+
+ /**
+ * Rename a document.
+ *
+ * @param aDoc
+ * the document to rename
+ * @param title
+ * the new document title
+ * @throws InvalidPropertyException
+ * if the new title is empty
+ */
+ public void rename(Document aDoc, String title)
+ throws InvalidPropertyException;
+
+ /**
+ * Update a version of the given document.
+ *
+ * @param aDoc
+ * the document
+ * @param newvers
+ * the new version
+ */
+ public void updateAs(Document aDoc, Revision newvers);
+
+ /**
+ * Update a state of the given document.
+ *
+ * @param aDoc
+ * the document
+ * @param state
+ * the new state
+ */
+ public void updateAs(Document aDoc, ProgressState state);
+
+ /**
+ * 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
+ * the study.
+ *
+ * @param aType
+ * the document type
+ * @return true if documents of this type are result of a study.
+ * @see #isStepResult()
+ * @see #isResultOf(org.splat.service.technical.ProjectSettingsServiceImpl.Step)
+ */
+ public boolean isStudyResult(DocumentType aType);
}