summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Pielmann2012-12-05 08:26:46 (EST)
committer Stephan Born2012-12-05 08:26:46 (EST)
commitbe0bbaf27295ecf5bacc3fb1e65b640f14ab2102 (patch)
treec800ba8c9c8c230f5b50f9621488e93e781a1ef4
parentfbbe6261f64916b1505e39988bfca7bea3ca0956 (diff)
downloadorg.eclipse.stardust.ui.web-be0bbaf27295ecf5bacc3fb1e65b640f14ab2102.zip
org.eclipse.stardust.ui.web-be0bbaf27295ecf5bacc3fb1e65b640f14ab2102.tar.gz
org.eclipse.stardust.ui.web-be0bbaf27295ecf5bacc3fb1e65b640f14ab2102.tar.bz2
POC for Configuration Variables (CRNT 27277).
git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/ui.web@61371 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
-rw-r--r--web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/service/rest/ModelerResource.java45
1 files changed, 34 insertions, 11 deletions
diff --git a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/service/rest/ModelerResource.java b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/service/rest/ModelerResource.java
index fb8d951..2882183 100644
--- a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/service/rest/ModelerResource.java
+++ b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/service/rest/ModelerResource.java
@@ -14,6 +14,9 @@ package org.eclipse.stardust.ui.web.modeler.service.rest;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON_TYPE;
import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.StringTokenizer;
@@ -35,7 +38,17 @@ import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.ResponseBuilder;
import javax.ws.rs.core.Response.Status;
-import org.eclipse.stardust.model.xpdl.builder.strategy.ModelManagementStrategy;
+import org.eclipse.emf.ecore.EObject;
+import org.springframework.context.ApplicationContext;
+import org.springframework.web.context.support.WebApplicationContextUtils;
+
+import com.google.gson.JsonArray;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonPrimitive;
+
+import org.eclipse.stardust.model.xpdl.carnot.ModelType;
+import org.eclipse.stardust.model.xpdl.carnot.util.ModelVariable;
+import org.eclipse.stardust.model.xpdl.carnot.util.VariableContext;
import org.eclipse.stardust.ui.web.common.app.PortalApplication;
import org.eclipse.stardust.ui.web.common.util.StringUtils;
import org.eclipse.stardust.ui.web.modeler.common.LanguageUtil;
@@ -44,13 +57,6 @@ import org.eclipse.stardust.ui.web.modeler.portal.ViewUtils;
import org.eclipse.stardust.ui.web.modeler.service.ModelService;
import org.eclipse.stardust.ui.web.modeler.service.orion.UriModelManagementStrategy;
-import org.springframework.context.ApplicationContext;
-import org.springframework.web.context.support.WebApplicationContextUtils;
-
-import com.google.gson.JsonArray;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonPrimitive;
-
@Path("/modeler/{randomPostFix}")
public class ModelerResource
{
@@ -507,8 +513,25 @@ public class ModelerResource
{
try
{
- System.out.println("Rainer, bearbeite mich!");
-
+ System.out.println("Configuration Variables:");
+ ModelType model = this.getModelService().findModel(modelId);
+ VariableContext vc = new VariableContext();
+ vc.initializeVariables(model);
+ vc.refreshVariables(model);
+ vc.saveVariables();
+ for (Iterator<ModelVariable> i = vc.getVariables().iterator(); i.hasNext();) {
+ ModelVariable mv = i.next();
+ System.out.println();
+ System.out.println("Model Variable: " + mv.getName());
+ System.out.println(" Default Value: " + mv.getDefaultValue());
+ System.out.println(" Referenced by: ");
+ List<EObject> refList = vc.getVariableReferences().get(mv.getName());
+ for (Iterator<EObject> j = refList.iterator(); j.hasNext();) {
+ System.out.println(" -->" + j.next().toString());
+ }
+ System.out.println();
+ }
+
return Response.ok("{}",
APPLICATION_JSON_TYPE).build();
}
@@ -790,7 +813,7 @@ public class ModelerResource
{
try
{
- JsonObject json = jsonIo.readJsonObject(postedData);
+ JsonObject json = jsonIo.readJsonObject(postedData);
UriModelManagementStrategy modelManagementStrategy = getUriModelManagementStrategy();
modelManagementStrategy.setFileUri(json.get("fileUri").getAsString());