summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSidharth Singh2012-07-26 02:57:38 (EDT)
committer Manik Kishore2012-07-30 01:51:34 (EDT)
commit945ff858c6baae08e6d6d88520e5209fb026f11c (patch)
tree41028f0607593cb1471e9c679701b10d582c7830
parent6627346cc2a108eefea3cba8db4a6f93767c53c4 (diff)
downloadorg.eclipse.stardust.ui.web-945ff858c6baae08e6d6d88520e5209fb026f11c.zip
org.eclipse.stardust.ui.web-945ff858c6baae08e6d6d88520e5209fb026f11c.tar.gz
org.eclipse.stardust.ui.web-945ff858c6baae08e6d6d88520e5209fb026f11c.tar.bz2
Jira-ID: CRNT-25581
1)Made changes in m_diagram.js to update the model element in processCommand if modelElement is changed. 2)Added method toActivityType in ModelElementMarshaller.java. git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/ui.web@57925 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
-rw-r--r--web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/marshaling/ModelElementMarshaller.java128
-rw-r--r--web-modeler/src/main/resources/META-INF/xhtml/js/m_diagram.js17
-rw-r--r--web-modeler/src/main/resources/META-INF/xhtml/js/m_symbol.js2
3 files changed, 87 insertions, 60 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 90f2466..c5e5dd6 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
@@ -70,6 +70,10 @@ public class ModelElementMarshaller
{
jsResult = toProcessDefinition((ProcessDefinitionType) modelElement);
}
+ else if (modelElement instanceof ActivityType)
+ {
+ jsResult = toActivityType((ActivityType) modelElement);
+ }
else if (modelElement instanceof ActivitySymbolType)
{
jsResult = toActivitySymbolJson((ActivitySymbolType) modelElement);
@@ -500,45 +504,13 @@ public class ModelElementMarshaller
/**
*
- * @param activitySymbol
+ * @param activity
* @return
*/
- public static JsonObject toActivitySymbolJson(ActivitySymbolType activitySymbol)
+ public static JsonObject toActivityType(ActivityType activity)
{
- int laneOffsetX = 0;
- int laneOffsetY = 0;
- ISwimlaneSymbol container = (activitySymbol.eContainer() instanceof ISwimlaneSymbol)
- ? (ISwimlaneSymbol) activitySymbol.eContainer()
- : null;
- while (null != container)
- {
- laneOffsetX += container.getXPos();
- laneOffsetY += container.getYPos();
-
- // recurse
- container = (container.eContainer() instanceof ISwimlaneSymbol)
- ? (ISwimlaneSymbol) container.eContainer()
- : null;
- }
-
- JsonObject activitySymbolJson = new JsonObject();
-
- activitySymbolJson.addProperty(ModelerConstants.OID_PROPERTY,
- activitySymbol.getElementOid());
- activitySymbolJson.addProperty(ModelerConstants.X_PROPERTY,
- activitySymbol.getXPos() + laneOffsetX + ModelerConstants.POOL_LANE_MARGIN);
- activitySymbolJson.addProperty(ModelerConstants.Y_PROPERTY,
- activitySymbol.getYPos() + laneOffsetY + ModelerConstants.POOL_LANE_MARGIN
- + ModelerConstants.POOL_SWIMLANE_TOP_BOX_HEIGHT);
- activitySymbolJson.addProperty(ModelerConstants.WIDTH_PROPERTY,
- activitySymbol.getWidth());
- activitySymbolJson.addProperty(ModelerConstants.HEIGHT_PROPERTY,
- activitySymbol.getHeight());
-
- ActivityType activity = activitySymbol.getActivity();
JsonObject activityJson = new JsonObject();
- activitySymbolJson.add(ModelerConstants.MODEL_ELEMENT_PROPERTY, activityJson);
activityJson.addProperty(ModelerConstants.OID_PROPERTY, activity.getElementOid());
activityJson.addProperty(ModelerConstants.ID_PROPERTY, activity.getId());
activityJson.addProperty(ModelerConstants.NAME_PROPERTY, activity.getName());
@@ -556,7 +528,7 @@ public class ModelElementMarshaller
ModelerConstants.GATEWAY_ACTIVITY);
// TODO Throw error for inconsistent Split/Join settings
-
+
if (activity.getJoin() == JoinSplitType.XOR_LITERAL)
{
activityJson.addProperty(ModelerConstants.GATEWAY_TYPE_PROPERTY,
@@ -577,7 +549,74 @@ public class ModelElementMarshaller
activityJson.addProperty(ModelerConstants.GATEWAY_TYPE_PROPERTY,
ModelerConstants.AND_GATEWAY_TYPE);
}
+ }
+ else
+ {
+ activityJson.addProperty(ModelerConstants.TYPE_PROPERTY,
+ ModelerConstants.ACTIVITY_KEY);
+ activityJson.addProperty(ModelerConstants.ACTIVITY_TYPE,
+ activity.getImplementation().getLiteral());
+ if (activity.getImplementationProcess() != null)
+ {
+ activityJson.addProperty(ModelerConstants.SUBPROCESS_ID,
+ MBFacade.createFullId(ModelUtils.findContainingModel(activity),
+ activity.getImplementationProcess()));
+ }
+ else if (activity.getApplication() != null)
+ {
+ activityJson.addProperty(ModelerConstants.APPLICATION_FULL_ID_PROPERTY,
+ MBFacade.createFullId(ModelUtils.findContainingModel(activity),
+ activity.getApplication()));
+ }
+ }
+ return activityJson;
+ }
+ /**
+ *
+ * @param activitySymbol
+ * @return
+ */
+ public static JsonObject toActivitySymbolJson(ActivitySymbolType activitySymbol)
+ {
+ int laneOffsetX = 0;
+ int laneOffsetY = 0;
+ ISwimlaneSymbol container = (activitySymbol.eContainer() instanceof ISwimlaneSymbol)
+ ? (ISwimlaneSymbol) activitySymbol.eContainer()
+ : null;
+ while (null != container)
+ {
+ laneOffsetX += container.getXPos();
+ laneOffsetY += container.getYPos();
+ // recurse
+ container = (container.eContainer() instanceof ISwimlaneSymbol)
+ ? (ISwimlaneSymbol) container.eContainer()
+ : null;
+ }
+
+ JsonObject activitySymbolJson = new JsonObject();
+
+ activitySymbolJson.addProperty(ModelerConstants.OID_PROPERTY,
+ activitySymbol.getElementOid());
+ activitySymbolJson.addProperty(ModelerConstants.X_PROPERTY,
+ activitySymbol.getXPos() + laneOffsetX + ModelerConstants.POOL_LANE_MARGIN);
+ activitySymbolJson.addProperty(ModelerConstants.Y_PROPERTY,
+ activitySymbol.getYPos() + laneOffsetY + ModelerConstants.POOL_LANE_MARGIN
+ + ModelerConstants.POOL_SWIMLANE_TOP_BOX_HEIGHT);
+ activitySymbolJson.addProperty(ModelerConstants.WIDTH_PROPERTY,
+ activitySymbol.getWidth());
+ activitySymbolJson.addProperty(ModelerConstants.HEIGHT_PROPERTY,
+ activitySymbol.getHeight());
+
+ ActivityType activity = activitySymbol.getActivity();
+ JsonObject activityJson = toActivityType(activity);
+
+ activitySymbolJson.add(ModelerConstants.MODEL_ELEMENT_PROPERTY, activityJson);
+
+ // TODO Hack to identify gateways
+
+ if (activity.getId().toLowerCase().startsWith("gateway"))
+ {
// TODO Refactor
// Identify the gateway symbol for this activity and update the
// location and dimension attributes.
@@ -608,25 +647,6 @@ public class ModelElementMarshaller
thisGatewaySymbol.getHeight());
}
}
- else
- {
- activityJson.addProperty(ModelerConstants.TYPE_PROPERTY,
- ModelerConstants.ACTIVITY_KEY);
- activityJson.addProperty(ModelerConstants.ACTIVITY_TYPE,
- activity.getImplementation().getLiteral());
- if (activity.getImplementationProcess() != null)
- {
- activityJson.addProperty(ModelerConstants.SUBPROCESS_ID,
- MBFacade.createFullId(ModelUtils.findContainingModel(activity),
- activity.getImplementationProcess()));
- }
- else if (activity.getApplication() != null)
- {
- activityJson.addProperty(ModelerConstants.APPLICATION_FULL_ID_PROPERTY,
- MBFacade.createFullId(ModelUtils.findContainingModel(activity),
- activity.getApplication()));
- }
- }
// TODO Obtain access points on client
diff --git a/web-modeler/src/main/resources/META-INF/xhtml/js/m_diagram.js b/web-modeler/src/main/resources/META-INF/xhtml/js/m_diagram.js
index ff99332..500220c 100644
--- a/web-modeler/src/main/resources/META-INF/xhtml/js/m_diagram.js
+++ b/web-modeler/src/main/resources/META-INF/xhtml/js/m_diagram.js
@@ -539,7 +539,12 @@ define(
for ( var i = 0; i < obj.changes.added.length; i++) {
if (null != this.lastSymbol) {
- this.lastSymbol.oid = obj.changes.added[i].oid;
+ if (null != this.lastSymbol.modelElement
+ && null == this.lastSymbol.modelElement.oid) {
+ this.lastSymbol.modelElement.oid = obj.changes.added[i].oid;
+ } else {
+ this.lastSymbol.oid = obj.changes.added[i].oid;
+ }
} else if (null != obj.changes.added[i].modelElement) {
// for connections , search by connectionId to
// set OID
@@ -551,11 +556,10 @@ define(
}
}
}
-
this.lastSymbol = null;
-
+
// Apply changes
-
+
for ( var i = 0; i < obj.changes.modified.length; i++) {
var symbol = this
.findSymbolByGuid(obj.changes.modified[i].oid);
@@ -575,7 +579,10 @@ define(
if (symbol != null) {
m_utils.debug("Up to changed symbol:");
m_utils.debug(symbol);
- symbol.applyChanges(obj.changes.modified[i]);
+ // Modifies only modelElement,rather than whole
+ // symbol
+ m_utils.inheritFields(symbol.modelElement, obj.changes.modified[i]);
+ /*symbol.applyChanges(obj.changes.modified[i]);*/
m_utils.debug("Changed symbol to:");
m_utils.debug(symbol);
symbol.refresh();
diff --git a/web-modeler/src/main/resources/META-INF/xhtml/js/m_symbol.js b/web-modeler/src/main/resources/META-INF/xhtml/js/m_symbol.js
index 4440e5b..0294114 100644
--- a/web-modeler/src/main/resources/META-INF/xhtml/js/m_symbol.js
+++ b/web-modeler/src/main/resources/META-INF/xhtml/js/m_symbol.js
@@ -244,7 +244,7 @@ define(
commandType = "eventSymbol." + str;
/*} else if (this.type == m_constants.DATA_SYMBOL) {
commandType = "dataSymbol." + str;*/
- } else if (this.type == m_constants.SWIMLANE_SYMBOL) {
+ } else if (m_constants.SWIMLANE_SYMBOL.match(this.type)) {
commandType = "swimlaneSymbol." + str;
}
return commandType;