From 60504fe50df03b2a83ff0e974d3a9d1435f6ec88 Mon Sep 17 00:00:00 2001 From: mka Date: Fri, 28 Dec 2012 08:38:18 +0000 Subject: [PATCH] No duplication of the products when new study is created --- .../src/org/splat/simer/NewStudyAction.java | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/Workspace/Siman/src/org/splat/simer/NewStudyAction.java b/Workspace/Siman/src/org/splat/simer/NewStudyAction.java index dd32969..95fd4cb 100644 --- a/Workspace/Siman/src/org/splat/simer/NewStudyAction.java +++ b/Workspace/Siman/src/org/splat/simer/NewStudyAction.java @@ -123,10 +123,20 @@ public class NewStudyAction extends Action { // Addition of the entered project context SimulationContext.Properties cprop = new SimulationContext.Properties(); + + SimulationContextType product = getSimulationContextService() + .selectType("product"); + + SimulationContext testContext = getSimulationContextService().selectSimulationContext(product, value); + if (valid == 0) { // Input of new project context + if (testContext == null) { cprop.setType( getSimulationContextService().selectType("product")) .setValue(value); + } else { + cprop.setIndex(testContext.getIndex()); + } } else { // Selection of existing project context cprop.setIndex(valid); } @@ -146,6 +156,26 @@ public class NewStudyAction extends Action { return ERROR; } } + + /** + * + * {@inheritDoc} + * @see com.opensymphony.xwork2.ActionSupport#validate() + */ + @Override + public void validate() { + + if( LOG.isDebugEnabled() ) { + LOG.debug("--- validate"); + } + com.opensymphony.xwork2.ActionContext context = + com.opensymphony.xwork2.ActionContext.getContext(); + + if( LOG.isDebugEnabled() ) { + LOG.debug("======> MKA test"); + LOG.debug(context.getName()); + } + } // ============================================================================================================================== // Getters and setters -- 2.39.2