]> SALOME platform Git repositories - tools/siman.git/blobdiff - Workspace/Siman-Common/src/org/splat/service/technical/ProjectSettingsServiceImpl.java
Salome HOME
ScenarioService.getScenarioInfo method is added.
[tools/siman.git] / Workspace / Siman-Common / src / org / splat / service / technical / ProjectSettingsServiceImpl.java
index d8da9723f442678c5e58fa4279b058051b7ef128..cb7c193b2e1f7a435a4fb97a871c108a686819d5 100644 (file)
@@ -434,12 +434,14 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService {
                        final List<String> resultype) {
                int res = snum;
                if ("step".equals(node.getNodeName())) {
+                       
+                       String name = ((Element)node).getAttribute("name");
                        HashMap<String, Node> tags = XDOM.getNamedChildNodes(node);
 
                        NamedNodeMap natr = tags.get("storage").getAttributes();
                        ProjectSettingsService.Step step = new ProjectSettingsService.Step(
-                                       snum, ownerClass, natr.getNamedItem("path")
-                                                       .getNodeValue());
+                                       snum, ownerClass, natr.getNamedItem("path").getNodeValue());
+                       step.setKey(name);
 
                        // Keeping flow and classification information for eventual later use
                        natr = tags.get("flow").getAttributes();
@@ -459,7 +461,8 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService {
                        if (natr.getNamedItem("contents").getNodeValue()
                                        .equals("knowledge")) {
                                if (Study.class.equals(ownerClass)) {
-                                       LOG.error("Error: knowledges must be attached to scenarios.");
+                                       LOG
+                                                       .error("Error: knowledges must be attached to scenarios.");
                                } else {
                                        // TODO In a given scenario, only one step must contain knowledges
                                        step._contents.add(KnowledgeElement.class);
@@ -467,8 +470,8 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService {
                        } else {
                                step._contents.add(Document.class);
                        }
-                       
-                       Element module = (Element)tags.get("module");
+
+                       Element module = (Element) tags.get("module");
                        if (module != null) {
                                step.setModule(module.getAttribute("name"));
                        }
@@ -641,30 +644,28 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService {
                int snum = 0;
                for (Iterator<NamedNodeMap> i = _sclass.iterator(); i.hasNext(); snum++) {
                        NamedNodeMap clatr = i.next();
-                       if (clatr == null) {
-                               continue;
-                       }
-
-                       String[] clist = clatr.getNamedItem("context").getNodeValue()
-                                       .split(",");
-                       for (int j = 0; j < clist.length; j++) {
-                               mapstep.put(clist[j], _steps.get(snum));
+                       if (clatr != null) {
+                               String[] clist = clatr.getNamedItem("context").getNodeValue()
+                                               .split(",");
+                               for (int j = 0; j < clist.length; j++) {
+                                       mapstep.put(clist[j], _steps.get(snum));
+                               }
                        }
                }
                try {
                        SimulationContextType tctex = null;
                        for (Iterator<String> i = _context.iterator(); i.hasNext();) {
                                String type = i.next();
-                               if (!mapstep.containsKey(type)) {
+                               if (mapstep.containsKey(type)) {
+                                       tctex = getSimulationContextTypeService().createType(type,
+                                                       mapstep.get(type)); // Creation of Simulation Context Types
+                                       getSimulationContextTypeService().approve(tctex);
+                               } else {
                                        LOG
                                                        .warn("Could not find \""
                                                                        + type
                                                                        + "\" classification. Simulation Context type ignored.");
-                                       continue;
                                }
-                               tctex = getSimulationContextTypeService().createType(type,
-                                               mapstep.get(type)); // Creation of Simulation Context Types
-                               getSimulationContextTypeService().approve(tctex);
                        }
                } catch (Exception error) {
                        LOG.warn("Error creating context types, reason:", error); // Should not happen