summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Pielmann2012-08-14 05:03:50 (EDT)
committerManik Kishore2012-08-14 05:03:50 (EDT)
commit73cfe497687d038c0471944014aaf9639d8af2ea (patch)
treee35102d40d064049820eb3ff8109abf1764b9dfc
parente4fe2a5e9699b9c066305d7cefa2fe1e8feb6c8c (diff)
downloadorg.eclipse.stardust.ide-73cfe497687d038c0471944014aaf9639d8af2ea.zip
org.eclipse.stardust.ide-73cfe497687d038c0471944014aaf9639d8af2ea.tar.gz
org.eclipse.stardust.ide-73cfe497687d038c0471944014aaf9639d8af2ea.tar.bz2
CRNT-25760 Refactor/Clean up MB Facade
git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/ide@58394 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.java24
-rw-r--r--model/org.eclipse.stardust.model.xpdl.builder/src/test/java/org/eclipse/stardust/model/xpdl/builder/CrossModelSupportModelBuilderTest.java6
2 files changed, 8 insertions, 22 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 27a465d..b1307a3 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
@@ -94,11 +94,6 @@ public class MBFacade
return mbFacade;
}
- public MBFacade(ModelManagementStrategy modelManagementStrategy)
- {
- this.modelManagementStrategy = modelManagementStrategy;
- }
-
public ModelManagementStrategy getModelManagementStrategy()
{
return modelManagementStrategy;
@@ -271,29 +266,20 @@ public class MBFacade
return data;
}
- public DataType getDataFromExistingModel(String modelId, ModelType model,
- String dataFullID)
+ public DataType importData(ModelType targetModel, String dataFullID)
{
DataType data;
// TODO Cross-model references
String dataModelId = getModelId(dataFullID);
- if (StringUtils.isEmpty(dataModelId))
- {
- dataModelId = modelId;
- }
- ModelType dataModel = model;
- if (!dataModelId.equals(modelId))
- {
- dataModel = getModelManagementStrategy().getModels().get(dataModelId);
- }
+ ModelType dataModel = getModelManagementStrategy().getModels().get(dataModelId);
data = findData(dataModel, stripFullId(dataFullID));
- if (!dataModelId.equals(modelId))
+ if (!dataModelId.equals(targetModel.getId()))
{
- String fileConnectionId = JcrConnectionManager.createFileConnection(model,
+ String fileConnectionId = JcrConnectionManager.createFileConnection(targetModel,
dataModel);
String bundleId = CarnotConstants.DIAGRAM_PLUGIN_ID;
@@ -304,7 +290,7 @@ public class MBFacade
PepperIconFactory iconFactory = new PepperIconFactory();
- descriptor.importElements(iconFactory, model, true);
+ descriptor.importElements(iconFactory, targetModel, true);
}
return data;
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 47373c6..ea0202d 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,7 +43,7 @@ public class CrossModelSupportModelBuilderTest
ModelType consumerModel = newBpmModel().withName("ConsumerModel").build();
strategy.loadModels().add(consumerModel);
strategy.loadModels().add(providerModel);
- MBFacade.getInstance().createRole(providerModel, "Adminitrator", "Administrator");
+ MBFacade.getInstance(strategy).createRole(providerModel, "Adminitrator", "Administrator");
MBFacade.getInstance().createRole(consumerModel, "Adminitrator", "Administrator");
MBFacade.getInstance().createPrimitiveData(providerModel, "ProvidedPrimitive",
"ProvidedPrimitive", ModelerConstants.STRING_PRIMITIVE_DATA_TYPE);
@@ -53,10 +53,10 @@ public class CrossModelSupportModelBuilderTest
"ProvidedProcess", "ProvidedProcess");
ProcessDefinitionType consumerProcess = MBFacade.getInstance().createProcess(consumerModel,
"ConsumerProcess", "ConsumerProcess");
- new MBFacade(strategy).createStructuredData(consumerModel, "ProviderModel", "ProvidedComposite1",
+ MBFacade.getInstance().createStructuredData(consumerModel, "ProviderModel", "ProvidedComposite1",
"ProvidedComposite1", "ProvidedComposite");
long maxOid = XpdlModelUtils.getMaxUsedOid(consumerModel);
- new MBFacade(strategy).createActivity("ConsumerModel", consumerProcess, "Subprocess", null,
+ MBFacade.getInstance().createActivity("ConsumerModel", consumerProcess, "Subprocess", null,
"ProvidedProcess1", "ProvidedProcess1", null,
"ProviderModel:ProvidedProcess", maxOid);
byte[] modelContent = XpdlModelIoUtils.saveModel(consumerModel);