summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Pielmann2012-09-12 03:45:59 (EDT)
committerStephan Born2012-09-12 03:45:59 (EDT)
commite5ff07814c0674bf851ac415dc688987aab733ce (patch)
tree2d44c997f9e7dbe1f83ac6770a60a1b7320748c5
parent71a1d84ede0cf39e6fe6c9cf07d73bdd70942542 (diff)
downloadorg.eclipse.stardust.ui.web-e5ff07814c0674bf851ac415dc688987aab733ce.zip
org.eclipse.stardust.ui.web-e5ff07814c0674bf851ac415dc688987aab733ce.tar.gz
org.eclipse.stardust.ui.web-e5ff07814c0674bf851ac415dc688987aab733ce.tar.bz2
CRNT-26125 Pepper: ModelBuilder API - Create accesspoints for MTA / UI Mashup (Primitive Accesspoints)
git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/ui.web@59108 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
-rw-r--r--web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/marshaling/ModelElementUnmarshaller.java54
1 files changed, 21 insertions, 33 deletions
diff --git a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/marshaling/ModelElementUnmarshaller.java b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/marshaling/ModelElementUnmarshaller.java
index a603eea..2372ea2 100644
--- a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/marshaling/ModelElementUnmarshaller.java
+++ b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/marshaling/ModelElementUnmarshaller.java
@@ -447,20 +447,20 @@ public abstract class ModelElementUnmarshaller implements ModelUnmarshaller
.getAsJsonObject();
ModeType mode = null;
-
+
if (formalParameterJson.get(ModelerConstants.DIRECTION_PROPERTY).equals(ModelerConstants.IN_PARAMETER_KEY))
{
- mode = ModeType.IN;
+ mode = ModeType.IN;
}
else if (formalParameterJson.get(ModelerConstants.DIRECTION_PROPERTY).equals(ModelerConstants.INOUT_PARAMETER_KEY))
{
- mode = ModeType.INOUT;
+ mode = ModeType.INOUT;
}
- else
+ else
{
mode = ModeType.OUT;
}
-
+
if (formalParameterJson.get(ModelerConstants.DATA_TYPE_PROPERTY).equals(
ModelerConstants.PRIMITIVE_DATA_TYPE_KEY))
{
@@ -713,34 +713,22 @@ public abstract class ModelElementUnmarshaller implements ModelUnmarshaller
System.out.println("Access point " + accessPointJson);
- AccessPointType accessPoint = AbstractElementBuilder.F_CWM.createAccessPointType();
- application.getAccessPoint().add(accessPoint);
+ String id = accessPointJson.get(ModelerConstants.ID_PROPERTY)
+ .getAsString();
+ String name = accessPointJson.get(ModelerConstants.NAME_PROPERTY)
+ .getAsString();
+ String direction = accessPointJson.get(ModelerConstants.DIRECTION_PROPERTY).getAsString();
- accessPoint.setId(accessPointJson.get(ModelerConstants.ID_PROPERTY)
- .getAsString());
- accessPoint.setName(accessPointJson.get(ModelerConstants.NAME_PROPERTY)
- .getAsString());
-
- // if (accessPointJson.get(ModelerConstants.ID_PROPERTY)
- // .getAsString()
- // .equals(DirectionType.IN_LITERAL))
- // {
- // accessPoint.setDirection(DirectionType.IN_LITERAL);
- // }
- // else
- // {
- // accessPoint.setDirection(DirectionType.OUT_LITERAL);
- // }
+ AccessPointType accessPoint = null;
if (accessPointJson.has(ModelerConstants.DATA_TYPE_PROPERTY))
{
- String dataType = accessPointJson.get(ModelerConstants.DATA_TYPE_PROPERTY)
- .getAsString();
-
+ String dataType = accessPointJson.get(ModelerConstants.DATA_TYPE_PROPERTY).getAsString();
if (dataType.equals(ModelerConstants.PRIMITIVE_DATA_TYPE_KEY))
{
- // accessPoint.setType(@accessPointJson.get(ModelerConstants.PRIMITIVE_DATA_TYPE_PROPERTY));
+ String primitiveDataType = accessPointJson.get(ModelerConstants.PRIMITIVE_DATA_TYPE_PROPERTY).getAsString();
+ accessPoint = getModelBuilderFacade().createPrimitiveAccessPoint(application, id, name, primitiveDataType, direction);
}
else if (dataType.equals(ModelerConstants.STRUCTURED_DATA_TYPE_KEY))
{
@@ -804,7 +792,7 @@ public abstract class ModelElementUnmarshaller implements ModelUnmarshaller
existing.put(def.getName(), def);
}
list.clear();
-
+
for (Map.Entry<String, JsonElement> entry : json.entrySet())
{
XSDTypeDefinition def = existing.get(entry.getKey());
@@ -833,7 +821,7 @@ public abstract class ModelElementUnmarshaller implements ModelUnmarshaller
{
List<XSDConstrainingFacet> facets = def.getFacetContents();
facets.clear();
-
+
if (simpleTypeJson.has("facets"))
{
JsonObject facetsJson = simpleTypeJson.getAsJsonObject("facets");
@@ -847,12 +835,12 @@ public abstract class ModelElementUnmarshaller implements ModelUnmarshaller
}
}
}
-
+
private static enum SupportedXSDConstrainingFacets
{
// (fh) Only added what is supported by the eclipse modeler. Should be all of them.
enumeration, pattern, maxLength, minLength;
-
+
XSDConstrainingFacet create()
{
switch (this)
@@ -911,11 +899,11 @@ public abstract class ModelElementUnmarshaller implements ModelUnmarshaller
}
// else unsupported simple & complex content
}
-
+
private static enum ParticleCardinality
{
required, optional, many, at_least_one;
-
+
void update(XSDParticle particle)
{
switch (this)
@@ -938,7 +926,7 @@ public abstract class ModelElementUnmarshaller implements ModelUnmarshaller
break;
}
}
-
+
static ParticleCardinality get(String name)
{
if ("at least one".equals(name))