summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Pielmann2012-10-10 07:13:25 (EDT)
committerManik Kishore2012-10-10 07:13:25 (EDT)
commit030e4677266116be9e1694e8a76e57ab78be2d0e (patch)
tree92c08571a4c020e30156eb00d06ef349b13feea2
parent371ce580172e61c2246beb5d1cf920eedad1a798 (diff)
downloadorg.eclipse.stardust.ui.web-030e4677266116be9e1694e8a76e57ab78be2d0e.zip
org.eclipse.stardust.ui.web-030e4677266116be9e1694e8a76e57ab78be2d0e.tar.gz
org.eclipse.stardust.ui.web-030e4677266116be9e1694e8a76e57ab78be2d0e.tar.bz2
CRNT-26312 Pepper: Element Comments
git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/ui.web@59900 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
-rw-r--r--web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/marshaling/ModelElementMarshaller.java30
-rw-r--r--web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/marshaling/ModelElementUnmarshaller.java65
2 files changed, 43 insertions, 52 deletions
diff --git a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/marshaling/ModelElementMarshaller.java b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/marshaling/ModelElementMarshaller.java
index b14db56..6f62129 100644
--- a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/marshaling/ModelElementMarshaller.java
+++ b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/marshaling/ModelElementMarshaller.java
@@ -3,7 +3,6 @@ package org.eclipse.stardust.ui.web.modeler.marshaling;
import static org.eclipse.stardust.ui.web.modeler.marshaling.GsonUtils.extractInt;
import static org.eclipse.stardust.ui.web.modeler.marshaling.GsonUtils.extractString;
-import java.util.Iterator;
import java.util.List;
import org.eclipse.emf.common.util.EList;
@@ -22,7 +21,6 @@ import org.eclipse.stardust.model.xpdl.carnot.ActivitySymbolType;
import org.eclipse.stardust.model.xpdl.carnot.ActivityType;
import org.eclipse.stardust.model.xpdl.carnot.AnnotationSymbolType;
import org.eclipse.stardust.model.xpdl.carnot.ApplicationType;
-import org.eclipse.stardust.model.xpdl.carnot.AttributeType;
import org.eclipse.stardust.model.xpdl.carnot.ConditionalPerformerType;
import org.eclipse.stardust.model.xpdl.carnot.ContextType;
import org.eclipse.stardust.model.xpdl.carnot.DataMappingConnectionType;
@@ -60,12 +58,10 @@ import org.eclipse.stardust.model.xpdl.xpdl2.DataTypeType;
import org.eclipse.stardust.model.xpdl.xpdl2.ExternalReferenceType;
import org.eclipse.stardust.model.xpdl.xpdl2.FormalParameterType;
import org.eclipse.stardust.model.xpdl.xpdl2.ModeType;
-import org.eclipse.stardust.model.xpdl.xpdl2.SchemaTypeType;
import org.eclipse.stardust.model.xpdl.xpdl2.TypeDeclarationType;
import org.eclipse.stardust.model.xpdl.xpdl2.XpdlTypeType;
import org.eclipse.stardust.modeling.repository.common.descriptors.EObjectDescriptor;
import org.eclipse.stardust.ui.web.modeler.service.ModelService;
-import org.w3c.dom.Node;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
@@ -943,6 +939,9 @@ public abstract class ModelElementMarshaller implements ModelMarshaller
if (null != data)
{
+ if (data.getId().startsWith("Primit")) {
+ System.out.println();
+ }
dataJson.addProperty(ModelerConstants.TYPE_PROPERTY, "data");
dataJson.addProperty(ModelerConstants.ID_PROPERTY, data.getId());
dataJson.addProperty(ModelerConstants.NAME_PROPERTY, data.getName());
@@ -2007,7 +2006,7 @@ public abstract class ModelElementMarshaller implements ModelMarshaller
* @param json
* @throws JSONException
*/
- private void loadAttributes(IIdentifiableModelElement element, JsonObject json)
+ private void loadAttributes(EObject element, JsonObject json)
{
JsonObject attributes;
@@ -2020,16 +2019,21 @@ public abstract class ModelElementMarshaller implements ModelMarshaller
attributes = json.getAsJsonObject(ModelerConstants.ATTRIBUTES_PROPERTY);
}
- for (AttributeType attribute : element.getAttribute())
+ for (Object attribute : getModelBuilderFacade().getAttributes(element))
{
- if (attribute.getName().equals("documentation:comments"))
+ if (getModelBuilderFacade().getAttributeName(attribute).equals(
+ "documentation:comments"))
{
- json.add(ModelerConstants.COMMENTS_PROPERTY, jsonIo.readJsonObject(attribute.getValue()).get(ModelerConstants.COMMENTS_PROPERTY)
- .getAsJsonArray());
+ json.add(
+ ModelerConstants.COMMENTS_PROPERTY,
+ jsonIo.readJsonObject(
+ getModelBuilderFacade().getAttributeValue(attribute))
+ .get(ModelerConstants.COMMENTS_PROPERTY).getAsJsonArray());
}
else
{
- attributes.addProperty(attribute.getName(), attribute.getValue());
+ attributes.addProperty(getModelBuilderFacade().getAttributeName(attribute),
+ getModelBuilderFacade().getAttributeValue(attribute));
}
}
@@ -2107,10 +2111,6 @@ public abstract class ModelElementMarshaller implements ModelMarshaller
private ModelBuilderFacade getModelBuilderFacade()
{
- if (modelBuilderFacade == null)
- {
- modelBuilderFacade = new ModelBuilderFacade(modelManagementStrategy());
- }
- return modelBuilderFacade;
+ return new ModelBuilderFacade(modelManagementStrategy());
}
}
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 fd31ad7..20ef85b 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
@@ -15,7 +15,6 @@ import static org.eclipse.stardust.common.CollectionUtils.isEmpty;
import static org.eclipse.stardust.common.CollectionUtils.newHashMap;
import static org.eclipse.stardust.common.StringUtils.isEmpty;
import static org.eclipse.stardust.ui.web.modeler.marshaling.GsonUtils.extractInt;
-import static org.eclipse.stardust.ui.web.modeler.service.ModelService.HEIGHT_PROPERTY;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@@ -24,23 +23,6 @@ import java.util.Map;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.FeatureMapUtil;
-import org.eclipse.xsd.XSDComplexTypeContent;
-import org.eclipse.xsd.XSDComplexTypeDefinition;
-import org.eclipse.xsd.XSDCompositor;
-import org.eclipse.xsd.XSDConstrainingFacet;
-import org.eclipse.xsd.XSDElementDeclaration;
-import org.eclipse.xsd.XSDFactory;
-import org.eclipse.xsd.XSDModelGroup;
-import org.eclipse.xsd.XSDParticle;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.XSDSimpleTypeDefinition;
-import org.eclipse.xsd.XSDTerm;
-import org.eclipse.xsd.XSDTypeDefinition;
-
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-
import org.eclipse.stardust.common.CollectionUtils;
import org.eclipse.stardust.common.StringUtils;
import org.eclipse.stardust.engine.api.runtime.DmsUtils;
@@ -86,12 +68,27 @@ import org.eclipse.stardust.model.xpdl.carnot.TextType;
import org.eclipse.stardust.model.xpdl.carnot.TransitionConnectionType;
import org.eclipse.stardust.model.xpdl.carnot.TransitionType;
import org.eclipse.stardust.model.xpdl.carnot.XmlTextNode;
-import org.eclipse.stardust.model.xpdl.carnot.util.AttributeUtil;
import org.eclipse.stardust.model.xpdl.carnot.util.ModelUtils;
import org.eclipse.stardust.model.xpdl.xpdl2.ModeType;
import org.eclipse.stardust.model.xpdl.xpdl2.SchemaTypeType;
import org.eclipse.stardust.model.xpdl.xpdl2.TypeDeclarationType;
import org.eclipse.stardust.ui.web.viewscommon.utils.MimeTypesHelper;
+import org.eclipse.xsd.XSDComplexTypeContent;
+import org.eclipse.xsd.XSDComplexTypeDefinition;
+import org.eclipse.xsd.XSDCompositor;
+import org.eclipse.xsd.XSDConstrainingFacet;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDFactory;
+import org.eclipse.xsd.XSDModelGroup;
+import org.eclipse.xsd.XSDParticle;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.XSDSimpleTypeDefinition;
+import org.eclipse.xsd.XSDTerm;
+import org.eclipse.xsd.XSDTypeDefinition;
+
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
/**
*
@@ -267,7 +264,7 @@ public abstract class ModelElementUnmarshaller implements ModelUnmarshaller
// Detect gateways early to be able to fix accidental ID changes
final boolean isGateway = activity.getId().toLowerCase().startsWith("gateway");
- updateIdentifiableElement(activity, activityJson);
+ updateIdentifiableElement(activity, activityJson);
mapDeclaredProperties(activity, activityJson, propertiesMap.get(ActivityType.class));
storeAttributes(activity, activityJson);
storeDescription(activity, activityJson);
@@ -1471,18 +1468,18 @@ public abstract class ModelElementUnmarshaller implements ModelUnmarshaller
* @param element
* @throws JSONException
*/
- private void storeAttributes(IIdentifiableModelElement element, JsonObject json)
+ private void storeAttributes(EObject element, JsonObject json)
{
// Extract JSON elements which are stored in Extended Attributes
- if (json.has(ModelerConstants.COMMENTS_PROPERTY))
+ if (json.has(ModelerConstants.COMMENTS_PROPERTY))
{
JsonArray commentsJson = json.getAsJsonArray(ModelerConstants.COMMENTS_PROPERTY);
JsonObject holderJson = new JsonObject();
-
+
holderJson.add(ModelerConstants.COMMENTS_PROPERTY, commentsJson);
-
- AttributeUtil.setAttribute(element, "documentation:comments", jsonIo.writeJsonObject(holderJson));
+
+ getModelBuilderFacade().setAttribute(element, "documentation:comments", jsonIo.writeJsonObject(holderJson));
}
if ( !json.has(ModelerConstants.ATTRIBUTES_PROPERTY))
@@ -1501,8 +1498,7 @@ public abstract class ModelElementUnmarshaller implements ModelUnmarshaller
if (attributes.get(key).isJsonNull())
{
System.out.println("Setting extended attribute " + key + " to null.");
-
- AttributeUtil.setAttribute(element, key, null);
+ getModelBuilderFacade().setAttribute(element, key, null);
}
else
{
@@ -1511,16 +1507,15 @@ public abstract class ModelElementUnmarshaller implements ModelUnmarshaller
if (key.equals("documentation:externalDocumentUrl") &&
attributes.get(key).getAsString().equals("@CREATE"))
{
- AttributeUtil.setAttribute(element, key,
- createModelElementDocumentation(json));
+ getModelBuilderFacade().setAttribute(element, key,
+ createModelElementDocumentation(json));
}
else
{
System.out.println("Setting extended attribute " + key + " to "
+ attributes.get(key).getAsString());
-
- AttributeUtil.setAttribute(element, key, attributes.get(key)
- .getAsString());
+ getModelBuilderFacade().setAttribute(element, key,
+ attributes.get(key).getAsString());
}
}
}
@@ -1584,11 +1579,7 @@ public abstract class ModelElementUnmarshaller implements ModelUnmarshaller
*/
private ModelBuilderFacade getModelBuilderFacade()
{
- if (modelBuilderFacade == null)
- {
- modelBuilderFacade = new ModelBuilderFacade(modelManagementStrategy());
- }
- return modelBuilderFacade;
+ return new ModelBuilderFacade(modelManagementStrategy());
}
/**