From: mka Date: Wed, 13 Mar 2013 08:31:45 +0000 (+0000) Subject: createNewStudy ws-method is implemented X-Git-Tag: Root_Delivery2_2013_04_22~105 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=aaae05e5daf0961a65c7267cf87083ffd0b7e240;p=tools%2Fsiman.git createNewStudy ws-method is implemented --- diff --git a/Workspace/Siman-WS/src/org/splat/ws_server/service/salome/SimanSalomeService.java b/Workspace/Siman-WS/src/org/splat/ws_server/service/salome/SimanSalomeService.java index d88dbad..4027198 100644 --- a/Workspace/Siman-WS/src/org/splat/ws_server/service/salome/SimanSalomeService.java +++ b/Workspace/Siman-WS/src/org/splat/ws_server/service/salome/SimanSalomeService.java @@ -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); } diff --git a/Workspace/Siman-WS/src/org/splat/ws_server/service/salome/SimanSalomeServiceImpl.java b/Workspace/Siman-WS/src/org/splat/ws_server/service/salome/SimanSalomeServiceImpl.java index 8088c2d..d1f881f 100644 --- a/Workspace/Siman-WS/src/org/splat/ws_server/service/salome/SimanSalomeServiceImpl.java +++ b/Workspace/Siman-WS/src/org/splat/ws_server/service/salome/SimanSalomeServiceImpl.java @@ -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