summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Pielmann2012-08-16 09:01:59 (EDT)
committerManik Kishore2012-08-16 09:01:59 (EDT)
commit69a6c3e839f395ded05a5bbbb481ff9943beb8ec (patch)
tree930ab833d20431f392f449c65506451cfd672bd6
parent2d94d772f1e713b4e61d8e3a2d941b18c4cf6f84 (diff)
downloadorg.eclipse.stardust.ui.web-69a6c3e839f395ded05a5bbbb481ff9943beb8ec.zip
org.eclipse.stardust.ui.web-69a6c3e839f395ded05a5bbbb481ff9943beb8ec.tar.gz
org.eclipse.stardust.ui.web-69a6c3e839f395ded05a5bbbb481ff9943beb8ec.tar.bz2
CRNT-25760 Refactor/Clean up MB Facade: Remove Singleton stuff
git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/ui.web@58461 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
-rw-r--r--web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/ModelingSession.java14
-rw-r--r--web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/ActivityCommandHandler.java28
-rw-r--r--web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/DataCommandHandler.java21
-rw-r--r--web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/EventCommandHandler.java22
-rw-r--r--web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/GatewayCommandHandler.java20
-rw-r--r--web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/SwimlaneCommandHandler.java18
-rw-r--r--web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/model/element/ApplicationTypeChangeCommandHandler.java21
-rw-r--r--web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/model/element/DataChangeCommandHandler.java21
-rw-r--r--web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/model/element/ProcessChangeCommandHandler.java15
-rw-r--r--web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/model/element/StructuredTypeChangeCommandHandler.java15
-rw-r--r--web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/marshaling/ModelElementMarshaller.java28
-rw-r--r--web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/marshaling/ModelElementUnmarshaller.java23
-rw-r--r--web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/service/DefaultModelManagementStrategy.java6
-rw-r--r--web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/service/ModelService.java89
-rw-r--r--web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/service/TestModelManagementStrategy.java2
15 files changed, 247 insertions, 96 deletions
diff --git a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/ModelingSession.java b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/ModelingSession.java
index 489849f..3f68fa4 100644
--- a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/ModelingSession.java
+++ b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/ModelingSession.java
@@ -8,10 +8,6 @@ import java.util.Map;
import javax.annotation.Resource;
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Component;
-
import org.eclipse.stardust.engine.api.runtime.User;
import org.eclipse.stardust.model.xpdl.builder.common.EObjectUUIDMapper;
import org.eclipse.stardust.model.xpdl.builder.session.EditingSession;
@@ -20,6 +16,9 @@ import org.eclipse.stardust.model.xpdl.builder.utils.MBFacade;
import org.eclipse.stardust.model.xpdl.carnot.ModelType;
import org.eclipse.stardust.ui.web.modeler.marshaling.ModelElementMarshaller;
import org.eclipse.stardust.ui.web.modeler.marshaling.ModelElementUnmarshaller;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Component;
@Component
@Scope("prototype")
@@ -46,6 +45,12 @@ public class ModelingSession
{
return uuidMapper();
}
+
+ @Override
+ protected ModelManagementStrategy modelManagementStrategy()
+ {
+ return ModelingSession.this.modelManagementStrategy();
+ }
};
private ModelElementUnmarshaller modelElementUnmarshaller = new ModelElementUnmarshaller()
@@ -79,7 +84,6 @@ public class ModelingSession
public ModelManagementStrategy modelManagementStrategy()
{
- MBFacade.getInstance(modelManagementStrategy);
return modelManagementStrategy;
}
diff --git a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/ActivityCommandHandler.java b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/ActivityCommandHandler.java
index f24cfa9..fa6cf94 100644
--- a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/ActivityCommandHandler.java
+++ b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/ActivityCommandHandler.java
@@ -20,8 +20,6 @@ import static org.eclipse.stardust.ui.web.modeler.service.ModelService.Y_PROPERT
import javax.annotation.Resource;
-import com.google.gson.JsonObject;
-
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.XpdlModelUtils;
@@ -34,6 +32,9 @@ import org.eclipse.stardust.model.xpdl.carnot.util.ModelUtils;
import org.eclipse.stardust.ui.web.modeler.edit.spi.CommandHandler;
import org.eclipse.stardust.ui.web.modeler.edit.spi.OnCommand;
import org.eclipse.stardust.ui.web.modeler.service.ModelService;
+import org.springframework.context.ApplicationContext;
+
+import com.google.gson.JsonObject;
/**
*
@@ -42,9 +43,10 @@ import org.eclipse.stardust.ui.web.modeler.service.ModelService;
*/
@CommandHandler
public class ActivityCommandHandler
-{
+{
@Resource
- private ModelService modelService;
+ private ApplicationContext springContext;
+ private MBFacade facade;
/**
* @param parentLaneSymbol
@@ -78,12 +80,12 @@ public class ActivityCommandHandler
{
long maxOid = XpdlModelUtils.getMaxUsedOid(model);
- ActivityType activity = MBFacade.getInstance().createActivity(model, processDefinition, activityType, participantFullID,
+ ActivityType activity = facade().createActivity(model, processDefinition, activityType, participantFullID,
activityId, activityName, applicationFullID, subProcessID);
ModelService.setDescription(activity, request.getAsJsonObject(ModelerConstants.MODEL_ELEMENT_PROPERTY));
- ActivitySymbolType activitySymbol = MBFacade.getInstance().createActivitySymbol(processDefinition, parentLaneSymbol.getId(),
+ ActivitySymbolType activitySymbol = facade().createActivitySymbol(processDefinition, parentLaneSymbol.getId(),
xProperty, yProperty, widthProperty, heightProperty, maxOid, activity);
}
}
@@ -100,7 +102,7 @@ public class ActivityCommandHandler
ProcessDefinitionType processDefinition = ModelUtils.findContainingProcess(parentLaneSymbol);
String activityId = extractString(request, ModelerConstants.MODEL_ELEMENT_PROPERTY, ModelerConstants.ID_PROPERTY);
- ActivityType activity = MBFacade.getInstance().findActivity(processDefinition, activityId);
+ ActivityType activity = facade().findActivity(processDefinition, activityId);
ActivitySymbolType activitySymbol = activity.getActivitySymbols().get(0);
synchronized (model)
@@ -114,4 +116,16 @@ public class ActivityCommandHandler
}
}
+
+ private MBFacade facade()
+ {
+ if (facade == null)
+ {
+ facade = new MBFacade(springContext.getBean(ModelService.class)
+ .getModelManagementStrategy());
+ }
+ return facade;
+ }
+
+
}
diff --git a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/DataCommandHandler.java b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/DataCommandHandler.java
index b37b6b5..b7ebaf8 100644
--- a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/DataCommandHandler.java
+++ b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/DataCommandHandler.java
@@ -46,6 +46,7 @@ public class DataCommandHandler
@Resource
private ApplicationContext springContext;
+ private MBFacade facade;
/**
*
@@ -76,20 +77,20 @@ public class DataCommandHandler
try
{
- data = MBFacade.getInstance().importData(model, dataFullID);
+ data = facade().importData(model, dataFullID);
}
catch (ObjectNotFoundException x)
{
if (true)
{
- data = MBFacade.getInstance().createPrimitiveData(model, dataID, dataName,
+ data = facade().createPrimitiveData(model, dataID, dataName,
ModelerConstants.STRING_PRIMITIVE_DATA_TYPE);
mapper.map(data);
data.setElementOid(++maxOid);
}
}
- DataSymbolType dataSymbol = MBFacade.getInstance().createDataSymbol(processDefinition,
+ DataSymbolType dataSymbol = facade().createDataSymbol(processDefinition,
xProperty, yProperty, widthProperty, heightProperty, parentLaneSymbol.getId(),
maxOid, data);
mapper.map(dataSymbol);
@@ -108,8 +109,8 @@ public class DataCommandHandler
ProcessDefinitionType processDefinition = ModelUtils.findContainingProcess(parentLaneSymbol);
Long dataOID = extractLong(request, ModelerConstants.OID_PROPERTY);
String dataFullID = extractString(request, ModelerConstants.DATA_FULL_ID_PROPERTY);
- DataType data = MBFacade.getInstance().importData(model, dataFullID);
- DataSymbolType dataSymbol = MBFacade.getInstance().findDataSymbolRecursively(parentLaneSymbol,
+ DataType data = facade().importData(model, dataFullID);
+ DataSymbolType dataSymbol = facade().findDataSymbolRecursively(parentLaneSymbol,
dataOID);
synchronized (model)
{
@@ -124,4 +125,14 @@ public class DataCommandHandler
{
return springContext.getBean(ModelService.class);
}
+
+ private MBFacade facade()
+ {
+ if (facade == null)
+ {
+ facade = new MBFacade(springContext.getBean(ModelService.class)
+ .getModelManagementStrategy());
+ }
+ return facade;
+ }
}
diff --git a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/EventCommandHandler.java b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/EventCommandHandler.java
index 9aa3fdd..8b5acd5 100644
--- a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/EventCommandHandler.java
+++ b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/EventCommandHandler.java
@@ -21,6 +21,8 @@ import static org.eclipse.stardust.ui.web.modeler.service.ModelService.WIDTH_PRO
import static org.eclipse.stardust.ui.web.modeler.service.ModelService.X_PROPERTY;
import static org.eclipse.stardust.ui.web.modeler.service.ModelService.Y_PROPERTY;
+import javax.annotation.Resource;
+
import com.google.gson.JsonObject;
import org.eclipse.stardust.model.xpdl.builder.common.AbstractElementBuilder;
@@ -35,6 +37,8 @@ import org.eclipse.stardust.model.xpdl.carnot.StartEventSymbol;
import org.eclipse.stardust.model.xpdl.carnot.util.ModelUtils;
import org.eclipse.stardust.ui.web.modeler.edit.spi.CommandHandler;
import org.eclipse.stardust.ui.web.modeler.edit.spi.OnCommand;
+import org.eclipse.stardust.ui.web.modeler.service.ModelService;
+import org.springframework.context.ApplicationContext;
/**
* @author Sidharth.Singh
@@ -42,6 +46,10 @@ import org.eclipse.stardust.ui.web.modeler.edit.spi.OnCommand;
@CommandHandler
public class EventCommandHandler
{
+ @Resource
+ private ApplicationContext springContext;
+ private MBFacade facade;
+
@OnCommand(commandId = "eventSymbol.create")
public void createEvent(LaneSymbol parentLaneSymbol, JsonObject request)
{
@@ -108,7 +116,7 @@ public class EventCommandHandler
if (START_EVENT.equals(extractString(request,
ModelerConstants.MODEL_ELEMENT_PROPERTY, EVENT_TYPE_PROPERTY)))
{
- StartEventSymbol startEventSymbol = MBFacade.getInstance().findStartEventSymbol(
+ StartEventSymbol startEventSymbol = facade().findStartEventSymbol(
parentLaneSymbol, eventOId);
processDefinition.getDiagram()
.get(0)
@@ -118,7 +126,7 @@ public class EventCommandHandler
}
else
{
- EndEventSymbol endEventSymbol = MBFacade.getInstance().findEndEventSymbol(parentLaneSymbol,
+ EndEventSymbol endEventSymbol = facade().findEndEventSymbol(parentLaneSymbol,
eventOId);
processDefinition.getDiagram()
.get(0)
@@ -128,5 +136,15 @@ public class EventCommandHandler
}
}
}
+
+ private MBFacade facade()
+ {
+ if (facade == null)
+ {
+ facade = new MBFacade(springContext.getBean(ModelService.class)
+ .getModelManagementStrategy());
+ }
+ return facade;
+ }
}
diff --git a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/GatewayCommandHandler.java b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/GatewayCommandHandler.java
index f132696..188ca5a 100644
--- a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/GatewayCommandHandler.java
+++ b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/GatewayCommandHandler.java
@@ -20,6 +20,8 @@ import static org.eclipse.stardust.ui.web.modeler.service.ModelService.WIDTH_PRO
import static org.eclipse.stardust.ui.web.modeler.service.ModelService.X_PROPERTY;
import static org.eclipse.stardust.ui.web.modeler.service.ModelService.Y_PROPERTY;
+import javax.annotation.Resource;
+
import com.google.gson.JsonObject;
import org.eclipse.stardust.model.xpdl.builder.common.AbstractElementBuilder;
@@ -35,6 +37,8 @@ import org.eclipse.stardust.model.xpdl.carnot.ProcessDefinitionType;
import org.eclipse.stardust.model.xpdl.carnot.util.ModelUtils;
import org.eclipse.stardust.ui.web.modeler.edit.spi.CommandHandler;
import org.eclipse.stardust.ui.web.modeler.edit.spi.OnCommand;
+import org.eclipse.stardust.ui.web.modeler.service.ModelService;
+import org.springframework.context.ApplicationContext;
/**
* @author Sidharth.Singh
@@ -42,6 +46,10 @@ import org.eclipse.stardust.ui.web.modeler.edit.spi.OnCommand;
@CommandHandler
public class GatewayCommandHandler
{
+ @Resource
+ private ApplicationContext springContext;
+ private MBFacade facade;
+
@OnCommand(commandId = "gateSymbol.create")
public void createGateway(LaneSymbol parentLaneSymbol, JsonObject request)
{
@@ -95,7 +103,7 @@ public class GatewayCommandHandler
ProcessDefinitionType processDefinition = ModelUtils.findContainingProcess(parentLaneSymbol);
String gatewayId = extractString(request, ModelerConstants.MODEL_ELEMENT_PROPERTY, ModelerConstants.ID_PROPERTY);
- ActivityType gateway = MBFacade.getInstance().findActivity(processDefinition, gatewayId);
+ ActivityType gateway = facade().findActivity(processDefinition, gatewayId);
ActivitySymbolType gatewaySymbol = gateway.getActivitySymbols().get(0);
synchronized (model)
{
@@ -106,5 +114,15 @@ public class GatewayCommandHandler
}
}
+
+ private MBFacade facade()
+ {
+ if (facade == null)
+ {
+ facade = new MBFacade(springContext.getBean(ModelService.class)
+ .getModelManagementStrategy());
+ }
+ return facade;
+ }
}
diff --git a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/SwimlaneCommandHandler.java b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/SwimlaneCommandHandler.java
index 999b35f..1c6668c 100644
--- a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/SwimlaneCommandHandler.java
+++ b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/SwimlaneCommandHandler.java
@@ -30,6 +30,7 @@ import org.eclipse.stardust.model.xpdl.carnot.util.ModelUtils;
import org.eclipse.stardust.ui.web.modeler.edit.spi.CommandHandler;
import org.eclipse.stardust.ui.web.modeler.edit.spi.OnCommand;
import org.eclipse.stardust.ui.web.modeler.service.ModelService;
+import org.springframework.context.ApplicationContext;
import com.google.gson.JsonObject;
@@ -40,7 +41,8 @@ import com.google.gson.JsonObject;
public class SwimlaneCommandHandler
{
@Resource
- private ModelService modelService;
+ private ApplicationContext springContext;
+ private MBFacade facade;
/**
* @param parentSymbol
@@ -64,7 +66,7 @@ public class SwimlaneCommandHandler
synchronized (model)
{
- LaneSymbol laneSymbol = MBFacade.getInstance().createLane(model.getId(), model,
+ LaneSymbol laneSymbol = facade().createLane(model.getId(), model,
processDefinition, laneId, laneName, xPos, yPos, width, height,
orientation, participantFullID);
@@ -87,7 +89,7 @@ public class SwimlaneCommandHandler
ProcessDefinitionType processDefinition = ModelUtils.findContainingProcess(parentSymbol);
String laneId = extractString(request, ModelerConstants.ID_PROPERTY);
- LaneSymbol lane = MBFacade.getInstance().findLaneInProcess(processDefinition, laneId);
+ LaneSymbol lane = facade().findLaneInProcess(processDefinition, laneId);
synchronized (model)
{
@@ -95,4 +97,14 @@ public class SwimlaneCommandHandler
parentSymbol.getChildLanes().remove(lane);
}
}
+
+ private MBFacade facade()
+ {
+ if (facade == null)
+ {
+ facade = new MBFacade(springContext.getBean(ModelService.class)
+ .getModelManagementStrategy());
+ }
+ return facade;
+ }
}
diff --git a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/model/element/ApplicationTypeChangeCommandHandler.java b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/model/element/ApplicationTypeChangeCommandHandler.java
index 323909e..aa71832 100644
--- a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/model/element/ApplicationTypeChangeCommandHandler.java
+++ b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/model/element/ApplicationTypeChangeCommandHandler.java
@@ -32,6 +32,7 @@ public class ApplicationTypeChangeCommandHandler
{
@Resource
private ApplicationContext springContext;
+ private MBFacade facade;
@OnCommand(commandId = "webServiceApplication.create")
public void createWebServiceApp(ModelType model, JsonObject request)
@@ -39,7 +40,7 @@ public class ApplicationTypeChangeCommandHandler
String applicationID = extractString(request, ModelerConstants.ID_PROPERTY);
String applicationName = extractString(request, ModelerConstants.NAME_PROPERTY);
- ApplicationType applicationType = MBFacade.getInstance().createApplication(model,
+ ApplicationType applicationType = facade().createApplication(model,
applicationID, applicationName,
ModelerConstants.WEB_SERVICE_APPLICATION_TYPE_ID);
@@ -70,7 +71,7 @@ public class ApplicationTypeChangeCommandHandler
ModelerConstants.MESSAGE_TRANSFORMATION_APPLICATION_TYPE_ID);
// TODO
- // applicationType.setType(MBFacade.getInstance().findApplicationTypeType(model,
+ // applicationType.setType(facade().findApplicationTypeType(model,
// ModelerConstants.MESSAGE_TRANSFORMATION_APPLICATION_TYPE_ID));
}
@@ -95,7 +96,7 @@ public class ApplicationTypeChangeCommandHandler
ModelerConstants.CAMEL_APPLICATION_TYPE_ID);
// TODO
- // applicationType.setType(MBFacade.getInstance().findApplicationTypeType(model,
+ // applicationType.setType(facade().findApplicationTypeType(model,
// ModelerConstants.MESSAGE_TRANSFORMATION_APPLICATION_TYPE_ID));
}
@@ -120,7 +121,7 @@ public class ApplicationTypeChangeCommandHandler
ModelerConstants.INTERACTIVE_APPLICATION_TYPE_KEY);
// TODO
- // applicationType.setType(MBFacade.getInstance().findApplicationTypeType(model,
+ // applicationType.setType(facade().findApplicationTypeType(model,
// ModelerConstants.MESSAGE_TRANSFORMATION_APPLICATION_TYPE_ID));
}
@@ -133,7 +134,7 @@ public class ApplicationTypeChangeCommandHandler
{
ModelType model = (ModelType) targetElement;
String appId = extractString(request, ModelerConstants.ID_PROPERTY);
- ApplicationType application = MBFacade.getInstance().findApplication(model, appId);
+ ApplicationType application = facade().findApplication(model, appId);
synchronized (model)
{
@@ -145,4 +146,14 @@ public class ApplicationTypeChangeCommandHandler
{
return springContext.getBean(ModelService.class);
}
+
+ private MBFacade facade()
+ {
+ if (facade == null)
+ {
+ facade = new MBFacade(springContext.getBean(ModelService.class)
+ .getModelManagementStrategy());
+ }
+ return facade;
+ }
}
diff --git a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/model/element/DataChangeCommandHandler.java b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/model/element/DataChangeCommandHandler.java
index bc6bb7a..39b2d8a 100644
--- a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/model/element/DataChangeCommandHandler.java
+++ b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/model/element/DataChangeCommandHandler.java
@@ -46,6 +46,7 @@ public class DataChangeCommandHandler
{
@Resource
private ApplicationContext springContext;
+ private MBFacade facade;
/**
* @param model
@@ -57,7 +58,7 @@ public class DataChangeCommandHandler
String id = extractString(request, ModelerConstants.ID_PROPERTY);
String name = extractString(request, ModelerConstants.NAME_PROPERTY);
String primitiveType = extractString(request, ModelerConstants.PRIMITIVE_TYPE);
- DataType data = MBFacade.getInstance().createPrimitiveData(model, id, name, primitiveType);
+ DataType data = facade().createPrimitiveData(model, id, name, primitiveType);
long maxOid = XpdlModelUtils.getMaxUsedOid(model);
data.setElementOid(++maxOid);
@@ -77,14 +78,14 @@ public class DataChangeCommandHandler
String id = extractString(request, ModelerConstants.ID_PROPERTY);
String name = extractString(request, ModelerConstants.NAME_PROPERTY);
String dataFullID = extractString(request, ModelerConstants.STRUCTURED_DATA_TYPE_FULL_ID);
- String stripFullId_ = MBFacade.getInstance().getModelId(extractString(request,
+ String stripFullId_ = facade().getModelId(extractString(request,
ModelerConstants.STRUCTURED_DATA_TYPE_FULL_ID));
if (StringUtils.isEmpty(stripFullId_))
{
stripFullId_ = model.getId();
}
- DataType data = MBFacade.getInstance().createStructuredData(model, id, name,
+ DataType data = facade().createStructuredData(model, id, name,
dataFullID);
long maxOid = XpdlModelUtils.getMaxUsedOid(model);
@@ -105,7 +106,7 @@ public class DataChangeCommandHandler
String id = extractString(request, ModelerConstants.ID_PROPERTY);
String name = extractString(request, ModelerConstants.NAME_PROPERTY);
- DataType data = MBFacade.getInstance().createDocumentData(model, id, name, null);
+ DataType data = facade().createDocumentData(model, id, name, null);
long maxOid = XpdlModelUtils.getMaxUsedOid(model);
data.setElementOid(++maxOid);
@@ -123,7 +124,7 @@ public class DataChangeCommandHandler
public void deletetData(ModelType model, JsonObject request)
{
String id = extractString(request, ModelerConstants.ID_PROPERTY);
- DataType data = MBFacade.getInstance().findData(model, id);
+ DataType data = facade().findData(model, id);
synchronized (model)
{
@@ -166,4 +167,14 @@ public class DataChangeCommandHandler
}
}
}
+
+ private MBFacade facade()
+ {
+ if (facade == null)
+ {
+ facade = new MBFacade(springContext.getBean(ModelService.class)
+ .getModelManagementStrategy());
+ }
+ return facade;
+ }
}
diff --git a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/model/element/ProcessChangeCommandHandler.java b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/model/element/ProcessChangeCommandHandler.java
index 38c905e..7e3c230 100644
--- a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/model/element/ProcessChangeCommandHandler.java
+++ b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/model/element/ProcessChangeCommandHandler.java
@@ -48,12 +48,13 @@ public class ProcessChangeCommandHandler
{
@Resource
private ApplicationContext springContext;
+ private MBFacade facade;
@OnCommand(commandId = "process.create")
public void createProcess(ModelType model, JsonObject request)
{
String name = extractString(request, ModelerConstants.NAME_PROPERTY);
- String id = MBFacade.getInstance().createIdFromName(name);
+ String id = facade().createIdFromName(name);
ProcessDefinitionType processDefinition = newProcessDefinition(model).withIdAndName(id, name).build();
//Added process definition to UUID map.
EObjectUUIDMapper mapper = modelService().uuidMapper();
@@ -123,7 +124,7 @@ public class ProcessChangeCommandHandler
public void deleteProcess(ModelType model, JsonObject request)
{
String id = extractString(request, ModelerConstants.ID_PROPERTY);
- ProcessDefinitionType processDefinition = MBFacade.getInstance().findProcessDefinition(model, id);
+ ProcessDefinitionType processDefinition = facade().findProcessDefinition(model, id);
synchronized (model)
{
model.getProcessDefinition().remove(processDefinition);
@@ -134,4 +135,14 @@ public class ProcessChangeCommandHandler
{
return springContext.getBean(ModelService.class);
}
+
+ private MBFacade facade()
+ {
+ if (facade == null)
+ {
+ facade = new MBFacade(springContext.getBean(ModelService.class)
+ .getModelManagementStrategy());
+ }
+ return facade;
+ }
}
diff --git a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/model/element/StructuredTypeChangeCommandHandler.java b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/model/element/StructuredTypeChangeCommandHandler.java
index d7a2a27..51e7af4 100644
--- a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/model/element/StructuredTypeChangeCommandHandler.java
+++ b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/model/element/StructuredTypeChangeCommandHandler.java
@@ -30,6 +30,7 @@ public class StructuredTypeChangeCommandHandler
{
@Resource
private ApplicationContext springContext;
+ private MBFacade facade;
public static final String TYPE_PROPERTY = "type";
@@ -45,7 +46,7 @@ public class StructuredTypeChangeCommandHandler
synchronized (model)
{
EObjectUUIDMapper mapper = modelService().uuidMapper();
- mapper.map(MBFacade.getInstance().createTypeDeclaration(model, typeId, typeName));
+ mapper.map(facade().createTypeDeclaration(model, typeId, typeName));
}
}
@@ -58,7 +59,7 @@ public class StructuredTypeChangeCommandHandler
String structuredDataTypeId = extractString(request,
ModelerConstants.ID_PROPERTY);
- TypeDeclarationType structuredDataType = MBFacade.getInstance()
+ TypeDeclarationType structuredDataType = facade()
.findStructuredDataType(model, structuredDataTypeId);
synchronized (model) {
model.getTypeDeclarations().getTypeDeclaration()
@@ -70,4 +71,14 @@ public class StructuredTypeChangeCommandHandler
{
return springContext.getBean(ModelService.class);
}
+
+ private MBFacade facade()
+ {
+ if (facade == null)
+ {
+ facade = new MBFacade(springContext.getBean(ModelService.class)
+ .getModelManagementStrategy());
+ }
+ return facade;
+ }
}
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 9df09e8..0a69ad7 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
@@ -8,6 +8,7 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.stardust.common.StringUtils;
import org.eclipse.stardust.engine.api.model.PredefinedConstants;
import org.eclipse.stardust.model.xpdl.builder.common.EObjectUUIDMapper;
+import org.eclipse.stardust.model.xpdl.builder.strategy.ModelManagementStrategy;
import org.eclipse.stardust.model.xpdl.builder.utils.MBFacade;
import org.eclipse.stardust.model.xpdl.builder.utils.ModelerConstants;
import org.eclipse.stardust.model.xpdl.carnot.AccessPointType;
@@ -53,6 +54,10 @@ import com.google.gson.JsonObject;
public abstract class ModelElementMarshaller
{
protected abstract EObjectUUIDMapper eObjectUUIDMapper();
+
+ protected abstract ModelManagementStrategy modelManagementStrategy();
+
+ private MBFacade facade;
/**
*
@@ -305,7 +310,7 @@ public abstract class ModelElementMarshaller
laneSymbolJson.addProperty(
ModelerConstants.PARTICIPANT_FULL_ID,
- MBFacade.getInstance().createFullId(
+ facade().createFullId(
ModelUtils.findContainingModel(processDefinition),
laneSymbol.getParticipant()));
}
@@ -460,13 +465,13 @@ public abstract class ModelElementMarshaller
if (activity.getImplementationProcess() != null)
{
activityJson.addProperty(ModelerConstants.SUBPROCESS_ID,
- MBFacade.getInstance().createFullId(ModelUtils.findContainingModel(activity),
+ facade().createFullId(ModelUtils.findContainingModel(activity),
activity.getImplementationProcess()));
}
else if (activity.getApplication() != null)
{
activityJson.addProperty(ModelerConstants.APPLICATION_FULL_ID_PROPERTY,
- MBFacade.getInstance().createFullId(ModelUtils.findContainingModel(activity),
+ facade().createFullId(ModelUtils.findContainingModel(activity),
activity.getApplication()));
}
}
@@ -752,7 +757,7 @@ public abstract class ModelElementMarshaller
if (null != containingModel)
{
dataSymbolJson.addProperty(ModelerConstants.DATA_FULL_ID_PROPERTY,
- MBFacade.getInstance().createFullId(containingModel, dataSymbol.getData()));
+ facade().createFullId(containingModel, dataSymbol.getData()));
}
return dataSymbolJson;
@@ -775,7 +780,7 @@ public abstract class ModelElementMarshaller
if (null != model)
{
- List<OrganizationType> parentOrgs = MBFacade.getInstance().getParentOrganizations(model, role);
+ List<OrganizationType> parentOrgs = facade().getParentOrganizations(model, role);
if (parentOrgs.size() > 0)
{
// TODO - add array of orgs
@@ -814,7 +819,7 @@ public abstract class ModelElementMarshaller
if (null != model)
{
- List<OrganizationType> parentOrgs = MBFacade.getInstance().getParentOrganizations(model, org);
+ List<OrganizationType> parentOrgs = facade().getParentOrganizations(model, org);
if (parentOrgs.size() > 0)
{
orgJson.addProperty(ModelerConstants.PARENT_UUID_PROPERTY,
@@ -975,7 +980,7 @@ public abstract class ModelElementMarshaller
}
}
dataFlowJson.addProperty(ModelerConstants.DATA_FULL_ID_PROPERTY,
- MBFacade.getInstance().createFullId(ModelUtils.findContainingModel(data), data));
+ facade().createFullId(ModelUtils.findContainingModel(data), data));
dataFlowJson.addProperty(ModelerConstants.ACTIVITY_ID_PROPERTY, activity.getId());
}
@@ -1293,4 +1298,13 @@ public abstract class ModelElementMarshaller
containingModel.getId());
}
}
+
+ private MBFacade facade()
+ {
+ if (facade == null)
+ {
+ facade = new MBFacade(modelManagementStrategy());
+ }
+ return facade;
+ }
}
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 f4a878e..ad5ec99 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
@@ -60,6 +60,8 @@ public abstract class ModelElementUnmarshaller
private Map<Class<? >, String[]> modelElementReferencePropertiesMap;
protected abstract ModelManagementStrategy modelManagementStrategy();
+
+ private MBFacade facade;
/**
*
@@ -240,9 +242,9 @@ public abstract class ModelElementUnmarshaller
String subprocessFullId = extractString(activityJson,
ModelerConstants.SUBPROCESS_ID);
- ProcessDefinitionType subProcessDefinition = MBFacade.getInstance()
- .getProcessDefinition(MBFacade.getInstance().getModelId(subprocessFullId),
- MBFacade.getInstance().stripFullId(subprocessFullId));
+ ProcessDefinitionType subProcessDefinition = facade()
+ .getProcessDefinition(facade().getModelId(subprocessFullId),
+ facade().stripFullId(subprocessFullId));
activity.setImplementationProcess(subProcessDefinition);
}
@@ -254,9 +256,9 @@ public abstract class ModelElementUnmarshaller
String applicationFullId = extractString(activityJson,
ModelerConstants.APPLICATION_FULL_ID_PROPERTY);
- ApplicationType application = MBFacade.getInstance().getApplication(
- MBFacade.getInstance().getModelId(applicationFullId),
- MBFacade.getInstance().stripFullId(applicationFullId));
+ ApplicationType application = facade().getApplication(
+ facade().getModelId(applicationFullId),
+ facade().stripFullId(applicationFullId));
activity.setApplication(application);
}
@@ -565,4 +567,13 @@ public abstract class ModelElementUnmarshaller
modelElementJson.addProperty(ModelerConstants.DESCRIPTION_PROPERTY, "");
}
}
+
+ private MBFacade facade()
+ {
+ if (facade == null)
+ {
+ facade = new MBFacade(modelManagementStrategy());
+ }
+ return facade;
+ }
}
diff --git a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/service/DefaultModelManagementStrategy.java b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/service/DefaultModelManagementStrategy.java
index 980dfe1..5fb0fd6 100644
--- a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/service/DefaultModelManagementStrategy.java
+++ b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/service/DefaultModelManagementStrategy.java
@@ -43,7 +43,7 @@ public class DefaultModelManagementStrategy extends
if (modelDocument.getName().endsWith(".xpdl")) {
ModelType model = XpdlModelIoUtils
- .loadModel(readModelContext(modelDocument));
+ .loadModel(readModelContext(modelDocument), this);
//TODO - This method needs to move to some place where it will be called only once for
loadEObjectUUIDMap(model);
@@ -67,7 +67,7 @@ public class DefaultModelManagementStrategy extends
if(modelDocument.getName().equals(id))
{
ModelType model = XpdlModelIoUtils
- .loadModel(readModelContext(modelDocument));
+ .loadModel(readModelContext(modelDocument), this);
loadEObjectUUIDMap(model);
return model;
}
@@ -84,7 +84,7 @@ public class DefaultModelManagementStrategy extends
public ModelType attachModel(String id) {
ModelType model = XpdlModelIoUtils
.loadModel(readModelContext(getDocumentManagementService()
- .getDocument(MODELS_DIR + id + ".xpdl")));
+ .getDocument(MODELS_DIR + id + ".xpdl")), this);
loadEObjectUUIDMap(model);
getModels().put(id, model);
diff --git a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/service/ModelService.java b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/service/ModelService.java
index e99c783..2534de3 100644
--- a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/service/ModelService.java
+++ b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/service/ModelService.java
@@ -584,8 +584,8 @@ public class ModelService
ModelType model = getModelManagementStrategy().getModels().get(modelId);
String name = extractString(postedData, NEW_OBJECT_PROPERTY,
ModelerConstants.NAME_PROPERTY);
- String id = MBFacade.getInstance().createIdFromName(name);
- ProcessDefinitionType processDefinition = MBFacade.getInstance().createProcess(
+ String id = facade().createIdFromName(name);
+ ProcessDefinitionType processDefinition = facade().createProcess(
model, name, id);
JsonObject processDefinitionJson = new JsonObject();
@@ -619,9 +619,9 @@ public class ModelService
JsonObject commandJson)
{
ModelType model = getModelManagementStrategy().getModels().get(modelId);
- ProcessDefinitionType processDefinition = MBFacade.getInstance()
+ ProcessDefinitionType processDefinition = facade()
.findProcessDefinition(model, processId);
- ActivityType activity = MBFacade.getInstance().findActivity(processDefinition,
+ ActivityType activity = facade().findActivity(processDefinition,
activityId);
EditingSession editingSession = getEditingSession(model);
@@ -867,7 +867,7 @@ public class ModelService
JsonObject modelElementJson = connectionJson
.getAsJsonObject(ModelerConstants.MODEL_ELEMENT_PROPERTY);
ModelType model = getModelManagementStrategy().getModels().get(modelId);
- ProcessDefinitionType processDefinition = MBFacade.getInstance()
+ ProcessDefinitionType processDefinition = facade()
.findProcessDefinition(model, processId);
EditingSession editSession = getEditingSession(model);
@@ -880,7 +880,7 @@ public class ModelService
if (extractString(modelElementJson, TYPE_PROPERTY).equals(CONTROL_FLOW_LITERAL))
{
- TransitionConnectionType transitionConnection = MBFacade.getInstance()
+ TransitionConnectionType transitionConnection = facade()
.findTransitionConnectionByModelOid(processDefinition, connectionOid);
transitionConnection.setSourceAnchor(mapAnchorOrientation(extractInt(
connectionJson, FROM_ANCHOR_POINT_ORIENTATION_PROPERTY)));
@@ -914,7 +914,7 @@ public class ModelService
}
else
{
- DataMappingConnectionType dataMappingConnection = MBFacade.getInstance()
+ DataMappingConnectionType dataMappingConnection = facade()
.findDataMappingConnectionByModelOid(processDefinition, connectionOid);
dataMappingConnection.setSourceAnchor(mapAnchorOrientation(extractInt(
@@ -956,7 +956,7 @@ public class ModelService
// String key = (String)iterator.next();
// JSONObject laneSymbolJson = laneSymbolsJson.getJSONObject(key);
JsonObject laneSymbolJson = laneSymbolsJson.get(n).getAsJsonObject();
- LaneSymbol laneSymbol = MBFacade.getInstance().findLaneSymbolByElementOid(
+ LaneSymbol laneSymbol = facade().findLaneSymbolByElementOid(
poolSymbol, extractLong(laneSymbolJson, OID_PROPERTY));
updateLane(model, laneSymbol, laneSymbolJson);
@@ -976,9 +976,9 @@ public class ModelService
JsonObject laneSymbolJson)
{
ModelType model = getModelManagementStrategy().getModels().get(modelId);
- ProcessDefinitionType processDefinition = MBFacade.getInstance()
+ ProcessDefinitionType processDefinition = facade()
.findProcessDefinition(model, processId);
- LaneSymbol laneSymbol = MBFacade.getInstance().findLaneSymbolById(
+ LaneSymbol laneSymbol = facade().findLaneSymbolById(
processDefinition, laneId);
EditingSession editingSession = getEditingSession(model);
@@ -1018,13 +1018,13 @@ public class ModelService
System.out.println("Participant Full ID"
+ extractString(laneSymbolJson, ModelerConstants.PARTICIPANT_FULL_ID));
System.out.println("Participant "
- + MBFacade.getInstance().findParticipant(
+ + facade().findParticipant(
model,
- MBFacade.getInstance().stripFullId(
+ facade().stripFullId(
extractString(laneSymbolJson,
ModelerConstants.PARTICIPANT_FULL_ID))));
- String participantModelID = MBFacade.getInstance().getModelId(
+ String participantModelID = facade().getModelId(
extractString(laneSymbolJson, ModelerConstants.PARTICIPANT_FULL_ID));
if (StringUtils.isEmpty(participantModelID))
{
@@ -1038,10 +1038,10 @@ public class ModelService
participantModelID);
}
- IModelParticipant modelParticipant = MBFacade.getInstance()
+ IModelParticipant modelParticipant = facade()
.findParticipant(
getModelManagementStrategy().getModels().get(participantModelID),
- MBFacade.getInstance().stripFullId(
+ facade().stripFullId(
extractString(laneSymbolJson,
ModelerConstants.PARTICIPANT_FULL_ID)));
@@ -1069,7 +1069,7 @@ public class ModelService
{
JsonObject activitySymbolJson = entry.getValue().getAsJsonObject();
- ActivitySymbolType activitySymbol = MBFacade.getInstance().findActivitySymbol(
+ ActivitySymbolType activitySymbol = facade().findActivitySymbol(
laneSymbol, extractLong(activitySymbolJson, OID_PROPERTY));
// updateActivity(activitySymbol, laneSymbol, activitySymbolJson);
@@ -1081,7 +1081,7 @@ public class ModelService
{
JsonObject gatewaySymbolJson = entry.getValue().getAsJsonObject();
- ActivitySymbolType gatewaySymbol = MBFacade.getInstance().findActivitySymbol(
+ ActivitySymbolType gatewaySymbol = facade().findActivitySymbol(
laneSymbol, extractLong(gatewaySymbolJson, OID_PROPERTY));
updateGateway(gatewaySymbol, laneSymbol, gatewaySymbolJson);
@@ -1092,12 +1092,12 @@ public class ModelService
{
JsonObject eventSymbolJson = entry.getValue().getAsJsonObject();
- AbstractEventSymbol eventSymbol = MBFacade.getInstance().findStartEventSymbol(
+ AbstractEventSymbol eventSymbol = facade().findStartEventSymbol(
laneSymbol, extractLong(eventSymbolJson, OID_PROPERTY));
if (eventSymbol == null)
{
- eventSymbol = MBFacade.getInstance().findEndEventSymbol(laneSymbol,
+ eventSymbol = facade().findEndEventSymbol(laneSymbol,
extractLong(eventSymbolJson, OID_PROPERTY));
}
@@ -1109,7 +1109,7 @@ public class ModelService
{
JsonObject dataSymbolJson = entry.getValue().getAsJsonObject();
- DataSymbolType dataSymbol = MBFacade.getInstance().findDataSymbolRecursively(
+ DataSymbolType dataSymbol = facade().findDataSymbolRecursively(
laneSymbol, extractLong(dataSymbolJson, OID_PROPERTY));
// updateData(dataSymbol, dataSymbolJson);
@@ -1133,7 +1133,7 @@ public class ModelService
getModelManagementStrategy().attachModel(modelId);
}
- ProcessDefinitionType processDefinition = MBFacade.getInstance()
+ ProcessDefinitionType processDefinition = facade()
.findProcessDefinition(model, processId);
return modelElementMarshaller().toProcessDefinitionDiagram(processDefinition)
@@ -1147,7 +1147,7 @@ public class ModelService
JsonObject diagramJson)
{
ModelType model = getModelManagementStrategy().getModels().get(modelId);
- ProcessDefinitionType processDefinition = MBFacade.getInstance()
+ ProcessDefinitionType processDefinition = facade()
.findProcessDefinition(model, processId);
DiagramType diagram = processDefinition.getDiagram().get(0);
EditingSession editSession = getEditingSession(model);
@@ -1160,7 +1160,7 @@ public class ModelService
{
JsonObject poolSymbolJson = entry.getValue().getAsJsonObject();
- PoolSymbol poolSymbol = MBFacade.getInstance().findPoolSymbolByElementOid(
+ PoolSymbol poolSymbol = facade().findPoolSymbolByElementOid(
processDefinition, extractLong(poolSymbolJson, OID_PROPERTY));
updatePool(model, poolSymbol, poolSymbolJson);
@@ -1412,7 +1412,7 @@ public class ModelService
*/
private boolean hasParentParticipant(ModelType model, IModelParticipant participant)
{
- List<OrganizationType> parentOrgs = MBFacade.getInstance().getParentOrganizations(
+ List<OrganizationType> parentOrgs = facade().getParentOrganizations(
model, participant);
if (parentOrgs.size() > 0)
{
@@ -1513,7 +1513,7 @@ public class ModelService
JsonObject dataSymbolJson)
{
ModelType model = getModelManagementStrategy().getModels().get(modelId);
- ProcessDefinitionType processDefinition = MBFacade.getInstance()
+ ProcessDefinitionType processDefinition = facade()
.findProcessDefinition(model, processId);
EditingSession editSession = getEditingSession(model);
@@ -1543,10 +1543,10 @@ public class ModelService
JsonObject wizardParameterJson = (JsonObject) json.get(NEW_OBJECT_PROPERTY);
JsonObject processDefinitionJson = (JsonObject) createProcessJson(modelId, json);
- ProcessDefinitionType processDefinition = MBFacade.getInstance()
+ ProcessDefinitionType processDefinition = facade()
.findProcessDefinition(model,
extractString(json, NEW_OBJECT_PROPERTY, ModelerConstants.ID_PROPERTY));
- LaneSymbol parentLaneSymbol = MBFacade.getInstance().findLaneInProcess(
+ LaneSymbol parentLaneSymbol = facade().findLaneInProcess(
processDefinition, ModelerConstants.DEF_LANE_ID);
// Create Start Event
@@ -1573,12 +1573,12 @@ public class ModelService
DataType data = newStructVariable(model)
.withIdAndName(
- MBFacade.getInstance().createIdFromName(
+ facade().createIdFromName(
extractString(wizardParameterJson,
"requestParameterDataNameInput")),
extractString(wizardParameterJson, "requestParameterDataNameInput"))
.ofType(
- /* Dummy */MBFacade.getInstance().stripFullId(
+ /* Dummy */facade().stripFullId(
extractString(wizardParameterJson,
"serviceRequestParameterTypeId"))).build();
@@ -1599,12 +1599,12 @@ public class ModelService
ActivityType activity = newApplicationActivity(processDefinition)
.withIdAndName(
- MBFacade.getInstance().createIdFromName(
+ facade().createIdFromName(
extractString(wizardParameterJson,
"requestTransformationActivityName")),
extractString(wizardParameterJson, "requestTransformationActivityName"))
.invokingApplication(
- MBFacade.getInstance().getApplication(modelId,
+ facade().getApplication(modelId,
extractString(wizardParameterJson, "applicationId"))).build();
// setDescription(activity,
@@ -1628,10 +1628,10 @@ public class ModelService
// Request data
data = newStructVariable(model)
- .withIdAndName(MBFacade.getInstance().createIdFromName("Service Request"),
+ .withIdAndName(facade().createIdFromName("Service Request"),
"Service Request")
.ofType(
- MBFacade.getInstance().stripFullId(
+ facade().stripFullId(
extractString(wizardParameterJson,
"serviceRequestParameterTypeId"))).build();
@@ -1652,12 +1652,12 @@ public class ModelService
activity = newApplicationActivity(processDefinition)
.withIdAndName(
- MBFacade.getInstance().createIdFromName(
+ facade().createIdFromName(
extractString(wizardParameterJson,
"serviceInvocationActivityName")),
extractString(wizardParameterJson, "serviceInvocationActivityName"))
.invokingApplication(
- MBFacade.getInstance().getApplication(modelId,
+ facade().getApplication(modelId,
extractString(wizardParameterJson, "applicationId"))).build();
// setDescription(activity,
@@ -1680,10 +1680,10 @@ public class ModelService
// Response data
data = newStructVariable(model)
- .withIdAndName(MBFacade.getInstance().createIdFromName("Service Response"),
+ .withIdAndName(facade().createIdFromName("Service Response"),
"Service Response")
.ofType(
- MBFacade.getInstance().stripFullId(
+ facade().stripFullId(
extractString(wizardParameterJson,
"serviceResponseParameterTypeId"))).build();
@@ -1704,12 +1704,12 @@ public class ModelService
activity = newApplicationActivity(processDefinition)
.withIdAndName(
- MBFacade.getInstance().createIdFromName(
+ facade().createIdFromName(
extractString(wizardParameterJson,
"responseTransformationActivityName")),
extractString(wizardParameterJson, "responseTransformationActivityName"))
.invokingApplication(
- MBFacade.getInstance().getApplication(modelId,
+ facade().getApplication(modelId,
extractString(wizardParameterJson, "applicationId"))).build();
// setDescription(activity,
@@ -1741,12 +1741,12 @@ public class ModelService
data = newStructVariable(model)
.withIdAndName(
- MBFacade.getInstance().createIdFromName(
+ facade().createIdFromName(
extractString(wizardParameterJson,
"responseParameterDataNameInput")),
extractString(wizardParameterJson, "responseParameterDataNameInput"))
.ofType(
- /* Dummy */MBFacade.getInstance().stripFullId(
+ /* Dummy */facade().stripFullId(
extractString(wizardParameterJson,
"serviceResponseParameterTypeId"))).build();
@@ -1929,7 +1929,7 @@ public class ModelService
public ProcessDefinitionType findProcessDefinition(ModelType model, String id)
{
- return MBFacade.getInstance().findProcessDefinition(model, id);
+ return facade().findProcessDefinition(model, id);
}
public ModelType findModel(String modelId)
@@ -2106,4 +2106,9 @@ public class ModelService
return json;
}
+
+ private MBFacade facade()
+ {
+ return new MBFacade(getModelManagementStrategy());
+ }
} \ No newline at end of file
diff --git a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/service/TestModelManagementStrategy.java b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/service/TestModelManagementStrategy.java
index 44ca7d7..72deb22 100644
--- a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/service/TestModelManagementStrategy.java
+++ b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/service/TestModelManagementStrategy.java
@@ -73,7 +73,7 @@ public class TestModelManagementStrategy extends
if (modelDocument.getName().endsWith(".xpdl")) {
ModelType model = XpdlModelIoUtils
- .loadModel(readModelContext(modelDocument));
+ .loadModel(readModelContext(modelDocument), this);
getModels().put(model.getId(), model);