Salome HOME
Logger is changed to AppLogger
[tools/siman.git] / Workspace / Siman-Common / src / org / splat / service / StudyServiceImpl.java
index a9fe8b47155581055b4a83a0a6264b9c38d4b807..0af12a2baf98965dc31336e154ba1ebaa28b9a80 100644 (file)
@@ -1,10 +1,10 @@
 /*****************************************************************************
  * Company         EURIWARE
  * Application     SIMAN
- * File            $Id$ 
- * Creation date   06.10.2012
- * @author         $Author$
- * @version        $Revision$
+ * File            Id: 
+ * Creation date   02.10.2012
+ * @author         Author: Maria KRUCHININA
+ * @version        Revision: 
  *****************************************************************************/
 
 package org.splat.service;
@@ -17,6 +17,7 @@ import java.util.List;
 
 import org.apache.log4j.Logger;
 import org.hibernate.Session;
+import org.hibernate.Transaction;
 import org.splat.dal.bo.kernel.Relation;
 import org.splat.dal.bo.kernel.User;
 import org.splat.dal.bo.som.ActorRelation;
@@ -31,6 +32,7 @@ import org.splat.dal.bo.som.ProgressState;
 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.SimulationContextType;
 import org.splat.dal.bo.som.Study;
 import org.splat.dal.bo.som.ValidationCycle;
 import org.splat.dal.bo.som.ValidationCycleRelation;
@@ -41,17 +43,22 @@ import org.splat.kernel.InvalidPropertyException;
 import org.splat.kernel.MissedPropertyException;
 import org.splat.kernel.MultiplyDefinedException;
 import org.splat.kernel.UserDirectory;
+import org.splat.log.AppLogger;
 import org.splat.service.technical.IndexService;
 import org.splat.service.technical.ProjectSettingsService;
 import org.splat.som.Revision;
 
 /**
- * @author RKV
- * 
+ * This class defines all methods for creation, modification the study.
+ * @author Maria KRUCHININA
+ *
  */
 public class StudyServiceImpl implements StudyService {
 
-       public final static Logger logger = Logger.getLogger(org.splat.service.StudyServiceImpl.class);
+       /**
+        * logger for the service.
+        */
+       public final static AppLogger logger = AppLogger.getLogger(StudyServiceImpl.class);
 
        private IndexService _indexService;
 
@@ -62,7 +69,27 @@ public class StudyServiceImpl implements StudyService {
        private ProjectSettingsService _projectSettingsService;
 
        private ProjectElementService _projectElementService;
-
+       
+       /**
+        * Get the simulation context list for displaying drop-down list values populating
+        * on the "Create new study" screen.
+        * {@inheritDoc}
+        * @see org.splat.service.StudyService#getSimulationContextList()
+        */
+       public List<SimulationContext> getSimulationContextList() {
+               //TODO: remove the commit transaction ...
+               Session      connex  = Database.getSession();
+               Transaction  transax = connex.beginTransaction();
+               
+               SimulationContext.Properties cprop   = new SimulationContext.Properties();
+           SimulationContextType        product = SimulationContext.selectType("product");
+           List<SimulationContext> resList = Database.selectSimulationContextsWhere(cprop.setType(product));
+           
+           transax.commit();
+                 
+           return resList;
+       }
+       
        public Study selectStudy(int index) {
                // -------------------------------------------
                StringBuffer query = new StringBuffer("from Study where rid='").append(
@@ -122,17 +149,6 @@ public class StudyServiceImpl implements StudyService {
                return added;
        }
 
-       /**
-        * @return
-        */
-       public StepService getStepService() {
-               return _stepService;
-       }
-
-       public void setStepService(StepService stepService) {
-               _stepService = stepService;
-       }
-
        public SimulationContext addProjectContext(Study aStudy,
                        SimulationContext context) {
                // ----------------------------------------------------------------------
@@ -495,4 +511,20 @@ public class StudyServiceImpl implements StudyService {
                        ProjectElementService projectElementService) {
                _projectElementService = projectElementService;
        }
+
+       /**
+        * Get the stepService.
+        * @return the stepService
+        */
+       public StepService getStepService() {
+               return _stepService;
+       }
+
+       /**
+        * Set the stepService.
+        * @param stepService the stepService to set
+        */
+       public void setStepService(StepService stepService) {
+               _stepService = stepService;
+       }
 }