]> SALOME platform Git repositories - tools/siman.git/blobdiff - Workspace/Siman-Common/src/org/splat/service/StepServiceImpl.java
Salome HOME
Refactoring of Database, replacing SQL by DAOs calls. Methods for search by criteria...
[tools/siman.git] / Workspace / Siman-Common / src / org / splat / service / StepServiceImpl.java
index 353477ebf7f01266720ca822ad8aa8c3c725f166..d4373877c23a6064d1dbfb4228450084f951792e 100644 (file)
@@ -37,13 +37,23 @@ import org.splat.som.Revision;
 import org.splat.som.Step;
 
 /**
- * @author RKV
- * 
+ * Step service implementation.
+ * @author <a href="mailto:roman.kozlov@opencascade.com">Roman Kozlov (RKV)</a>
  */
 public class StepServiceImpl implements StepService {
 
+       /**
+        * Injected index service.
+        */
        private IndexService _indexService;
+       /**
+        * Injected document service.
+        */
        private DocumentService _documentService;
+       /**
+        * Injected simulation context service.
+        */
+       private SimulationContextService _simulationContextService;
 
        public SimulationContext addSimulationContext(Step aStep,
                        SimulationContext.Properties dprop) throws MissedPropertyException,
@@ -58,7 +68,7 @@ public class StepServiceImpl implements StepService {
        public SimulationContext addSimulationContext(Step aStep,
                        SimulationContext context) {
                // -------------------------------------------------------------------------
-               context.hold(); // Increments the reference count of simulation context
+               getSimulationContextService().hold(context); // Increments the reference count of simulation context
                if (aStep.getOwner().isSaved())
                        try {
                                Session session = Database.getSession();
@@ -117,7 +127,7 @@ public class StepServiceImpl implements StepService {
       aStep.getContex().remove(torem);
       session.update(aStep.getOwner());
       if (torem.isShared()) {
-        torem.release();
+        getSimulationContextService().release(torem);
         session.update(torem);
       } else {
        session.delete(torem);
@@ -131,7 +141,7 @@ public class StepServiceImpl implements StepService {
           getDocumentService().generateDocumentId(newdoc, dprop);
 
 //        Creation of the save directory      
-          File wdir = newdoc.getSaveDirectory();
+          File wdir = getDocumentService().getSaveDirectory(newdoc);
          if (!wdir.exists()) if (!wdir.mkdirs()) throw new IOException("Cannot create the repository vault directory");
 
 //        Identification and save
@@ -146,7 +156,7 @@ public class StepServiceImpl implements StepService {
           String refid = dprop.getReference();
           if    (refid == null)    return null;
 
-          Document  slot = Database.selectDocument(refid, new Revision().toString());
+          Document  slot = getDocumentService().selectDocument(refid, new Revision().toString());
           if ( slot == null )      return null;
           if (!slot.isUndefined()) return null;     // Should not happen
 
@@ -222,4 +232,21 @@ public class StepServiceImpl implements StepService {
        public void setDocumentService(DocumentService documentService) {
                _documentService = documentService;
        }
+
+       /**
+        * Get the simulationContextService.
+        * @return the simulationContextService
+        */
+       public SimulationContextService getSimulationContextService() {
+               return _simulationContextService;
+       }
+
+       /**
+        * Set the simulationContextService.
+        * @param simulationContextService the simulationContextService to set
+        */
+       public void setSimulationContextService(
+                       SimulationContextService simulationContextService) {
+               _simulationContextService = simulationContextService;
+       }
 }