summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Pielmann2012-08-15 08:49:39 (EDT)
committerManik Kishore2012-08-15 08:49:39 (EDT)
commit2388245790e30d83af7d7b164e6cb06609935ace (patch)
tree875599ee0ae0807dd1fe7eb083f892a2c397cc74
parentf3822780a824b4698c053e339993b1828dd43f1f (diff)
downloadorg.eclipse.stardust.ide-2388245790e30d83af7d7b164e6cb06609935ace.zip
org.eclipse.stardust.ide-2388245790e30d83af7d7b164e6cb06609935ace.tar.gz
org.eclipse.stardust.ide-2388245790e30d83af7d7b164e6cb06609935ace.tar.bz2
CRNT-25760 Refactor/Clean up MB Facade: Added createApplicationMethod to fascade
git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/ide@58431 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.java38
-rw-r--r--model/org.eclipse.stardust.model.xpdl.builder/src/test/java/org/eclipse/stardust/model/xpdl/builder/CrossModelSupportModelBuilderTest.java53
2 files changed, 61 insertions, 30 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 eb6e54c..c737a6f 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
@@ -213,13 +213,13 @@ public class MBFacade
}
public DataType createDocumentData(ModelType model, String id, String name,
- String structuredDataFullId)
+ String structuredDataId)
{
DataType data;
BpmDocumentVariableBuilder documentVariable = newDocumentVariable(model);
- if (!StringUtils.isEmpty(structuredDataFullId))
+ if (!StringUtils.isEmpty(structuredDataId))
{
- documentVariable.setTypeDeclaration(structuredDataFullId);
+ documentVariable.setTypeDeclaration(structuredDataId);
}
data = documentVariable.withIdAndName(id, name).build();
@@ -227,8 +227,8 @@ public class MBFacade
return data;
}
-
- public DataType createStructuredData(ModelType model, String dataID, String dataName, String typeFullID)
+ public DataType createStructuredData(ModelType model, String dataID, String dataName,
+ String typeFullID)
{
DataType data;
String sourceModelID = MBFacade.getInstance().getModelId(typeFullID);
@@ -238,7 +238,8 @@ public class MBFacade
BpmStructVariableBuilder structVariable = newStructVariable(model);
structVariable.setTypeDeclarationModel(typeDeclarationModel);
- data = structVariable.withIdAndName(dataID, dataName).ofType(this.stripFullId(typeFullID)).build();
+ data = structVariable.withIdAndName(dataID, dataName)
+ .ofType(this.stripFullId(typeFullID)).build();
return data;
}
@@ -378,11 +379,26 @@ public class MBFacade
return org;
}
- public ActivityType createActivity(String modelId,
+ public ApplicationType createApplication(ModelType model, String applicationID,
+ String applicationName, String applicationTypeID)
+ {
+ ApplicationType application = AbstractElementBuilder.F_CWM
+ .createApplicationType();
+ application.setId(applicationID);
+ application.setName(applicationName);
+ model.getApplication().add(application);
+ application.setType(findApplicationTypeType(model,
+ applicationTypeID));
+ return application;
+ }
+
+ public ActivityType createActivity(ModelType model,
ProcessDefinitionType processDefinition, String activityType,
String participantFullID, String activityID, String activityName,
- String applicationFullID, String subProcessFullID, long maxOid)
+ String applicationFullID, String subProcessFullID)
{
+ long maxOid = XpdlModelUtils.getMaxUsedOid(model) + 1;
+
ActivityType activity = null;
if (ModelerConstants.MANUAL_ACTIVITY.equals(activityType))
@@ -406,7 +422,7 @@ public class MBFacade
String stripFullId_ = getModelId(applicationFullID);
if (StringUtils.isEmpty(stripFullId_))
{
- stripFullId_ = modelId;
+ stripFullId_ = model.getId();
}
ApplicationType application = getApplication(stripFullId_,
@@ -428,7 +444,7 @@ public class MBFacade
String stripFullId = getModelId(subProcessFullID);
if (StringUtils.isEmpty(stripFullId))
{
- stripFullId = modelId;
+ stripFullId = model.getId();
}
ProcessDefinitionType subProcessDefinition = findProcessDefinition(
@@ -440,7 +456,7 @@ public class MBFacade
subProcessActivity.setSubProcessModel(subProcessModel);
activity = subProcessActivity
- .withIdAndName(modelId, activityName)
+ .withIdAndName(model.getId(), activityName)
.invokingProcess(
findProcessDefinition(
getModelManagementStrategy().getModels().get(
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 509ae20..2d5a4dc 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
@@ -43,25 +43,40 @@ public class CrossModelSupportModelBuilderTest
ModelType consumerModel = newBpmModel().withName("ConsumerModel").build();
strategy.loadModels().add(consumerModel);
strategy.loadModels().add(providerModel);
- MBFacade.getInstance(strategy).createRole(providerModel, "Adminitrator", "Administrator");
- MBFacade.getInstance().createRole(consumerModel, "Adminitrator", "Administrator");
- MBFacade.getInstance().createPrimitiveData(providerModel, "ProvidedPrimitive",
- "ProvidedPrimitive", ModelerConstants.STRING_PRIMITIVE_DATA_TYPE);
- MBFacade.getInstance().createTypeDeclaration(providerModel, "ProvidedComposite",
- "ProvidedComposite");
- ProcessDefinitionType providedProcess = MBFacade.getInstance().createProcess(providerModel,
- "ProvidedProcess", "ProvidedProcess");
- ProcessDefinitionType consumerProcess = MBFacade.getInstance().createProcess(consumerModel,
- "ConsumerProcess", "ConsumerProcess");
- MBFacade.getInstance().createStructuredData(providerModel, "LocalComposite1", "LocalComposite1", "ProviderModel:ProvidedComposite");
-
- MBFacade.getInstance().createStructuredData(consumerModel, "ProvidedComposite1", "ProvidedComposite1", "ProviderModel:ProvidedComposite");
-
- long maxOid = XpdlModelUtils.getMaxUsedOid(consumerModel);
- MBFacade.getInstance().createActivity("ConsumerModel", consumerProcess, "Subprocess", null,
- "ProvidedProcess1", "ProvidedProcess1", null,
- "ProviderModel:ProvidedProcess", maxOid);
- byte[] modelContent = XpdlModelIoUtils.saveModel(providerModel);
+
+ //Participants
+ MBFacade.getInstance(strategy).createRole(providerModel, "Administrator", "Administrator");
+ MBFacade.getInstance().createRole(consumerModel, "Administrator", "Administrator");
+
+ //Primitive Data
+ MBFacade.getInstance().createPrimitiveData(providerModel, "ProvidedPrimitive", "ProvidedPrimitive", ModelerConstants.STRING_PRIMITIVE_DATA_TYPE);
+
+ //Type Declaration
+ MBFacade.getInstance().createTypeDeclaration(providerModel, "ProvidedComposite", "ProvidedComposite");
+
+ //Processes
+ ProcessDefinitionType providedProcess = MBFacade.getInstance().createProcess(providerModel, "ProvidedProcess", "ProvidedProcess");
+ ProcessDefinitionType providedProcess2 = MBFacade.getInstance().createProcess(providerModel, "ProvidedProcess2", "ProvidedProcess2");
+ ProcessDefinitionType consumerProcess = MBFacade.getInstance().createProcess(consumerModel, "ConsumerProcess", "ConsumerProcess");
+
+
+ //Structured Data / Document Data
+ MBFacade.getInstance().createStructuredData(providerModel, "LocalComposite1", "LocalComposite1", "ProviderModel:ProvidedComposite");
+ MBFacade.getInstance().createStructuredData(consumerModel, "ProvidedComposite1", "ProvidedComposite1", "ProviderModel:ProvidedComposite");
+ MBFacade.getInstance().createDocumentData(providerModel, "LocalDocument", "LocalDocument", "ProvidedComposite");
+
+ //Applications
+ MBFacade.getInstance().createApplication(providerModel, "WebService", "WebService", ModelerConstants.WEB_SERVICE_APPLICATION_TYPE_ID);
+
+ //Activities
+ MBFacade.getInstance().createActivity(providerModel, providedProcess2, "Manual", "ProviderModel:Administrator", "ManualActivity1", "ManualActivity1", null, null);
+ MBFacade.getInstance().createActivity(providerModel, providedProcess2, "Application", null, "AppActivity1", "AppActivity1", "ProviderModel:WebService", null);
+ MBFacade.getInstance().createActivity(consumerModel, consumerProcess, "Subprocess", null, "ProvidedProcess1", "ProvidedProcess1", null, "ProviderModel:ProvidedProcess");
+
+ //Store
+ byte[] modelContent = XpdlModelIoUtils.saveModel(providerModel);
+
+ //Output
System.out.println(new String(modelContent));
}