]> SALOME platform Git repositories - tools/siman.git/commitdiff
Salome HOME
createNewStudy ws-method is implemented
authormka <mka@opencascade.com>
Wed, 13 Mar 2013 08:31:45 +0000 (08:31 +0000)
committermka <mka@opencascade.com>
Wed, 13 Mar 2013 08:31:45 +0000 (08:31 +0000)
Workspace/Siman-WS/src/org/splat/ws_server/service/salome/SimanSalomeService.java
Workspace/Siman-WS/src/org/splat/ws_server/service/salome/SimanSalomeServiceImpl.java

index d88dbad7d34d0f25de2db3895b4be7065f3f4f66..4027198a7105d630896a99ebd072d47b50456efd 100644 (file)
@@ -42,4 +42,22 @@ public interface SimanSalomeService {
         * @param userId the user ID
         **/
        String checkIn(final String fileURL, final Long scenarioId, final Long userId);
+       
+       /**
+        * Create new study from python - client.
+        * @param studyName new study name
+        * @param productName product name
+        * @param userName creator(user) name
+        * @param description the study description
+        * @return string contains information about new study Id
+        */
+       String createNewStudy(final String userName, final String studyName, final String productName, final String description);
+       
+       /**
+        * Assign the new simulation context to the existing study.
+        * @param studyId - the target study id.
+        * @param contextName - new context name.
+        * @return success or not.
+        */
+       String assignSimulationContext(final Long studyId, final String contextName);
 }
index 8088c2d13741a4e7ac0272eab31b3c6e4dc46e60..d1f881fa1ea4721cc89da0286208fe63aefd84bd 100644 (file)
@@ -309,7 +309,52 @@ public class SimanSalomeServiceImpl implements SimanSalomeService, ServletContex
                        return "ERROR";
                }
        }
+       
+       //================ Python client methods.
+       
+       /**
+        * 
+        * {@inheritDoc}
+        * @see org.splat.ws_server.service.salome.SimanSalomeService#createNewStudy(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
+        */
+       public String createNewStudy(final String userName, final String studyName, final String productName, final String description) {
 
+               long resultId = 0;
+               
+               if ("".equals(userName)) {
+                       return "Please enter the not empty user name.";
+               }
+               if ("".equals(studyName)) {
+                       return "Please enter the not empty study name.";
+               }
+               if ("".equals(productName)) {
+                       return "Please enter the not empty product name.";
+               }
+               if ("".equals(description)) {
+                       return "Please enter the not empty description.";
+               }
+               
+               try {
+                       resultId = _scenarioService.createStudy(userName, studyName, productName, description);
+               } catch (InvalidPropertyException e) {
+                       return e.getMessage();
+               } catch (MissedPropertyException e) {
+                       return e.getMessage();
+               } catch (MultiplyDefinedException e) {
+                       return e.getMessage();
+               }
+               return "New study is successfully created with id = " + String.valueOf(resultId);
+       }
+       
+       /**
+        * 
+        * {@inheritDoc}
+        * @see org.splat.ws_server.service.salome.SimanSalomeService#assignSimulationContext(java.lang.Long, java.lang.String)
+        */
+       public String assignSimulationContext(final Long studyId, final String contextName) {
+               
+               return "result";
+       }
        /**
         * Get the scenarioService.
         * @return the scenarioService