summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Pielmann2012-08-17 06:32:06 (EDT)
committer Manik Kishore2012-08-17 06:32:06 (EDT)
commita8f675f8f33bc6b52efffea6b8925c3444e9e4b1 (patch)
treed6792c2e22f2f47dfe8ef60cee05ce7e264c99cb
parent4e44ca695e77f770207630308a285072fdbecc01 (diff)
downloadorg.eclipse.stardust.ide-a8f675f8f33bc6b52efffea6b8925c3444e9e4b1.zip
org.eclipse.stardust.ide-a8f675f8f33bc6b52efffea6b8925c3444e9e4b1.tar.gz
org.eclipse.stardust.ide-a8f675f8f33bc6b52efffea6b8925c3444e9e4b1.tar.bz2
CRNT-25760 Refactor/Clean up MB Facade: Message Transformation Application now creatable in Facade
git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/ide@58472 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
-rw-r--r--model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/utils/MBFacade.java47
-rw-r--r--model/org.eclipse.stardust.model.xpdl.builder/src/test/java/org/eclipse/stardust/model/xpdl/builder/CrossModelSupportModelBuilderTest.java10
2 files changed, 49 insertions, 8 deletions
diff --git a/model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/utils/MBFacade.java b/model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/utils/MBFacade.java
index 08b6c9a..eebcd68 100644
--- a/model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/utils/MBFacade.java
+++ b/model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/utils/MBFacade.java
@@ -385,16 +385,31 @@ public class MBFacade
return data;
}
- public ActivitySymbolType createActivitySymbol(
+ /**
+ * Create an activity diagram symbol
+ *
+ * @param processDefinition process definition to create the symbol in
+ * @param parentSymbolID
+ * @param xProperty
+ * @param yProperty
+ * @param widthProperty
+ * @param heightProperty
+ * @param activity
+ *
+ * @return local or referenced data
+ */
+ public ActivitySymbolType createActivitySymbol(ModelType model,
ProcessDefinitionType processDefinition, String parentSymbolID, int xProperty,
- int yProperty, int widthProperty, int heightProperty, long maxOid,
+ int yProperty, int widthProperty, int heightProperty,
ActivityType activity)
{
+ long maxOID = XpdlModelUtils.getMaxUsedOid(model);
+
ActivitySymbolType activitySymbol = AbstractElementBuilder.F_CWM
.createActivitySymbolType();
LaneSymbol parentLaneSymbol = findLaneInProcess(processDefinition, parentSymbolID);
- activitySymbol.setElementOid(++maxOid);
+ activitySymbol.setElementOid(++maxOID);
activitySymbol.setXPos(xProperty - parentLaneSymbol.getXPos());
activitySymbol.setYPos(yProperty - parentLaneSymbol.getYPos());
activitySymbol.setWidth(widthProperty);
@@ -458,13 +473,31 @@ public class MBFacade
public ApplicationType createApplication(ModelType model, String applicationID,
String applicationName, String applicationTypeID)
{
- ApplicationType application = AbstractElementBuilder.F_CWM
- .createApplicationType();
+ ApplicationType application = AbstractElementBuilder.F_CWM.createApplicationType();
application.setId(applicationID);
application.setName(applicationName);
+ ApplicationTypeType applicationTypeType = null;
+ try
+ {
+ applicationTypeType = findApplicationTypeType(model, applicationTypeID);
+ }
+ catch (Throwable t)
+ {
+ if (applicationTypeID
+ .equalsIgnoreCase(ModelerConstants.MESSAGE_TRANSFORMATION_APPLICATION_TYPE_ID))
+ {
+ applicationTypeType = AbstractElementBuilder.F_CWM
+ .createApplicationTypeType();
+ applicationTypeType.setId(applicationTypeID);
+ applicationTypeType.setName("Message Transformation Application");
+ applicationTypeType.setIsPredefined(true);
+ long maxElementOid = XpdlModelUtils.getMaxUsedOid(model);
+ applicationTypeType.setElementOid(++maxElementOid);
+ model.getApplicationType().add(applicationTypeType);
+ }
+ }
+ application.setType(applicationTypeType);
model.getApplication().add(application);
- application.setType(findApplicationTypeType(model,
- applicationTypeID));
return application;
}
diff --git a/model/org.eclipse.stardust.model.xpdl.builder/src/test/java/org/eclipse/stardust/model/xpdl/builder/CrossModelSupportModelBuilderTest.java b/model/org.eclipse.stardust.model.xpdl.builder/src/test/java/org/eclipse/stardust/model/xpdl/builder/CrossModelSupportModelBuilderTest.java
index 6cc9c6b..38e58c8 100644
--- a/model/org.eclipse.stardust.model.xpdl.builder/src/test/java/org/eclipse/stardust/model/xpdl/builder/CrossModelSupportModelBuilderTest.java
+++ b/model/org.eclipse.stardust.model.xpdl.builder/src/test/java/org/eclipse/stardust/model/xpdl/builder/CrossModelSupportModelBuilderTest.java
@@ -24,6 +24,8 @@ import org.eclipse.stardust.model.xpdl.builder.utils.MBFacade;
import org.eclipse.stardust.model.xpdl.builder.utils.ModelerConstants;
import org.eclipse.stardust.model.xpdl.builder.utils.XpdlModelIoUtils;
import org.eclipse.stardust.model.xpdl.builder.utils.XpdlModelUtils;
+import org.eclipse.stardust.model.xpdl.carnot.ActivityType;
+import org.eclipse.stardust.model.xpdl.carnot.LaneSymbol;
import org.eclipse.stardust.model.xpdl.carnot.ModelType;
import org.eclipse.stardust.model.xpdl.carnot.ProcessDefinitionType;
import org.eclipse.stardust.model.xpdl.xpdl2.ExternalPackage;
@@ -69,12 +71,18 @@ public class CrossModelSupportModelBuilderTest
//Applications
facade.createApplication(providerModel, "WebService", "WebService", ModelerConstants.WEB_SERVICE_APPLICATION_TYPE_ID);
+ facade.createApplication(providerModel, "Message Transformation", "Message Transformation", ModelerConstants.MESSAGE_TRANSFORMATION_APPLICATION_TYPE_ID);
//Activities
- facade.createActivity(providerModel, providedProcess2, "Manual", "ProviderModel:Administrator", "ManualActivity1", "ManualActivity1", null, null);
+ ActivityType activity1 = facade.createActivity(providerModel, providedProcess2, "Manual", "ProviderModel:Administrator", "ManualActivity1", "ManualActivity1", null, null);
facade.createActivity(providerModel, providedProcess2, "Application", null, "AppActivity1", "AppActivity1", "ProviderModel:WebService", null);
facade.createActivity(consumerModel, consumerProcess, "Subprocess", null, "ProvidedProcess1", "ProvidedProcess1", null, "ProviderModel:ProvidedProcess");
+ //Symbols
+ LaneSymbol laneSymbol = facade.findLaneSymbolById(providedProcess2, "DefaultLane");
+ facade.createActivitySymbol(providerModel, providedProcess2, laneSymbol.getId(), 40, 40, 180, 50, activity1);
+
+
//Store
byte[] modelContent = XpdlModelIoUtils.saveModel(providerModel);