summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSidharth Singh2012-11-28 06:18:32 (EST)
committerStephan Born2012-11-28 06:18:32 (EST)
commitbc8c6b5cbd55aab763a07b307a1fcd84daa0a71a (patch)
treea00fc68e9416d766a2e08fcbf8421208062f8081
parent007f9c4b56a316d4a4adc7e93432161feb4f9ff5 (diff)
downloadorg.eclipse.stardust.ui.web-bc8c6b5cbd55aab763a07b307a1fcd84daa0a71a.zip
org.eclipse.stardust.ui.web-bc8c6b5cbd55aab763a07b307a1fcd84daa0a71a.tar.gz
org.eclipse.stardust.ui.web-bc8c6b5cbd55aab763a07b307a1fcd84daa0a71a.tar.bz2
CRNT-27173
Moved code to updateParentSymbol on laneChange for symbol to ModelElementUnmarshaller.java updateNodeSymbol() Changed the command to createUpdateModelElementCommand from createMoveNodeSymbolCommand when parentChange.in m_symbol.js git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/ui.web@61207 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
-rw-r--r--web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/MoveNodeSymbolHandler.java62
-rw-r--r--web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/marshaling/ModelElementUnmarshaller.java131
-rw-r--r--web-modeler/src/main/resources/META-INF/xhtml/js/m_symbol.js30
3 files changed, 121 insertions, 102 deletions
diff --git a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/MoveNodeSymbolHandler.java b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/MoveNodeSymbolHandler.java
index e571328..1eafd2d 100644
--- a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/MoveNodeSymbolHandler.java
+++ b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/MoveNodeSymbolHandler.java
@@ -68,68 +68,6 @@ public class MoveNodeSymbolHandler
{
nodeSymbol.setHeight(extractInt(request, HEIGHT_PROPERTY));
}
-
- // Type property is used to identify the symbol type, used while changing
- // parentSymbol on move from one lane to another.
- if (request.has(ModelerConstants.TYPE_PROPERTY))
- {
- String symbolType = request.get(ModelerConstants.TYPE_PROPERTY).getAsString();
- if (null != symbolType)
- {
- LaneSymbol parentLane = (LaneSymbol) nodeSymbol.eContainer();
- if (symbolType.equals(ModelerConstants.ACTIVITY_SYMBOL)
- || symbolType.equals(ModelerConstants.GATEWAY_SYMBOL))
- {
- if (parentLane.getElementOid() != newParentSymbol.getElementOid())
- {
- // If the parent is changed, remove reference from old parent
- parentLane.getActivitySymbol().remove(nodeSymbol);
- ActivitySymbolType activitySymbol = (ActivitySymbolType) nodeSymbol;
- // Set the Performer for Activ
- if (null != activitySymbol.getActivity().getPerformer())
- {
- activitySymbol.getActivity().setPerformer(newParentSymbol.getParticipant());
- }
- newParentSymbol.getActivitySymbol()
- .add((ActivitySymbolType) nodeSymbol);
- }
- }
- else if (symbolType.equals(ModelerConstants.EVENT_SYMBOL))
- {
- StartEventSymbol startSymbol = getModelBuilderFacade().findStartEventSymbol(
- parentLane, nodeSymbol.getElementOid());
- if (null != startSymbol)
- {
- if (parentLane.getElementOid() != newParentSymbol.getElementOid())
- {
- parentLane.getStartEventSymbols().remove(nodeSymbol);
-
- newParentSymbol.getStartEventSymbols().add(
- (StartEventSymbol) nodeSymbol);
- }
- }
- else
- {
- if (parentLane.getElementOid() != newParentSymbol.getElementOid())
- {
- parentLane.getEndEventSymbols().remove(nodeSymbol);
-
- newParentSymbol.getEndEventSymbols()
- .add((EndEventSymbol) nodeSymbol);
- }
- }
- }
- else if (symbolType.equals(ModelerConstants.DATA_SYMBOL))
- {
- if (parentLane.getElementOid() != newParentSymbol.getElementOid())
- {
- parentLane.getDataSymbol().remove(nodeSymbol);
-
- newParentSymbol.getDataSymbol().add((DataSymbolType) nodeSymbol);
- }
- }
- }
- }
}
private ModelBuilderFacade getModelBuilderFacade()
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 651f923..8fd9741 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
@@ -16,7 +16,6 @@ import static org.eclipse.stardust.common.CollectionUtils.newArrayList;
import static org.eclipse.stardust.common.CollectionUtils.newHashMap;
import static org.eclipse.stardust.common.CollectionUtils.newHashSet;
import static org.eclipse.stardust.common.StringUtils.isEmpty;
-import static org.eclipse.stardust.model.xpdl.builder.BpmModelBuilder.newManualTrigger;
import static org.eclipse.stardust.ui.web.modeler.marshaling.GsonUtils.extractAsString;
import static org.eclipse.stardust.ui.web.modeler.marshaling.GsonUtils.extractInt;
@@ -37,6 +36,7 @@ import org.eclipse.emf.ecore.util.FeatureMapUtil;
import org.eclipse.stardust.common.StringUtils;
import org.eclipse.stardust.common.log.LogManager;
import org.eclipse.stardust.common.log.Logger;
+import org.eclipse.stardust.engine.api.model.PredefinedConstants;
import org.eclipse.stardust.engine.api.runtime.DmsUtils;
import org.eclipse.stardust.engine.api.runtime.Document;
import org.eclipse.stardust.engine.api.runtime.DocumentInfo;
@@ -361,17 +361,6 @@ public abstract class ModelElementUnmarshaller implements ModelUnmarshaller
ModelerConstants.ACTIVITY_TYPE)))
{
activity.setImplementation(ActivityImplementationType.MANUAL_LITERAL);
-
- if (activityJson.has(ModelerConstants.PARTICIPANT_FULL_ID)
- && !activityJson.get(ModelerConstants.PARTICIPANT_FULL_ID).isJsonNull())
- {
- String participantFullId = extractString(activityJson,
- ModelerConstants.PARTICIPANT_FULL_ID);
-
- IModelParticipant performer = getModelBuilderFacade().findParticipant(
- participantFullId);
- activity.setPerformer(performer);
- }
}
else if (ModelerConstants.SUBPROCESS_ACTIVITY.equals(extractString(activityJson,
ModelerConstants.ACTIVITY_TYPE)))
@@ -424,6 +413,18 @@ public abstract class ModelElementUnmarshaller implements ModelUnmarshaller
getModelBuilderFacade().setApplication(activity, applicationFullId);
}
}
+ if (activity.getImplementation().equals(
+ ActivityImplementationType.MANUAL_LITERAL)
+ && activityJson.has(ModelerConstants.PARTICIPANT_FULL_ID)
+ && !activityJson.get(ModelerConstants.PARTICIPANT_FULL_ID).isJsonNull())
+ {
+ String participantFullId = extractString(activityJson,
+ ModelerConstants.PARTICIPANT_FULL_ID);
+
+ IModelParticipant performer = getModelBuilderFacade().findParticipant(
+ participantFullId);
+ activity.setPerformer(performer);
+ }
}
}
@@ -1019,24 +1020,27 @@ public abstract class ModelElementUnmarshaller implements ModelUnmarshaller
if (nodeSymbolJto.has(ModelerConstants.X_PROPERTY)
&& nodeSymbolJto.has(ModelerConstants.Y_PROPERTY))
{
+ LaneSymbol newParentSymbol = null;
int x = extractInt(nodeSymbolJto, ModelerConstants.X_PROPERTY);
int y = extractInt(nodeSymbolJto, ModelerConstants.Y_PROPERTY);
// adjust coordinates from global to local
int laneOffsetX = 0;
int laneOffsetY = 0;
- ISwimlaneSymbol container = (nodeSymbol.eContainer() instanceof ISwimlaneSymbol)
- ? (ISwimlaneSymbol) nodeSymbol.eContainer()
- : null;
- while (null != container)
+
+ String parentID = extractString(nodeSymbolJto, ModelerConstants.PARENT_SYMBOL_ID_PROPERTY);
+ ProcessDefinitionType processDefinition = ModelUtils.findContainingProcess(nodeSymbol);
+ if ( !(nodeSymbol instanceof LaneSymbol))
{
- laneOffsetX += container.getXPos();
- laneOffsetY += container.getYPos();
+ newParentSymbol = getModelBuilderFacade().findLaneSymbolById(processDefinition,
+ parentID);
+
+ if (null != newParentSymbol)
+ {
+ laneOffsetX = new Long(newParentSymbol.getXPos()).intValue();
+ laneOffsetY = new Long(newParentSymbol.getYPos()).intValue();
+ }
- // recurse
- container = (container.eContainer() instanceof ISwimlaneSymbol)
- ? (ISwimlaneSymbol) container.eContainer()
- : null;
}
nodeSymbol.setXPos(x - laneOffsetX);
@@ -1129,6 +1133,16 @@ public abstract class ModelElementUnmarshaller implements ModelUnmarshaller
nodeSymbol.setHeight(height);
}
}
+ // Type property is used to identify the symbol type, used while changing
+ // parentSymbol on move from one lane to another.
+ if (nodeSymbolJto.has(ModelerConstants.TYPE_PROPERTY))
+ {
+ String symbolType = nodeSymbolJto.get(ModelerConstants.TYPE_PROPERTY).getAsString();
+ if (null != symbolType)
+ {
+ updateParentSymbolForSymbol(nodeSymbol, newParentSymbol, symbolType);
+ }
+ }
}
}
@@ -1192,6 +1206,67 @@ public abstract class ModelElementUnmarshaller implements ModelUnmarshaller
}
/**
+ * remove the association from existing lane and add symbol to new Lane
+ *
+ * @param nodeSymbol
+ * @param newParentSymbol
+ * @param symbolType
+ */
+ private void updateParentSymbolForSymbol(INodeSymbol nodeSymbol,
+ LaneSymbol newParentSymbol, String symbolType)
+ {
+ LaneSymbol parentLane = (LaneSymbol) nodeSymbol.eContainer();
+ if (symbolType.equals(ModelerConstants.ACTIVITY_SYMBOL)
+ || symbolType.equals(ModelerConstants.GATEWAY_SYMBOL))
+ {
+ if (parentLane.getElementOid() != newParentSymbol.getElementOid())
+ {
+ // If the parent is changed, remove reference from old parent
+ parentLane.getActivitySymbol().remove(nodeSymbol);
+ ActivitySymbolType activitySymbol = (ActivitySymbolType) nodeSymbol;
+ // Set the Performer for Activ
+ if (null != activitySymbol.getActivity().getPerformer())
+ {
+ activitySymbol.getActivity()
+ .setPerformer(newParentSymbol.getParticipant());
+ }
+ newParentSymbol.getActivitySymbol().add((ActivitySymbolType) nodeSymbol);
+ }
+ }
+ else if (symbolType.equals(ModelerConstants.EVENT_SYMBOL))
+ {
+ StartEventSymbol startSymbol = getModelBuilderFacade().findStartEventSymbol(
+ parentLane, nodeSymbol.getElementOid());
+ if (null != startSymbol)
+ {
+ if (parentLane.getElementOid() != newParentSymbol.getElementOid())
+ {
+ parentLane.getStartEventSymbols().remove(nodeSymbol);
+
+ newParentSymbol.getStartEventSymbols().add((StartEventSymbol) nodeSymbol);
+ }
+ }
+ else
+ {
+ if (parentLane.getElementOid() != newParentSymbol.getElementOid())
+ {
+ parentLane.getEndEventSymbols().remove(nodeSymbol);
+
+ newParentSymbol.getEndEventSymbols().add((EndEventSymbol) nodeSymbol);
+ }
+ }
+ }
+ else if (symbolType.equals(ModelerConstants.DATA_SYMBOL))
+ {
+ if (parentLane.getElementOid() != newParentSymbol.getElementOid())
+ {
+ parentLane.getDataSymbol().remove(nodeSymbol);
+
+ newParentSymbol.getDataSymbol().add((DataSymbolType) nodeSymbol);
+ }
+ }
+ }
+ /**
*
* @param activitySymbol
* @param gatewaySymbolJson
@@ -1286,6 +1361,18 @@ public abstract class ModelElementUnmarshaller implements ModelUnmarshaller
"stardust::engine:eventClass",
triggerJson.get(ModelerConstants.EVENT_CLASS_PROPERTY).getAsString());
}
+ if (triggerJson.has(ModelerConstants.PARTICIPANT_FULL_ID))
+ {
+ String participantFullId = extractString(triggerJson,
+ ModelerConstants.PARTICIPANT_FULL_ID);
+
+ IModelParticipant performer = getModelBuilderFacade().findParticipant(
+ participantFullId);
+
+ getModelBuilderFacade().setAttribute(trigger,
+ PredefinedConstants.MANUAL_TRIGGER_PARTICIPANT_ATT,
+ performer.getId());
+ }
if (triggerJson.has(ModelerConstants.PARAMETER_MAPPINGS_PROPERTY))
{
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 fa22b15..50c0a42 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
@@ -1052,6 +1052,9 @@ define(
return;
}
+ this.diagram.snapSymbol(this);
+
+ var newGeometry = {};
if (newParentSymbol != this.parentSymbol) {
m_utils.removeItemFromArray(
this.parentSymbol.containedSymbols,
@@ -1063,22 +1066,20 @@ define(
.push(this);
this.parentSymbolId = newParentSymbol.id;
+ newGeometry.modelElement = {
+ participantFullId : this.parentSymbol.participantFullId
+ }
this.onParentSymbolChange();
}
- this.diagram.snapSymbol(this);
-
- var newGeometry = {
- "x" : this.x
- + this.parentSymbol.symbolXOffset,
- "y" : this.y,
- "parentSymbolId" : this.parentSymbol.id,
- "type" : this.type
- };
+ newGeometry['x'] = this.x + this.parentSymbol.symbolXOffset;
+ newGeometry['y'] = this.y;
+ newGeometry['parentSymbolId'] = this.parentSymbol.id;
+ newGeometry['type'] = this.type;
var command = m_command
- .createMoveNodeSymbolCommand(
+ .createUpdateModelElementCommand(
this.diagram.model.id,
this.oid, newGeometry);
command.sync = true;
@@ -1093,13 +1094,7 @@ define(
// TODO Put in method
if (this.isCompleted() != null) {
- // this.submitUpdate();
- var oldGeometry = {
- "x" : this.dragStartX,
- "y" : this.dragStartY,
- "oid" : this.oid
- };
var newGeometry = {
"x" : this.x
+ this.parentSymbol.symbolXOffset,
@@ -1685,7 +1680,7 @@ define(
var changesSymbol = {
x : this.x,
- y : this.y,
+ y : this.y
};
var changeDesc = {
oid : this.oid,
@@ -1694,7 +1689,6 @@ define(
//this.moveBy(0, 0);
-
return changeDesc;
};