Salome HOME
Default document types mappings are moved from application settings (my.xml) to proje...
[tools/siman.git] / Workspace / Siman-Common / src / org / splat / service / StepServiceImpl.java
index 9df836e407d486653ed191c8fb10ad4cbc4083ad..281d57c341852330b919b6402c32cbeb2208f630 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * Company         EURIWARE
+ * Company         OPEN CASCADE
  * Application     SIMAN
  * File            $Id$ 
  * Creation date   06.10.2012
@@ -9,40 +9,53 @@
 
 package org.splat.service;
 
-import java.io.File;
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Set;
 
-import org.hibernate.Session;
 import org.splat.dal.bo.kernel.Relation;
+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.File;
 import org.splat.dal.bo.som.KnowledgeElement;
 import org.splat.dal.bo.som.Publication;
 import org.splat.dal.bo.som.Scenario;
 import org.splat.dal.bo.som.SimulationContext;
-import org.splat.dal.bo.som.Study;
 import org.splat.dal.bo.som.UsedByRelation;
 import org.splat.dal.bo.som.UsesRelation;
 import org.splat.dal.bo.som.VersionsRelation;
-import org.splat.dal.dao.som.Database;
 import org.splat.dal.dao.som.DocumentDAO;
+import org.splat.dal.dao.som.FileDAO;
+import org.splat.dal.dao.som.ProjectElementDAO;
+import org.splat.dal.dao.som.SimulationContextDAO;
+import org.splat.dal.dao.som.VersionsRelationDAO;
 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.log.AppLogger;
 import org.splat.service.technical.IndexService;
+import org.splat.service.technical.ProjectSettingsService;
 import org.splat.som.Revision;
 import org.splat.som.Step;
 import org.springframework.transaction.annotation.Transactional;
 
 /**
  * Step service implementation.
+ * 
  * @author <a href="mailto:roman.kozlov@opencascade.com">Roman Kozlov (RKV)</a>
  */
 public class StepServiceImpl implements StepService {
 
+       /**
+        * logger for the service.
+        */
+       public final static AppLogger LOG = AppLogger
+                       .getLogger(StepServiceImpl.class);
        /**
         * Injected index service.
         */
@@ -51,51 +64,91 @@ public class StepServiceImpl implements StepService {
         * Injected document service.
         */
        private DocumentService _documentService;
+       /**
+        * Injected document type service.
+        */
+       private DocumentTypeService _documentTypeService;
        /**
         * Injected document DAO.
         */
        private DocumentDAO _documentDAO;
+       /**
+        * Injected file DAO.
+        */
+       private FileDAO _fileDAO;
        /**
         * Injected simulation context service.
         */
        private SimulationContextService _simulationContextService;
+       /**
+        * Injected simulation context DAO.
+        */
+       private SimulationContextDAO _simulationContextDAO;
+       /**
+        * Injected project element DAO.
+        */
+       private ProjectElementDAO _projectElementDAO;
+       /**
+        * Injected versions relation DAO.
+        */
+       private VersionsRelationDAO _versionsRelationDAO;
+       /**
+        * Injected project service.
+        */
+       private ProjectSettingsService _projectSettings;
 
-       public SimulationContext addSimulationContext(Step aStep,
-                       SimulationContext.Properties dprop) throws MissedPropertyException,
-                       InvalidPropertyException, MultiplyDefinedException,
-                       RuntimeException {
+       /**
+        * {@inheritDoc}
+        * 
+        * @see org.splat.service.StepService#addSimulationContext(org.splat.som.Step, org.splat.dal.bo.som.SimulationContext.Properties)
+        */
+       public SimulationContext addSimulationContext(final Step aStep,
+                       final SimulationContext.Properties dprop) throws MissedPropertyException,
+                       InvalidPropertyException, MultiplyDefinedException {
                SimulationContext context = new SimulationContext(dprop.setStep(aStep
                                .getStep()));
                return addSimulationContext(aStep, context);
        }
 
-       public SimulationContext addSimulationContext(Step aStep,
-                       SimulationContext context) {
+       /**
+        * {@inheritDoc}
+        * 
+        * @see org.splat.service.StepService#addSimulationContext(org.splat.som.Step, org.splat.dal.bo.som.SimulationContext)
+        */
+       @Transactional
+       public SimulationContext addSimulationContext(final Step aStep,
+                       final SimulationContext context) {
+               SimulationContext res = null;
                getSimulationContextService().hold(context); // Increments the reference count of simulation context
-               if (aStep.getOwner().isSaved())
+               if (aStep.getOwner().isSaved()) {
                        try {
-                               Session session = Database.getSession();
-                               IndexService lucin = getIndexService();
-
-                               if (!context.isSaved())
-                                       session.save(context);
+                               if (!context.isSaved()) {
+                                       getSimulationContextDAO().create(context);
+                               }
                                aStep.getOwner().add(context);
                                aStep.getContex().add(context); // The context is also referenced from this (transient) Step
-                               session.update(aStep.getOwner());
-                               updateKnowledgeElementsIndex(aStep, lucin);
+                               getProjectElementDAO().update(aStep.getOwner());
+                               updateKnowledgeElementsIndex(aStep);
+                               res = context;
                        } catch (Exception error) {
-                               return null;
+                               LOG.debug(error.getMessage(), error);
                        }
-               else { // Happens when copying a scenario
+               else { // Happens when copying a scenario
                        aStep.getOwner().add(context);
                        aStep.getContex().add(context); // The context is also referenced from this (transient) Step
                        // In case of owner scenario, the Knowledge Element index will be updated later, when saving the scenario
+                       res = context;
                }
-               return context;
+               return res;
        }
 
-       private void updateKnowledgeElementsIndex(Step aStep, IndexService lucin) {
-               // ------------------------------------------------------
+       /**
+        * Update lucene index of knowledge elements of a scenario or a study which the given step is related to.
+        * 
+        * @param aStep
+        *            the step (activity)
+        */
+       private void updateKnowledgeElementsIndex(final Step aStep) {
                Scenario[] scenarii;
                if (aStep.getOwner() instanceof Scenario) {
                        scenarii = new Scenario[1];
@@ -110,118 +163,329 @@ public class StepServiceImpl implements StepService {
                                for (Iterator<KnowledgeElement> j = knelm.iterator(); j
                                                .hasNext();) {
                                        KnowledgeElement kelm = j.next();
-                                       lucin.update(kelm);
+                                       getIndexService().update(kelm);
                                }
-                               scene.updateMyIndex(lucin);
+                               updateScenarioIndex(scene);
                        }
                } catch (Exception error) {
-                       // logger.error("Unable to re-index Knowledge Elements, reason:", error);
+                       LOG.error("Unable to re-index Knowledge Elements, reason:",
+                                       error);
                }
        }
 
-    public boolean removeSimulationContext (Step aStep, SimulationContext context) {
-//  ------------------------------------------------------------------
-      SimulationContext  torem   = aStep.getSimulationContext(context.getIndex());
-      Session            session = Database.getSession();
-
-      if (torem == null)        return false;
-      if (!aStep.getOwner().remove(torem)) return false;
-
-      aStep.getContex().remove(torem);
-      session.update(aStep.getOwner());
-      if (torem.isShared()) {
-        getSimulationContextService().release(torem);
-        session.update(torem);
-      } else {
-       session.delete(torem);
-      }
-      return true;
-    }
-
-    @Transactional
-    public Publication createDocument (Step aStep, Document.Properties dprop) throws MissedPropertyException, InvalidPropertyException, MultiplyDefinedException, IOException {
-          Document  newdoc = new Document(dprop.setOwner(aStep.getOwner()).setStep(aStep.getStep()));
-          getDocumentService().generateDocumentId(newdoc, dprop);
-
-//        Creation of the save directory      
-          File wdir = getDocumentService().getSaveDirectory(newdoc);
-         if (!wdir.exists()) if (!wdir.mkdirs()) throw new IOException("Cannot create the repository vault directory");
-
-//        Identification and save
-          newdoc.buildReferenceFrom(aStep.getOwnerStudy());
-          getDocumentDAO().create(newdoc);
-
-          return  new Publication(newdoc, aStep.getOwner());
-        }
-
-        public Publication assignDocument (Step aStep, Document.Properties dprop) throws MissedPropertyException, InvalidPropertyException, NotApplicableException {
-          String refid = dprop.getReference();
-          if    (refid == null)    return null;
-
-          Document  slot = getDocumentService().selectDocument(refid, new Revision().toString());
-          if ( slot == null )      return null;
-          if (!slot.isUndefined()) return null;     // Should not happen
-
-          getDocumentService().initialize(slot, dprop.setOwner(aStep.getOwnerStudy()));
-          return  new Publication(slot, aStep.getOwner());
-        }
-
-        public Publication versionDocument (Step aStep, Publication base) throws MissedPropertyException, InvalidPropertyException, MultiplyDefinedException, IOException, MismatchException {
-    //  -----------------------------------------------------
-          return versionDocument(aStep, base, new Document.Properties());
-        }
-
-        public Publication versionDocument (Step aStep, Publication base, String reason) throws MissedPropertyException, InvalidPropertyException, MultiplyDefinedException, IOException, MismatchException {
-    //  --------------------------------------------------------------------
-          return versionDocument(aStep, base, new Document.Properties().setDescription(reason));
-        }
-
-        @Transactional
-        public Publication versionDocument (Step aStep, Publication base, Document.Properties dprop) throws MissedPropertyException, InvalidPropertyException, MultiplyDefinedException, IOException, MismatchException {
-    //  --------------------------------------------------------------------------------
-          Document previous = base.value();
-          
-          dprop.setDocument(previous);        // Initializes the Step property
-          if (dprop.getStep().getNumber() != aStep.getNumber()) throw new MismatchException();
-
-          if (dprop.getAuthor() == null) dprop.setAuthor(previous.getAuthor());
-          String    summary = dprop.getDescription();
-
-//        Creation of the document
-          Document  newdoc = new Document(dprop.setOwner(aStep.getOwner()).setStep(aStep.getStep()));
-          getDocumentService().generateDocumentId(newdoc, dprop);
-          newdoc.buildReferenceFrom(aStep.getOwner(), previous);
-          getDocumentDAO().create(newdoc);
-
-//        Versioning
-          if (summary == null) newdoc.addRelation( new VersionsRelation(newdoc, previous) );
-          else                 newdoc.addRelation( new VersionsRelation(newdoc, previous, summary) );
-
-//        Update of usedby relations, if exist
-          List<Relation> relist = previous.getRelations(UsedByRelation.class);
-          Study          scope  = aStep.getOwnerStudy();
-          for (Iterator<Relation> i=relist.iterator(); i.hasNext();) {
-            UsedByRelation relation  = (UsedByRelation)i.next();
-            Document       relatedoc = relation.getTo();
-            if (scope.shares(relatedoc)) relatedoc.addRelation( new UsesRelation(relatedoc, newdoc) );
-            else                         relation.moveTo(newdoc);
-          }
-          return  new Publication(newdoc, aStep.getOwner());
-        }
-
-       /**
-        * @return
+       /**
+        * Update lucene index for knowledge elements of the scenario.
+        * 
+        * @param scene
+        *            the scenario
+        * @throws IOException
+        *             if can't update lucene index
         */
-       public IndexService getIndexService() {
-               return _indexService;
+       private void updateScenarioIndex(final Scenario scene) throws IOException {
+               if (scene.getUcase() == null) {
+                       for (Iterator<KnowledgeElement> i = scene.getKnowledgeElements()
+                                       .iterator(); i.hasNext();) {
+                               KnowledgeElement kelm = i.next();
+                               if (!kelm.getType().equals("usecase")) {
+                                       continue;
+                               }
+                               scene.setUcase(kelm);
+                               break;
+                       }
+               }
+               getIndexService().update(scene.getUcase());
        }
 
-       public void setIndexService(IndexService indexService) {
-               _indexService = indexService;
+       /**
+        * {@inheritDoc}
+        * 
+        * @see org.splat.service.StepService#removeSimulationContext(org.splat.som.Step, org.splat.dal.bo.som.SimulationContext)
+        */
+       @Transactional
+       public boolean removeSimulationContext(final Step aStep, final SimulationContext context) {
+               SimulationContext torem = aStep
+                               .getSimulationContext(context.getIndex());
+
+               boolean isOk = (torem != null) && (aStep.getOwner().remove(torem));
+               if (isOk) {
+
+                       aStep.getContex().remove(torem);
+                       getProjectElementDAO().update(aStep.getOwner());
+                       if (torem.isShared()) {
+                               getSimulationContextService().release(torem);
+                               getSimulationContextDAO().update(torem);
+                       } else {
+                               getSimulationContextDAO().delete(torem);
+                       }
+               }
+               return isOk;
+       }
+
+       /**
+        * {@inheritDoc}
+        * 
+        * @see org.splat.service.StepService#createDocument(org.splat.som.Step, org.splat.dal.bo.som.Document.Properties)
+        */
+       @Transactional
+       public Publication createDocument(final Step aStep, final Document.Properties dprop)
+                       throws MissedPropertyException, InvalidPropertyException,
+                       MultiplyDefinedException, IOException {
+               Document newdoc = new Document(dprop.setOwner(aStep.getOwner())
+                               .setStep(aStep.getStep()));
+               getDocumentService().generateDocumentId(newdoc, dprop);
+
+               // Creation of the save directory
+               java.io.File wdir = getDocumentService().getSaveDirectory(newdoc);
+               if ((!wdir.exists()) && (!wdir.mkdirs())) {
+                       throw new IOException(
+                                       "Cannot create the repository vault directory");
+               }
+
+               // Identification and save
+               getDocumentService().buildReferenceFrom(newdoc, aStep.getOwnerStudy());
+               getDocumentDAO().create(newdoc);
+
+               return new Publication(newdoc, aStep.getOwner());
+       }
+
+       /**
+        * {@inheritDoc}
+        * 
+        * @see org.splat.service.StepService#assignDocument(org.splat.som.Step, org.splat.dal.bo.som.Document.Properties)
+        */
+       public Publication assignDocument(final Step aStep,
+                       final Document.Properties dprop) throws MissedPropertyException,
+                       InvalidPropertyException, NotApplicableException {
+               String refid = dprop.getReference();
+               Publication res = null;
+               if (refid != null) {
+                       Document slot = getDocumentService().selectDocument(refid,
+                                       new Revision().toString());
+                       if ((slot != null) && (slot.isUndefined())) {
+                               getDocumentService().initialize(slot,
+                                               dprop.setOwner(aStep.getOwnerStudy()));
+                               res = new Publication(slot, aStep.getOwner());
+                       }
+               }
+               return res;
+       }
+
+       /**
+        * Create a new version of a document in the given study step.
+        * 
+        * @param aStep
+        *            the study step
+        * @param base
+        *            the base document published version
+        * @return the new version publication
+        * @throws MissedPropertyException
+        *             if a mandatory property is missed
+        * @throws InvalidPropertyException
+        *             if some property doesn't exist
+        * @throws MultiplyDefinedException
+        *             if some property is defined several times
+        * @throws IOException
+        *             if a file system error occurs
+        * @throws MismatchException
+        *             if the document is not applicable to the given study step
+        */
+       public Publication versionDocument(final Step aStep, final Publication base)
+                       throws MissedPropertyException, InvalidPropertyException,
+                       MultiplyDefinedException, IOException, MismatchException {
+               return versionDocument(aStep, base, new Document.Properties());
+       }
+
+       /**
+        * Create a new version of a document in the given study step.
+        * 
+        * @param aStep
+        *            the study step
+        * @param base
+        *            the base document published version
+        * @param reason
+        *            the comment for the new version
+        * @return the new version publication
+        * @throws MissedPropertyException
+        *             if a mandatory property is missed
+        * @throws InvalidPropertyException
+        *             if some property doesn't exist
+        * @throws MultiplyDefinedException
+        *             if some property is defined several times
+        * @throws IOException
+        *             if a file system error occurs
+        * @throws MismatchException
+        *             if the document is not applicable to the given study step
+        */
+       public Publication versionDocument(final Step aStep, final Publication base,
+                       final String reason) throws MissedPropertyException,
+                       InvalidPropertyException, MultiplyDefinedException, IOException,
+                       MismatchException {
+               return versionDocument(aStep, base, new Document.Properties()
+                               .setDescription(reason));
+       }
+
+       /**
+        * Create a new version of a document in the given study step.
+        * 
+        * @param aStep
+        *            the study step
+        * @param base
+        *            the base document published version
+        * @param dprop
+        *            properties of the new version
+        * @return the new version publication
+        * @throws MissedPropertyException
+        *             if a mandatory property is missed
+        * @throws InvalidPropertyException
+        *             if some property doesn't exist
+        * @throws MultiplyDefinedException
+        *             if some property is defined several times
+        * @throws IOException
+        *             if a file system error occurs
+        * @throws MismatchException
+        *             if the document is not applicable to the given study step
+        */
+       @Transactional
+       public Publication versionDocument(final Step aStep, final Publication base,
+                       final Document.Properties dprop) throws MissedPropertyException,
+                       InvalidPropertyException, MultiplyDefinedException, IOException,
+                       MismatchException {
+               Document previous = base.value();
+
+               dprop.setDocument(previous, getProjectSettings().getStep(base.getStep().getNumber())); // Initializes the Step property
+               if (dprop.getStep().getNumber() != aStep.getNumber()) {
+                       throw new MismatchException();
+               }
+
+               if (dprop.getAuthor() == null) {
+                       dprop.setAuthor(previous.getAuthor());
+               }
+               String summary = dprop.getDescription();
+
+               // Creation of the document
+               Document newdoc = new Document(dprop.setOwner(aStep.getOwner())
+                               .setStep(aStep.getStep()));
+               getDocumentService().generateDocumentId(newdoc, dprop);
+               getDocumentService().buildReferenceFrom(newdoc, aStep.getOwner(),
+                               previous);
+               getDocumentDAO().create(newdoc);
+
+               // Versioning
+               VersionsRelation aRel;
+               aRel = new VersionsRelation(newdoc, previous, summary);
+//             getVersionsRelationDAO().create(aRel);
+               newdoc.addRelation(aRel);
+               
+               // Update of usedby relations, if exist
+/* RKV: Consider the new version as not used by old dependent documents. 
+ * So these documents must be marked as outdated then.
+               List<Relation> relist = previous.getRelations(UsedByRelation.class);
+               Study scope = aStep.getOwnerStudy();
+               for (Iterator<Relation> i = relist.iterator(); i.hasNext();) {
+                       UsedByRelation relation = (UsedByRelation) i.next();
+                       Document relatedoc = relation.getTo();
+                       if (scope.shares(relatedoc)) {
+                               relatedoc.addRelation(new UsesRelation(relatedoc, newdoc));
+                       } else {
+                               relation.moveTo(newdoc);
+                       }
+               }
+*/
+               return new Publication(newdoc, aStep.getOwner());
+       }
+
+       /**
+        * Get document types which are applicable for the given study step (activity).
+        * 
+        * @param aStep
+        *            the study step
+        * @return the list of document types
+        */
+       public List<DocumentType> getValidDocumentTypes(final Step aStep) {
+               return getDocumentTypeService().selectTypesOf(aStep.getStep());
+       }
+
+       /**
+        * Add a document publication to the given step.
+        * 
+        * @param aStep
+        *            the target study step
+        * @param newdoc
+        *            the document publication to add
+        * @return true if publication succeeded
+        */
+       public boolean add(final Step aStep, final Publication newdoc) {
+               boolean res = aStep.getOwner().add(newdoc); // Updates the study in memory
+               if (res) {
+                       aStep.getDocuments().add(0, newdoc); // Updates this step
+                       getDocumentService().hold(newdoc.value()); // Increments the configuration tag count of document
+                       // If not yet saved, the Publication MUST NOT be saved here, although this creates a temporary inconsistent state into the
+                       // database (it will be saved later by cascading the update of owner scenario).
+               }
+               return res;
+       }
+
+       /**
+        * Remove a document publication from the given step.
+        * 
+        * @param aStep
+        *            the study step
+        * @param oldoc
+        *            the document publication to remove
+        * @return true if removing of the publication succeeded
+        */
+       public boolean remove(final Step aStep, final Publication oldoc) {
+               boolean res = aStep.getOwner().remove(oldoc); // Updates the study in memory
+               if (res) {
+                       aStep.getDocuments().remove(oldoc); // Updates this step
+                       getDocumentService().release(oldoc.value()); // Decrements the configuration tag count of document
+                       // The publication becoming orphan, it should automatically be removed from the database when updating of owner scenario.
+               }
+               return res;
+       }
+
+       /**
+        * Remove a document from the given step.
+        * 
+        * @param aStep
+        *            the study step
+        * @param doctag
+        *            the document publication
+        * @return true if removing of the document succeeded
+        */
+       @Transactional
+       public boolean removeDocument(final Step aStep, final Publication doctag) {
+               Document value = doctag.value();
+               getDocumentDAO().update(value);
+               Publication torem = aStep.getDocument(value.getIndex());
+
+               boolean res = (torem != null);
+               if (res) {
+                       remove(aStep, torem);
+                       getProjectElementDAO().update(aStep.getOwner());
+                       if (!value.isPublished() && !value.isVersioned()) { // The referenced document is no more used
+                               Set<Relation> links = value.getAllRelations(); // Get all relation of the document to remove them
+                               List<Document> using = new ArrayList<Document>();
+                               for (Iterator<Relation> i = links.iterator(); i.hasNext();) {
+                                       Relation link = i.next();
+                                       if (link.getClass().equals(ConvertsRelation.class)) { // File conversion
+                                               getFileDAO().delete((File) link.getTo()); // The corresponding physical file is not removed from the vault
+                                       } else if (link.getClass().equals(UsesRelation.class)) { // Document dependency
+                                               using.add((Document) link.getTo());
+                                       }
+                               }
+                               for (Iterator<Document> i = using.iterator(); i.hasNext();) {
+                                       i.next().removeRelation(UsedByRelation.class, value); // TODO: RKV: don't use Database.getSession in removeRelation
+                               }
+                               getDocumentDAO().delete(value); // The corresponding physical file is not removed from the vault
+                       }
+               }
+               return res;
        }
 
        /**
         * Get the documentService.
+        * 
         * @return the documentService
         */
        public DocumentService getDocumentService() {
@@ -230,14 +494,17 @@ public class StepServiceImpl implements StepService {
 
        /**
         * Set the documentService.
-        * @param documentService the documentService to set
+        * 
+        * @param documentService
+        *            the documentService to set
         */
-       public void setDocumentService(DocumentService documentService) {
+       public void setDocumentService(final DocumentService documentService) {
                _documentService = documentService;
        }
 
        /**
         * Get the simulationContextService.
+        * 
         * @return the simulationContextService
         */
        public SimulationContextService getSimulationContextService() {
@@ -246,15 +513,18 @@ public class StepServiceImpl implements StepService {
 
        /**
         * Set the simulationContextService.
-        * @param simulationContextService the simulationContextService to set
+        * 
+        * @param simulationContextService
+        *            the simulationContextService to set
         */
        public void setSimulationContextService(
-                       SimulationContextService simulationContextService) {
+                       final SimulationContextService simulationContextService) {
                _simulationContextService = simulationContextService;
        }
 
        /**
         * Get the documentDAO.
+        * 
         * @return the documentDAO
         */
        public DocumentDAO getDocumentDAO() {
@@ -263,9 +533,143 @@ public class StepServiceImpl implements StepService {
 
        /**
         * Set the documentDAO.
-        * @param documentDAO the documentDAO to set
+        * 
+        * @param documentDAO
+        *            the documentDAO to set
         */
-       public void setDocumentDAO(DocumentDAO documentDAO) {
+       public void setDocumentDAO(final DocumentDAO documentDAO) {
                _documentDAO = documentDAO;
        }
+
+       /**
+        * Get the simulationContextDAO.
+        * 
+        * @return the simulationContextDAO
+        */
+       public SimulationContextDAO getSimulationContextDAO() {
+               return _simulationContextDAO;
+       }
+
+       /**
+        * Set the simulationContextDAO.
+        * 
+        * @param simulationContextDAO
+        *            the simulationContextDAO to set
+        */
+       public void setSimulationContextDAO(
+                       final SimulationContextDAO simulationContextDAO) {
+               _simulationContextDAO = simulationContextDAO;
+       }
+
+       /**
+        * Get the projectElementDAO.
+        * 
+        * @return the projectElementDAO
+        */
+       public ProjectElementDAO getProjectElementDAO() {
+               return _projectElementDAO;
+       }
+
+       /**
+        * Set the projectElementDAO.
+        * 
+        * @param projectElementDAO
+        *            the projectElementDAO to set
+        */
+       public void setProjectElementDAO(final ProjectElementDAO projectElementDAO) {
+               _projectElementDAO = projectElementDAO;
+       }
+
+       /**
+        * Get the indexService.
+        * 
+        * @return the indexService
+        */
+       public IndexService getIndexService() {
+               return _indexService;
+       }
+
+       /**
+        * Set the indexService.
+        * 
+        * @param indexService
+        *            the indexService to set
+        */
+       public void setIndexService(final IndexService indexService) {
+               _indexService = indexService;
+       }
+
+       /**
+        * Get the fileDAO.
+        * 
+        * @return the fileDAO
+        */
+       public FileDAO getFileDAO() {
+               return _fileDAO;
+       }
+
+       /**
+        * Set the fileDAO.
+        * 
+        * @param fileDAO
+        *            the fileDAO to set
+        */
+       public void setFileDAO(final FileDAO fileDAO) {
+               _fileDAO = fileDAO;
+       }
+
+       /**
+        * Get the documentTypeService.
+        * 
+        * @return the documentTypeService
+        */
+       public DocumentTypeService getDocumentTypeService() {
+               return _documentTypeService;
+       }
+
+       /**
+        * Set the documentTypeService.
+        * 
+        * @param documentTypeService
+        *            the documentTypeService to set
+        */
+       public void setDocumentTypeService(final DocumentTypeService documentTypeService) {
+               _documentTypeService = documentTypeService;
+       }
+
+       /**
+        * Get the versionsRelationDAO.
+        * @return the versionsRelationDAO
+        */
+       public VersionsRelationDAO getVersionsRelationDAO() {
+               return _versionsRelationDAO;
+       }
+
+       /**
+        * Set the versionsRelationDAO.
+        * @param versionsRelationDAO the versionsRelationDAO to set
+        */
+       public void setVersionsRelationDAO(final VersionsRelationDAO versionsRelationDAO) {
+               _versionsRelationDAO = versionsRelationDAO;
+       }
+
+       /**
+        * Get project settings.
+        * 
+        * @return Project settings service
+        */
+       private ProjectSettingsService getProjectSettings() {
+               return _projectSettings;
+       }
+
+       /**
+        * Set project settings service.
+        * 
+        * @param projectSettingsService
+        *            project settings service
+        */
+       public void setProjectSettings(
+                       final ProjectSettingsService projectSettingsService) {
+               _projectSettings = projectSettingsService;
+       }
 }