summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Pielmann2012-09-13 10:35:41 (EDT)
committer Stephan Born2012-09-13 10:35:41 (EDT)
commit6b33187769fe4949127edb946b27c405f9200a8b (patch)
tree07439c9d465030ad0547604809e18f3f28746f21
parent41c89d33918011fd65e37d0e1d764f75ca70aa52 (diff)
downloadorg.eclipse.stardust.ide-6b33187769fe4949127edb946b27c405f9200a8b.zip
org.eclipse.stardust.ide-6b33187769fe4949127edb946b27c405f9200a8b.tar.gz
org.eclipse.stardust.ide-6b33187769fe4949127edb946b27c405f9200a8b.tar.bz2
CRNT-26125, CRNT-26126
git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/ide@59180 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
-rw-r--r--model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/BpmModelBuilder.java96
-rw-r--r--model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/utils/ModelBuilderFacade.java197
-rw-r--r--model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/variable/AbstractApplicationAccessPointBuilder.java68
-rw-r--r--model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/variable/ExternalWebApplicationApplicationBuilder.java67
-rw-r--r--model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/variable/MessageTransformationApplicationBuilder.java71
-rw-r--r--model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/variable/PrimitiveAccessPointBuilder.java165
-rw-r--r--model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/variable/StructAccessPointBuilder.java189
-rw-r--r--model/org.eclipse.stardust.model.xpdl.builder/src/test/java/org/eclipse/stardust/model/xpdl/builder/CrossModelSupportModelBuilderTest.java21
8 files changed, 673 insertions, 201 deletions
diff --git a/model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/BpmModelBuilder.java b/model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/BpmModelBuilder.java
index e88c325..7c6b125 100644
--- a/model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/BpmModelBuilder.java
+++ b/model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/BpmModelBuilder.java
@@ -10,40 +10,45 @@
*******************************************************************************/
package org.eclipse.stardust.model.xpdl.builder;
-import org.eclipse.emf.common.util.TreeIterator;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.stardust.model.xpdl.builder.activity.AbstractActivityBuilder;
-import org.eclipse.stardust.model.xpdl.builder.activity.BpmApplicationActivityBuilder;
-import org.eclipse.stardust.model.xpdl.builder.activity.BpmInteractiveApplicationActivityBuilder;
-import org.eclipse.stardust.model.xpdl.builder.activity.BpmManualActivityBuilder;
-import org.eclipse.stardust.model.xpdl.builder.activity.BpmRouteActivityBuilder;
-import org.eclipse.stardust.model.xpdl.builder.activity.BpmSubProcessActivityBuilder;
-import org.eclipse.stardust.model.xpdl.builder.datamapping.BpmDataMappingBuilder;
-import org.eclipse.stardust.model.xpdl.builder.datamapping.BpmInDataMappingBuilder;
-import org.eclipse.stardust.model.xpdl.builder.datamapping.BpmOutDataMappingBuilder;
-import org.eclipse.stardust.model.xpdl.builder.diagram.BpmDiagramBuilder;
-import org.eclipse.stardust.model.xpdl.builder.eventaction.BpmExcludeUserEventActionBuilder;
-import org.eclipse.stardust.model.xpdl.builder.eventhandler.BpmActivityAssignmentEventHandlerBuilder;
-import org.eclipse.stardust.model.xpdl.builder.model.BpmPackageBuilder;
-import org.eclipse.stardust.model.xpdl.builder.participant.BpmConditionalPerformerBuilder;
-import org.eclipse.stardust.model.xpdl.builder.participant.BpmOrganizationBuilder;
-import org.eclipse.stardust.model.xpdl.builder.participant.BpmRoleBuilder;
-import org.eclipse.stardust.model.xpdl.builder.process.BpmDataPathBuilder;
-import org.eclipse.stardust.model.xpdl.builder.process.BpmManualTriggerBuilder;
-import org.eclipse.stardust.model.xpdl.builder.process.BpmProcessDefinitionBuilder;
-import org.eclipse.stardust.model.xpdl.builder.transition.AbstractTransitionBuilder;
-import org.eclipse.stardust.model.xpdl.builder.transition.BpmActivitySequenceBuilder;
-import org.eclipse.stardust.model.xpdl.builder.transition.BpmConditionalTransitionBuilder;
-import org.eclipse.stardust.model.xpdl.builder.transition.BpmOtherwiseTransitionBuilder;
-import org.eclipse.stardust.model.xpdl.builder.utils.XpdlModelUtils;
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.stardust.model.xpdl.builder.activity.AbstractActivityBuilder;
+import org.eclipse.stardust.model.xpdl.builder.activity.BpmApplicationActivityBuilder;
+import org.eclipse.stardust.model.xpdl.builder.activity.BpmInteractiveApplicationActivityBuilder;
+import org.eclipse.stardust.model.xpdl.builder.activity.BpmManualActivityBuilder;
+import org.eclipse.stardust.model.xpdl.builder.activity.BpmRouteActivityBuilder;
+import org.eclipse.stardust.model.xpdl.builder.activity.BpmSubProcessActivityBuilder;
+import org.eclipse.stardust.model.xpdl.builder.datamapping.BpmDataMappingBuilder;
+import org.eclipse.stardust.model.xpdl.builder.datamapping.BpmInDataMappingBuilder;
+import org.eclipse.stardust.model.xpdl.builder.datamapping.BpmOutDataMappingBuilder;
+import org.eclipse.stardust.model.xpdl.builder.diagram.BpmDiagramBuilder;
+import org.eclipse.stardust.model.xpdl.builder.eventaction.BpmExcludeUserEventActionBuilder;
+import org.eclipse.stardust.model.xpdl.builder.eventhandler.BpmActivityAssignmentEventHandlerBuilder;
+import org.eclipse.stardust.model.xpdl.builder.model.BpmPackageBuilder;
+import org.eclipse.stardust.model.xpdl.builder.participant.BpmConditionalPerformerBuilder;
+import org.eclipse.stardust.model.xpdl.builder.participant.BpmOrganizationBuilder;
+import org.eclipse.stardust.model.xpdl.builder.participant.BpmRoleBuilder;
+import org.eclipse.stardust.model.xpdl.builder.process.BpmDataPathBuilder;
+import org.eclipse.stardust.model.xpdl.builder.process.BpmManualTriggerBuilder;
+import org.eclipse.stardust.model.xpdl.builder.process.BpmProcessDefinitionBuilder;
+import org.eclipse.stardust.model.xpdl.builder.transition.AbstractTransitionBuilder;
+import org.eclipse.stardust.model.xpdl.builder.transition.BpmActivitySequenceBuilder;
+import org.eclipse.stardust.model.xpdl.builder.transition.BpmConditionalTransitionBuilder;
+import org.eclipse.stardust.model.xpdl.builder.transition.BpmOtherwiseTransitionBuilder;
+import org.eclipse.stardust.model.xpdl.builder.utils.XpdlModelUtils;
import org.eclipse.stardust.model.xpdl.builder.variable.BpmDocumentVariableBuilder;
-import org.eclipse.stardust.model.xpdl.builder.variable.BpmPrimitiveVariableBuilder;
-import org.eclipse.stardust.model.xpdl.builder.variable.BpmStructVariableBuilder;
-import org.eclipse.stardust.model.xpdl.carnot.ActivityType;
-import org.eclipse.stardust.model.xpdl.carnot.EventHandlerType;
-import org.eclipse.stardust.model.xpdl.carnot.IModelElement;
-import org.eclipse.stardust.model.xpdl.carnot.ModelType;
-import org.eclipse.stardust.model.xpdl.carnot.ProcessDefinitionType;
+import org.eclipse.stardust.model.xpdl.builder.variable.BpmPrimitiveVariableBuilder;
+import org.eclipse.stardust.model.xpdl.builder.variable.BpmStructVariableBuilder;
+import org.eclipse.stardust.model.xpdl.builder.variable.ExternalWebApplicationApplicationBuilder;
+import org.eclipse.stardust.model.xpdl.builder.variable.MessageTransformationApplicationBuilder;
+import org.eclipse.stardust.model.xpdl.builder.variable.PrimitiveAccessPointBuilder;
+import org.eclipse.stardust.model.xpdl.builder.variable.StructAccessPointBuilder;
+import org.eclipse.stardust.model.xpdl.carnot.ActivityType;
+import org.eclipse.stardust.model.xpdl.carnot.EventHandlerType;
+import org.eclipse.stardust.model.xpdl.carnot.IAccessPointOwner;
+import org.eclipse.stardust.model.xpdl.carnot.IModelElement;
+import org.eclipse.stardust.model.xpdl.carnot.ModelType;
+import org.eclipse.stardust.model.xpdl.carnot.ProcessDefinitionType;
@@ -73,7 +78,28 @@ public abstract class BpmModelBuilder
{
return BpmPackageBuilder.newModel();
}
-
+
+
+ public static PrimitiveAccessPointBuilder newPrimitiveAccessPoint(IAccessPointOwner anOwner)
+ {
+ return PrimitiveAccessPointBuilder.newAccessPoint(anOwner);
+ }
+
+ public static StructAccessPointBuilder newStructuredAccessPoint(IAccessPointOwner anOwner)
+ {
+ return StructAccessPointBuilder.newAccessPoint(anOwner);
+ }
+
+ public static MessageTransformationApplicationBuilder newMessageTransformationApplication(ModelType model)
+ {
+ return MessageTransformationApplicationBuilder.newMessageTransformationApplication(model);
+ }
+
+ public static ExternalWebApplicationApplicationBuilder newExternalWebApplication(ModelType model)
+ {
+ return ExternalWebApplicationApplicationBuilder.newExternalWebApplication(model);
+ }
+
public static BpmPrimitiveVariableBuilder<Object> newPrimitiveVariable()
{
return BpmPrimitiveVariableBuilder.newPrimitiveVariable();
@@ -93,7 +119,7 @@ public abstract class BpmModelBuilder
{
return BpmDocumentVariableBuilder.newDocumentVariable(model);
}
-
+
public static BpmRoleBuilder newRole(ModelType model)
{
return BpmRoleBuilder.newRole(model);
diff --git a/model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/utils/ModelBuilderFacade.java b/model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/utils/ModelBuilderFacade.java
index 652cd98..dbdc88a 100644
--- a/model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/utils/ModelBuilderFacade.java
+++ b/model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/utils/ModelBuilderFacade.java
@@ -14,14 +14,18 @@ import static org.eclipse.stardust.engine.api.model.PredefinedConstants.ADMINIST
import static org.eclipse.stardust.model.xpdl.builder.BpmModelBuilder.newApplicationActivity;
import static org.eclipse.stardust.model.xpdl.builder.BpmModelBuilder.newConditionalPerformer;
import static org.eclipse.stardust.model.xpdl.builder.BpmModelBuilder.newDocumentVariable;
+import static org.eclipse.stardust.model.xpdl.builder.BpmModelBuilder.newExternalWebApplication;
import static org.eclipse.stardust.model.xpdl.builder.BpmModelBuilder.newManualActivity;
import static org.eclipse.stardust.model.xpdl.builder.BpmModelBuilder.newManualTrigger;
+import static org.eclipse.stardust.model.xpdl.builder.BpmModelBuilder.newMessageTransformationApplication;
import static org.eclipse.stardust.model.xpdl.builder.BpmModelBuilder.newOrganization;
+import static org.eclipse.stardust.model.xpdl.builder.BpmModelBuilder.newPrimitiveAccessPoint;
import static org.eclipse.stardust.model.xpdl.builder.BpmModelBuilder.newPrimitiveVariable;
import static org.eclipse.stardust.model.xpdl.builder.BpmModelBuilder.newProcessDefinition;
import static org.eclipse.stardust.model.xpdl.builder.BpmModelBuilder.newRole;
import static org.eclipse.stardust.model.xpdl.builder.BpmModelBuilder.newRouteActivity;
import static org.eclipse.stardust.model.xpdl.builder.BpmModelBuilder.newStructVariable;
+import static org.eclipse.stardust.model.xpdl.builder.BpmModelBuilder.newStructuredAccessPoint;
import static org.eclipse.stardust.model.xpdl.builder.BpmModelBuilder.newSubProcessActivity;
import java.util.ArrayList;
@@ -37,13 +41,7 @@ import org.eclipse.stardust.common.StringUtils;
import org.eclipse.stardust.common.error.ObjectNotFoundException;
import org.eclipse.stardust.engine.api.model.PredefinedConstants;
import org.eclipse.stardust.engine.core.pojo.data.Type;
-import org.eclipse.stardust.engine.core.struct.IXPathMap;
import org.eclipse.stardust.engine.core.struct.StructuredDataConstants;
-import org.eclipse.stardust.engine.core.struct.TypedXPath;
-import org.eclipse.stardust.engine.extensions.transformation.model.MappingModelUtil;
-import org.eclipse.stardust.engine.extensions.transformation.model.mapping.MappingFactory;
-import org.eclipse.stardust.engine.extensions.transformation.model.mapping.TransformationProperty;
-import org.eclipse.stardust.model.xpdl.builder.accesspoints.StructAccessPointType;
import org.eclipse.stardust.model.xpdl.builder.activity.BpmApplicationActivityBuilder;
import org.eclipse.stardust.model.xpdl.builder.activity.BpmSubProcessActivityBuilder;
import org.eclipse.stardust.model.xpdl.builder.common.AbstractElementBuilder;
@@ -70,11 +68,9 @@ import org.eclipse.stardust.model.xpdl.carnot.DataType;
import org.eclipse.stardust.model.xpdl.carnot.DataTypeType;
import org.eclipse.stardust.model.xpdl.carnot.DiagramModeType;
import org.eclipse.stardust.model.xpdl.carnot.DiagramType;
-import org.eclipse.stardust.model.xpdl.carnot.DirectionType;
import org.eclipse.stardust.model.xpdl.carnot.EndEventSymbol;
import org.eclipse.stardust.model.xpdl.carnot.IAccessPointOwner;
import org.eclipse.stardust.model.xpdl.carnot.IIdentifiableModelElement;
-import org.eclipse.stardust.model.xpdl.carnot.IModelElement;
import org.eclipse.stardust.model.xpdl.carnot.IModelParticipant;
import org.eclipse.stardust.model.xpdl.carnot.IdRef;
import org.eclipse.stardust.model.xpdl.carnot.LaneSymbol;
@@ -89,14 +85,11 @@ import org.eclipse.stardust.model.xpdl.carnot.StartEventSymbol;
import org.eclipse.stardust.model.xpdl.carnot.TransitionConnectionType;
import org.eclipse.stardust.model.xpdl.carnot.extensions.ExtensionsFactory;
import org.eclipse.stardust.model.xpdl.carnot.extensions.FormalParameterMappingsType;
-import org.eclipse.stardust.model.xpdl.carnot.impl.AccessPointTypeImpl;
import org.eclipse.stardust.model.xpdl.carnot.merge.MergeUtils;
import org.eclipse.stardust.model.xpdl.carnot.spi.IDataInitializer;
-import org.eclipse.stardust.model.xpdl.carnot.util.AccessPointUtil;
import org.eclipse.stardust.model.xpdl.carnot.util.AttributeUtil;
import org.eclipse.stardust.model.xpdl.carnot.util.CarnotConstants;
import org.eclipse.stardust.model.xpdl.carnot.util.ModelUtils;
-import org.eclipse.stardust.model.xpdl.carnot.util.StructuredTypeUtils;
import org.eclipse.stardust.model.xpdl.util.IConnectionManager;
import org.eclipse.stardust.model.xpdl.xpdl2.BasicTypeType;
import org.eclipse.stardust.model.xpdl.xpdl2.DeclaredTypeType;
@@ -256,7 +249,7 @@ public class ModelBuilderFacade
return structuredDataType;
}
- public void createPrimitiveParameter(ProcessDefinitionType processInterface,
+ public FormalParameterType createPrimitiveParameter(ProcessDefinitionType processInterface,
DataType data, String id, String name, String primitiveTypeID, ModeType mode)
{
XpdlFactory xpdlFactory = XpdlPackage.eINSTANCE.getXpdlFactory();
@@ -295,9 +288,10 @@ public class ModelBuilderFacade
parameterMappingsType.setMappedData(parameterType, data);
processInterface.setFormalParameterMappings(parameterMappingsType);
+ return parameterType;
}
- public void createStructuredParameter(ProcessDefinitionType processInterface,
+ public FormalParameterType createStructuredParameter(ProcessDefinitionType processInterface,
DataType data, String id, String name, String structTypeFullID, ModeType mode)
{
XpdlFactory xpdlFactory = XpdlPackage.eINSTANCE.getXpdlFactory();
@@ -342,6 +336,20 @@ public class ModelBuilderFacade
parameterMappingsType.setMappedData(parameterType, data);
processInterface.setFormalParameterMappings(parameterMappingsType);
+
+ return parameterType;
+ }
+
+ public AccessPointType createPrimitiveAccessPoint(IAccessPointOwner application, String id,
+ String name, String primaryDataTypeID, String direction)
+ {
+ return newPrimitiveAccessPoint(application).withIdAndName(id, name).withType(primaryDataTypeID).withDirection(direction).build();
+ }
+
+ public AccessPointType createStructuredAccessPoint(IAccessPointOwner application, String id,
+ String name, String structTypeFullID, String direction)
+ {
+ return newStructuredAccessPoint(application).withIdAndName(id, name).withType(structTypeFullID).withDirection(direction).build();
}
public void setProcessImplementation(ProcessDefinitionType processInterface,
@@ -402,7 +410,7 @@ public class ModelBuilderFacade
DataType data;
ModelType typeDeclarationModel = null;
String sourceModelID = null;
-
+
BpmDocumentVariableBuilder documentVariable = newDocumentVariable(model);
if (!StringUtils.isEmpty(typeDeclarationID))
{
@@ -411,11 +419,11 @@ public class ModelBuilderFacade
{
typeDeclarationModel = getModelManagementStrategy().getModels().get(
sourceModelID);
- }
-
-
+ }
+
+
typeDeclarationID = stripFullId(typeDeclarationID);
- documentVariable.setTypeDeclarationModel(typeDeclarationModel);
+ documentVariable.setTypeDeclarationModel(typeDeclarationModel);
documentVariable.setTypeDeclaration(typeDeclarationID);
}
@@ -910,59 +918,21 @@ public class ModelBuilderFacade
public ApplicationType createApplication(ModelType model, String applicationID,
String applicationName, String applicationTypeID)
{
- ApplicationType application = AbstractElementBuilder.F_CWM.createApplicationType();
- ApplicationTypeType applicationTypeType = null;
- try
+ if (applicationTypeID
+ .equalsIgnoreCase(ModelerConstants.MESSAGE_TRANSFORMATION_APPLICATION_TYPE_ID))
{
- applicationTypeType = findApplicationTypeType(model, applicationTypeID);
+ return newMessageTransformationApplication(model).withIdAndName(applicationID,
+ applicationName).build();
+
}
- catch (Throwable t)
+ if (applicationTypeID
+ .equalsIgnoreCase(ModelerConstants.EXTERNAL_WEB_APP_CONTEXT_TYPE_KEY))
{
- if (applicationTypeID
- .equalsIgnoreCase(ModelerConstants.MESSAGE_TRANSFORMATION_APPLICATION_TYPE_ID))
- {
- applicationTypeType = AbstractElementBuilder.F_CWM
- .createApplicationTypeType();
- applicationTypeType.setId(applicationTypeID);
- applicationTypeType.setName("Message Transformation Bean");
- applicationTypeType.setIsPredefined(true);
- long maxElementOid = XpdlModelUtils.getMaxUsedOid(model);
- applicationTypeType.setElementOid(++maxElementOid);
- model.getApplicationType().add(applicationTypeType);
- }
- if (applicationTypeID
- .equalsIgnoreCase(ModelerConstants.EXTERNAL_WEB_APP_CONTEXT_TYPE_KEY))
- {
- application.setInteractive(true);
- CarnotWorkflowModelFactory factory = CarnotWorkflowModelFactory.eINSTANCE;
- ContextType context = factory.createContextType();
-
- ApplicationContextTypeType contextTypeType = null;
- try
- {
- contextTypeType = findApplicationContextTypeType(model,
- ModelerConstants.EXTERNAL_WEB_APP_CONTEXT_TYPE_KEY);
- }
- catch (Throwable e)
- {
- contextTypeType = AbstractElementBuilder.F_CWM
- .createApplicationContextTypeType();
- contextTypeType.setName("External Web Application");
- contextTypeType.setId("externalWebApp");
- contextTypeType.setIsPredefined(true);
- long maxElementOid = XpdlModelUtils.getMaxUsedOid(model);
- contextTypeType.setElementOid(++maxElementOid);
- model.getApplicationContextType().add(contextTypeType);
- }
- context.setType(contextTypeType); // TODO Add this context type to the model
- application.getContext().add(context);
- }
+ return newExternalWebApplication(model).withIdAndName(applicationID,
+ applicationName).build();
}
- application.setType(applicationTypeType);
- application.setName(applicationName);
- application.setId(applicationID);
- model.getApplication().add(application);
- return application;
+
+ return null;
}
/**
@@ -2169,37 +2139,7 @@ public class ModelBuilderFacade
}
-
- public AccessPointType createPrimitiveAccessPoint(ApplicationType application, String id,
- String name, String primaryDataTypeID, String direction)
- {
- ModelType model = ModelUtils.findContainingModel(application);
- AccessPointType accessPoint = null;
- DataTypeType dataTypeType = findDataType(model, PredefinedConstants.PRIMITIVE_DATA);
- DirectionType directionType;
- if (direction.equals(DirectionType.IN_LITERAL.getName())) {
- directionType = DirectionType.IN_LITERAL;
- } else {
- directionType = DirectionType.OUT_LITERAL;
- }
- if (application.isInteractive()) {
- accessPoint = AccessPointUtil.createAccessPoint(id, name, directionType, dataTypeType);
- long maxElementOid = XpdlModelUtils.getMaxUsedOid(model);
- accessPoint.setElementOid(++maxElementOid);
- ContextType contextType = getApplicationContext(application, ModelerConstants.EXTERNAL_WEB_APP_CONTEXT_TYPE_KEY);
- contextType.getAccessPoint().add(accessPoint);
- AttributeUtil.setAttribute(accessPoint, PredefinedConstants.TYPE_ATT, "ag.carnot.workflow.spi.providers.data.java.Type", primaryDataTypeID); //$NON-NLS-1$
- AttributeUtil.setAttribute(accessPoint, "RootElement", id);
- TransformationProperty property = MappingFactory.eINSTANCE.createTransformationProperty();
- String xmlString = MappingModelUtil.transformEcore2XML(property);
- AttributeUtil.setAttribute(contextType, "messageTransformation:TransformationProperty", xmlString);
- }
-
- return accessPoint;
-
- }
-
- private ContextType getApplicationContext(ApplicationType application,
+ public ContextType getApplicationContext(ApplicationType application,
String contextTypeKey)
{
for (Iterator<ContextType> i = application.getContext().iterator(); i.hasNext();)
@@ -2213,41 +2153,6 @@ public class ModelBuilderFacade
return null;
}
- /*public StructAccessPointType createStructAccessPoint(String id, String name,
- DirectionType direction, DataTypeType type, TypedXPath typedXPath, IXPathMap xPathMap)
- {
- StructAccessPointType result = new StructAccessPointType(typedXPath, xPathMap);
- result.setId(id);
- result.setName(name);
- result.setType(type);
- result.setDirection(direction);
- return result;
- }
-
- public AccessPointType createPrimitiveAccessPoint(IModelElement modelElement, IIdentifiableModelElement declaringType,
- String messageName, DirectionType direction)
- {
- Class<?> clazz = null;
- String type = AttributeUtil.getAttributeValue(declaringType, PredefinedConstants.TYPE_ATT);
- if (declaringType instanceof DataTypeType)
- {
- type = messageName;
- }
- clazz = getClassForType(type);
- AccessPointType accessPoint = createPrimitiveAccessPointType(messageName, clazz, direction, modelElement);
- AttributeUtil.setAttribute(accessPoint, PredefinedConstants.TYPE_ATT, "ag.carnot.workflow.spi.providers.data.java.Type", type); //$NON-NLS-1$
- return accessPoint;
- }
-
- public static AccessPointType createPrimitiveAccessPointType(String id, Class<?> clazz, DirectionType direction, IModelElement element)
- {
- DataTypeType serializable = ModelUtils.getDataType(element, CarnotConstants.PRIMITIVE_DATA_ID);
- AccessPointType ap = AccessPointUtil.createAccessPoint(id, id, direction,
- serializable);
- AttributeUtil.setAttribute(ap, PredefinedConstants.TYPE_ATT, clazz.getName());
- return ap;
- }*/
-
public Class<?> getClassForType(String type)
{
if (type.equalsIgnoreCase("long")) { //$NON-NLS-1$
@@ -2283,30 +2188,6 @@ public class ModelBuilderFacade
return String.class;
}
- /*public AccessPointType createStructAccessPoint(IModelElement modelElement, EObject declaringType,
- String messageName, DirectionType direction)
- {
- TypeDeclarationType typeDeclaration = declaringType instanceof TypeDeclarationType
- ? (TypeDeclarationType) declaringType
- : StructuredTypeUtils.getStructuredAccessPointTypeDeclaration((StructAccessPointType) declaringType);
- IXPathMap xPathMap = StructuredTypeUtils.getXPathMap(typeDeclaration);
- DataTypeType structDataType = ModelUtils.getDataType(modelElement, StructuredDataConstants.STRUCTURED_DATA);
-
- AccessPointType accessPoint = createStructAccessPoint(messageName, messageName + " (" //$NON-NLS-1$
- + typeDeclaration.getId() + ")", //$NON-NLS-1$
- direction, structDataType, xPathMap.getRootXPath(), xPathMap);
-
-
- // (fh) Workaround to ensure that the access point has a parent
- // before setting the reference to the type declaration.
- ((AccessPointTypeImpl) accessPoint).setFakeContainer((IAccessPointOwner) modelElement);
- StructuredTypeUtils.setStructuredAccessPointAttributes(accessPoint, typeDeclaration);
- ((AccessPointTypeImpl) accessPoint).setFakeContainer(null);
- String path = AttributeUtil.getAttribute(accessPoint, "carnot:engine:dataType").getValue(); //$NON-NLS-1$
- accessPoint.setName(parseName(path));
- return accessPoint;
- }
-
private String parseName(String path)
{
if (path.startsWith("typeDeclaration:")) //$NON-NLS-1$
@@ -2316,7 +2197,7 @@ public class ModelBuilderFacade
path = path.replace("}", " / "); //$NON-NLS-1$ //$NON-NLS-2$
}
return path;
- }*/
+ }
diff --git a/model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/variable/AbstractApplicationAccessPointBuilder.java b/model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/variable/AbstractApplicationAccessPointBuilder.java
new file mode 100644
index 0000000..4259b3b
--- /dev/null
+++ b/model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/variable/AbstractApplicationAccessPointBuilder.java
@@ -0,0 +1,68 @@
+/*
+ * $Id$
+ * (C) 2000 - 2012 CARNOT AG
+ */
+package org.eclipse.stardust.model.xpdl.builder.variable;
+
+import org.eclipse.stardust.model.xpdl.builder.common.AbstractIdentifiableElementBuilder;
+import org.eclipse.stardust.model.xpdl.carnot.AccessPointType;
+import org.eclipse.stardust.model.xpdl.carnot.ApplicationType;
+import org.eclipse.stardust.model.xpdl.carnot.DataTypeType;
+import org.eclipse.stardust.model.xpdl.carnot.DirectionType;
+import org.eclipse.stardust.model.xpdl.carnot.IIdentifiableModelElement;
+import org.eclipse.stardust.model.xpdl.carnot.ITypedElement;
+
+public class AbstractApplicationAccessPointBuilder <T extends AccessPointType, B extends AbstractApplicationAccessPointBuilder<T, B>>
+extends AbstractIdentifiableElementBuilder<T, B>
+{
+ private ApplicationType application;
+
+ public AbstractApplicationAccessPointBuilder(T element)
+ {
+ super(element);
+ }
+
+ @Override
+ protected String deriveDefaultElementId()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ protected B inApplication (ApplicationType application) {
+ setApplication(application);
+ return self();
+ }
+
+ protected void setApplication(ApplicationType application)
+ {
+ if (null == this.application)
+ {
+ if (null != application)
+ {
+ this.application = application;
+ }
+ }
+ else
+ {
+ if (this.application != application)
+ {
+ throw new IllegalArgumentException("Application must only be set once.");
+ }
+ }
+ }
+
+ public B withDirection(DirectionType direction)
+ {
+ element.setDirection(direction);
+ return self();
+ }
+
+ public B withTypeType(DataTypeType dataTypeType)
+ {
+ element.setType(dataTypeType);
+ return self();
+ }
+
+
+}
diff --git a/model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/variable/ExternalWebApplicationApplicationBuilder.java b/model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/variable/ExternalWebApplicationApplicationBuilder.java
new file mode 100644
index 0000000..7897caa
--- /dev/null
+++ b/model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/variable/ExternalWebApplicationApplicationBuilder.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2012 SunGard CSA LLC and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SunGard CSA LLC - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.stardust.model.xpdl.builder.variable;
+
+import org.eclipse.stardust.model.xpdl.builder.common.AbstractElementBuilder;
+import org.eclipse.stardust.model.xpdl.builder.common.AbstractModelElementBuilder;
+import org.eclipse.stardust.model.xpdl.builder.utils.ModelerConstants;
+import org.eclipse.stardust.model.xpdl.builder.utils.XpdlModelUtils;
+import org.eclipse.stardust.model.xpdl.carnot.ApplicationContextTypeType;
+import org.eclipse.stardust.model.xpdl.carnot.ApplicationType;
+import org.eclipse.stardust.model.xpdl.carnot.ContextType;
+import org.eclipse.stardust.model.xpdl.carnot.ModelType;
+
+public class ExternalWebApplicationApplicationBuilder extends AbstractModelElementBuilder<ApplicationType, ExternalWebApplicationApplicationBuilder>
+{
+
+ public ExternalWebApplicationApplicationBuilder(ModelType model)
+ {
+ super(F_CWM.createApplicationType());
+
+ forModel(model);
+
+ ContextType context = F_CWM.createContextType();
+ element.setInteractive(true);
+ ApplicationContextTypeType contextTypeType = XpdlModelUtils.findIdentifiableElement(
+ model.getApplicationContextType(), ModelerConstants.EXTERNAL_WEB_APP_CONTEXT_TYPE_KEY);
+ if (contextTypeType == null) {
+ contextTypeType = AbstractElementBuilder.F_CWM.createApplicationContextTypeType();
+ contextTypeType.setName("External Web Application");
+ contextTypeType.setId("externalWebApp");
+ contextTypeType.setIsPredefined(true);
+ long maxElementOid = XpdlModelUtils.getMaxUsedOid(model);
+ contextTypeType.setElementOid(++maxElementOid);
+ model.getApplicationContextType().add(contextTypeType);
+ }
+ context.setType(contextTypeType); // TODO Add this context type to the model
+ element.getContext().add(context);
+ }
+
+ @Override
+ protected String getDefaultElementIdPrefix()
+ {
+ return "Application";
+ }
+
+ public static ExternalWebApplicationApplicationBuilder newExternalWebApplication(ModelType model)
+ {
+ return new ExternalWebApplicationApplicationBuilder(model);
+ }
+
+ @Override
+ protected ApplicationType finalizeElement()
+ {
+ super.finalizeElement();
+ model.getApplication().add(element);
+ return element;
+ }
+
+}
diff --git a/model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/variable/MessageTransformationApplicationBuilder.java b/model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/variable/MessageTransformationApplicationBuilder.java
new file mode 100644
index 0000000..95fa3ec
--- /dev/null
+++ b/model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/variable/MessageTransformationApplicationBuilder.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2012 SunGard CSA LLC and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SunGard CSA LLC - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.stardust.model.xpdl.builder.variable;
+
+import org.eclipse.stardust.engine.extensions.transformation.model.MappingModelUtil;
+import org.eclipse.stardust.engine.extensions.transformation.model.mapping.MappingFactory;
+import org.eclipse.stardust.engine.extensions.transformation.model.mapping.TransformationProperty;
+import org.eclipse.stardust.model.xpdl.builder.common.AbstractElementBuilder;
+import org.eclipse.stardust.model.xpdl.builder.common.AbstractModelElementBuilder;
+import org.eclipse.stardust.model.xpdl.builder.utils.ModelerConstants;
+import org.eclipse.stardust.model.xpdl.builder.utils.XpdlModelUtils;
+import org.eclipse.stardust.model.xpdl.carnot.ApplicationType;
+import org.eclipse.stardust.model.xpdl.carnot.ApplicationTypeType;
+import org.eclipse.stardust.model.xpdl.carnot.ModelType;
+import org.eclipse.stardust.model.xpdl.carnot.util.AttributeUtil;
+
+public class MessageTransformationApplicationBuilder extends AbstractModelElementBuilder<ApplicationType, MessageTransformationApplicationBuilder>
+{
+
+ public MessageTransformationApplicationBuilder(ModelType model)
+ {
+ super(F_CWM.createApplicationType());
+
+ forModel(model);
+
+ ApplicationTypeType applicationMetaType = XpdlModelUtils.findIdentifiableElement(
+ model.getApplicationType(), ModelerConstants.MESSAGE_TRANSFORMATION_APPLICATION_TYPE_ID);
+ if (null == applicationMetaType)
+ {
+ applicationMetaType = AbstractElementBuilder.F_CWM.createApplicationTypeType();
+ applicationMetaType.setId(ModelerConstants.MESSAGE_TRANSFORMATION_APPLICATION_TYPE_ID);
+ applicationMetaType.setName("Message Transformation Bean");
+ applicationMetaType.setIsPredefined(true);
+ long maxElementOid = XpdlModelUtils.getMaxUsedOid(model);
+ applicationMetaType.setElementOid(++maxElementOid);
+ model.getApplicationType().add(applicationMetaType);
+ element.setType(applicationMetaType);
+ TransformationProperty property = MappingFactory.eINSTANCE.createTransformationProperty();
+ String xmlString = MappingModelUtil.transformEcore2XML(property);
+ AttributeUtil.setAttribute(element, "messageTransformation:TransformationProperty", xmlString);
+ }
+ }
+
+ @Override
+ protected String getDefaultElementIdPrefix()
+ {
+ return "Application";
+ }
+
+ public static MessageTransformationApplicationBuilder newMessageTransformationApplication(ModelType model)
+ {
+ return new MessageTransformationApplicationBuilder(model);
+ }
+
+ @Override
+ protected ApplicationType finalizeElement()
+ {
+ super.finalizeElement();
+ model.getApplication().add(element);
+ return element;
+ }
+
+}
diff --git a/model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/variable/PrimitiveAccessPointBuilder.java b/model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/variable/PrimitiveAccessPointBuilder.java
new file mode 100644
index 0000000..f2dbb73
--- /dev/null
+++ b/model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/variable/PrimitiveAccessPointBuilder.java
@@ -0,0 +1,165 @@
+/*******************************************************************************
+ * Copyright (c) 2012 SunGard CSA LLC and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SunGard CSA LLC - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.stardust.model.xpdl.builder.variable;
+
+import java.util.Iterator;
+
+import org.eclipse.stardust.engine.api.model.PredefinedConstants;
+import org.eclipse.stardust.engine.extensions.transformation.model.MappingModelUtil;
+import org.eclipse.stardust.engine.extensions.transformation.model.mapping.MappingFactory;
+import org.eclipse.stardust.engine.extensions.transformation.model.mapping.TransformationProperty;
+import org.eclipse.stardust.model.xpdl.builder.common.AbstractModelElementBuilder;
+import org.eclipse.stardust.model.xpdl.builder.utils.ModelBuilderFacade;
+import org.eclipse.stardust.model.xpdl.builder.utils.ModelerConstants;
+import org.eclipse.stardust.model.xpdl.builder.utils.XpdlModelUtils;
+import org.eclipse.stardust.model.xpdl.carnot.AccessPointType;
+import org.eclipse.stardust.model.xpdl.carnot.ApplicationType;
+import org.eclipse.stardust.model.xpdl.carnot.ContextType;
+import org.eclipse.stardust.model.xpdl.carnot.DataTypeType;
+import org.eclipse.stardust.model.xpdl.carnot.DirectionType;
+import org.eclipse.stardust.model.xpdl.carnot.IAccessPointOwner;
+import org.eclipse.stardust.model.xpdl.carnot.util.AttributeUtil;
+import org.eclipse.stardust.model.xpdl.carnot.util.ModelUtils;
+
+public class PrimitiveAccessPointBuilder
+ extends AbstractModelElementBuilder<AccessPointType, PrimitiveAccessPointBuilder>
+{
+
+ private IAccessPointOwner owner;
+
+ public PrimitiveAccessPointBuilder()
+ {
+ super(F_CWM.createAccessPointType());
+ }
+
+ public PrimitiveAccessPointBuilder(IAccessPointOwner anOwner)
+ {
+ super(F_CWM.createAccessPointType());
+ forModel(ModelUtils.findContainingModel(anOwner));
+ this.owner = anOwner;
+ long maxElementOid = XpdlModelUtils.getMaxUsedOid(model);
+ element.setElementOid(++maxElementOid);
+ }
+
+ private void createApplicationAccessPoint(IAccessPointOwner anOwner)
+ {
+ ApplicationType applicationType = (ApplicationType) anOwner;
+ if (applicationType.isInteractive())
+ {
+ createExternalWebApplicationAccessPoint(applicationType);
+ }
+ else
+ {
+ if (applicationType.getType().getId()
+ .equals(ModelerConstants.MESSAGE_TRANSFORMATION_APPLICATION_TYPE_ID))
+ {
+ createMessageTransformationApplicationAccessPoint(applicationType);
+ }
+ }
+ }
+
+ private void createMessageTransformationApplicationAccessPoint(
+ ApplicationType applicationType)
+ {
+ applicationType.getAccessPoint().add(element);
+ AttributeUtil.setAttribute(element, "RootElement", element.getId());
+ AttributeUtil.setAttribute(element, "FullXPath", element.getId() + "/");
+ TransformationProperty property = MappingFactory.eINSTANCE
+ .createTransformationProperty();
+ String xmlString = MappingModelUtil.transformEcore2XML(property);
+ AttributeUtil.setAttribute(element, "messageTransformation:TransformationProperty",
+ xmlString);
+ }
+
+ private void createExternalWebApplicationAccessPoint(ApplicationType applicationType)
+ {
+ ContextType contextType = getApplicationContext(applicationType,
+ ModelerConstants.EXTERNAL_WEB_APP_CONTEXT_TYPE_KEY);
+ contextType.getAccessPoint().add(element);
+ AttributeUtil.setAttribute(element, "RootElement", element.getId());
+ TransformationProperty property = MappingFactory.eINSTANCE
+ .createTransformationProperty();
+ String xmlString = MappingModelUtil.transformEcore2XML(property);
+ AttributeUtil.setAttribute(contextType,
+ "messageTransformation:TransformationProperty", xmlString);
+ }
+
+ @Override
+ protected String getDefaultElementIdPrefix()
+ {
+ return "PrimitiveAccessPoint";
+ }
+
+ public static PrimitiveAccessPointBuilder newAccessPoint(IAccessPointOwner anOwner)
+ {
+ return new PrimitiveAccessPointBuilder(anOwner);
+ }
+
+ @Override
+ protected AccessPointType finalizeElement()
+ {
+ super.finalizeElement();
+ if (owner instanceof ApplicationType)
+ {
+ createApplicationAccessPoint(owner);
+ }
+ else
+ {
+ createDefaultAccessPoint(owner);
+ }
+ return element;
+ }
+
+ private void createDefaultAccessPoint(IAccessPointOwner owner2)
+ {
+ owner.getAccessPoint().add(element);
+ }
+
+ public PrimitiveAccessPointBuilder withDirection(String direction)
+ {
+ DirectionType directionType;
+ if (direction.equals(DirectionType.IN_LITERAL.getName()))
+ {
+ directionType = DirectionType.IN_LITERAL;
+ }
+ else
+ {
+ directionType = DirectionType.OUT_LITERAL;
+ }
+ element.setDirection(directionType);
+ return self();
+ }
+
+ public PrimitiveAccessPointBuilder withType(String primitiveTypeID)
+ {
+ AttributeUtil.setAttribute(element, PredefinedConstants.TYPE_ATT,
+ "ag.carnot.workflow.spi.providers.data.java.Type", primitiveTypeID);
+ DataTypeType dataTypeType = new ModelBuilderFacade().findDataType(model,
+ PredefinedConstants.PRIMITIVE_DATA);
+ element.setType(dataTypeType);
+ return self();
+ }
+
+ private ContextType getApplicationContext(ApplicationType application,
+ String contextTypeKey)
+ {
+ for (Iterator<ContextType> i = application.getContext().iterator(); i.hasNext();)
+ {
+ ContextType contextType = i.next();
+ if (contextType.getType().getId().equals(contextTypeKey))
+ {
+ return contextType;
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/variable/StructAccessPointBuilder.java b/model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/variable/StructAccessPointBuilder.java
new file mode 100644
index 0000000..540f22b
--- /dev/null
+++ b/model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/variable/StructAccessPointBuilder.java
@@ -0,0 +1,189 @@
+/*******************************************************************************
+ * Copyright (c) 2012 SunGard CSA LLC and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SunGard CSA LLC - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.stardust.model.xpdl.builder.variable;
+
+import org.eclipse.stardust.engine.api.model.PredefinedConstants;
+import org.eclipse.stardust.engine.core.struct.StructuredDataConstants;
+import org.eclipse.stardust.engine.extensions.transformation.model.MappingModelUtil;
+import org.eclipse.stardust.engine.extensions.transformation.model.mapping.MappingFactory;
+import org.eclipse.stardust.engine.extensions.transformation.model.mapping.TransformationProperty;
+import org.eclipse.stardust.model.xpdl.builder.common.AbstractModelElementBuilder;
+import org.eclipse.stardust.model.xpdl.builder.utils.ModelBuilderFacade;
+import org.eclipse.stardust.model.xpdl.builder.utils.ModelerConstants;
+import org.eclipse.stardust.model.xpdl.builder.utils.XpdlModelUtils;
+import org.eclipse.stardust.model.xpdl.carnot.AccessPointType;
+import org.eclipse.stardust.model.xpdl.carnot.ApplicationType;
+import org.eclipse.stardust.model.xpdl.carnot.ContextType;
+import org.eclipse.stardust.model.xpdl.carnot.DataTypeType;
+import org.eclipse.stardust.model.xpdl.carnot.DirectionType;
+import org.eclipse.stardust.model.xpdl.carnot.IAccessPointOwner;
+import org.eclipse.stardust.model.xpdl.carnot.util.AttributeUtil;
+import org.eclipse.stardust.model.xpdl.carnot.util.ModelUtils;
+
+public class StructAccessPointBuilder
+ extends AbstractModelElementBuilder<AccessPointType, StructAccessPointBuilder>
+{
+
+ private ModelBuilderFacade facade;
+
+ private IAccessPointOwner owner;
+
+ public StructAccessPointBuilder()
+ {
+ super(F_CWM.createAccessPointType());
+ }
+
+ public StructAccessPointBuilder(IAccessPointOwner anOwner)
+ {
+ super(F_CWM.createAccessPointType());
+ this.owner = anOwner;
+ forModel(ModelUtils.findContainingModel(anOwner));
+ long maxElementOid = XpdlModelUtils.getMaxUsedOid(model);
+ element.setElementOid(++maxElementOid);
+ }
+
+ private void createApplicationAccessPoint(IAccessPointOwner anOwner)
+ {
+ ApplicationType applicationType = (ApplicationType) anOwner;
+ if (applicationType.isInteractive())
+ {
+ createExternalWebApplicationAccessPoint(applicationType);
+ }
+ else
+ {
+ if (applicationType.getType().getId()
+ .equals(ModelerConstants.MESSAGE_TRANSFORMATION_APPLICATION_TYPE_ID))
+ {
+ createMessageTransformationApplicationAccessPoint(applicationType);
+ }
+ }
+ }
+
+ private void createDefaultAccessPoint(IAccessPointOwner owner2)
+ {
+ owner.getAccessPoint().add(element);
+ }
+
+ private void createMessageTransformationApplicationAccessPoint(
+ ApplicationType applicationType)
+ {
+ applicationType.getAccessPoint().add(element);
+ AttributeUtil
+ .setAttribute(
+ element,
+ "carnot:engine:path:separator", StructuredDataConstants.ACCESS_PATH_SEGMENT_SEPARATOR); //$NON-NLS-1$
+ AttributeUtil
+ .setBooleanAttribute(element, "carnot:engine:data:bidirectional", true);
+ AttributeUtil.setAttribute(element, "RootElement", element.getId());
+ AttributeUtil.setAttribute(element, "FullXPath", element.getId() + "/");
+ TransformationProperty property = MappingFactory.eINSTANCE
+ .createTransformationProperty();
+ String xmlString = MappingModelUtil.transformEcore2XML(property);
+ AttributeUtil.setAttribute(element, "messageTransformation:TransformationProperty",
+ xmlString);
+ }
+
+ private void createExternalWebApplicationAccessPoint(ApplicationType applicationType)
+ {
+ ContextType contextType = getModelBuilderFacade().getApplicationContext(
+ applicationType, ModelerConstants.EXTERNAL_WEB_APP_CONTEXT_TYPE_KEY);
+ contextType.getAccessPoint().add(element);
+ AttributeUtil
+ .setAttribute(
+ element,
+ "carnot:engine:path:separator", StructuredDataConstants.ACCESS_PATH_SEGMENT_SEPARATOR); //$NON-NLS-1$
+ AttributeUtil
+ .setBooleanAttribute(element, "carnot:engine:data:bidirectional", true);
+ AttributeUtil.setAttribute(element, "RootElement", element.getId());
+ TransformationProperty property = MappingFactory.eINSTANCE
+ .createTransformationProperty();
+ String xmlString = MappingModelUtil.transformEcore2XML(property);
+ AttributeUtil.setAttribute(contextType,
+ "messageTransformation:TransformationProperty", xmlString);
+ }
+
+ @Override
+ protected String getDefaultElementIdPrefix()
+ {
+ return "PrimitiveAccessPoint";
+ }
+
+ public static StructAccessPointBuilder newAccessPoint(IAccessPointOwner anOwner)
+ {
+ return new StructAccessPointBuilder(anOwner);
+ }
+
+ @Override
+ protected AccessPointType finalizeElement()
+ {
+ super.finalizeElement();
+ if (owner instanceof ApplicationType)
+ {
+ createApplicationAccessPoint(owner);
+ }
+ else
+ {
+ createDefaultAccessPoint(owner);
+ }
+ return element;
+ }
+
+ public StructAccessPointBuilder withDirection(String direction)
+ {
+ DirectionType directionType;
+ if (direction.equals(DirectionType.IN_LITERAL.getName()))
+ {
+ directionType = DirectionType.IN_LITERAL;
+ }
+ else
+ {
+ directionType = DirectionType.OUT_LITERAL;
+ }
+ element.setDirection(directionType);
+ return self();
+ }
+
+ public StructAccessPointBuilder withType(String structTypeFullID)
+ {
+ /*
+ * TypeDeclarationType declaringType = new ModelBuilderFacade()
+ * .findTypeDeclaration(structTypeFullID); ModelType typeDeclarationModel =
+ * ModelUtils.findContainingModel(declaringType);
+ */
+ String declaredTypeID = null;
+ // if (model.getId().equals(typeDeclarationModel.getId()))
+ if (model.getId().equals(getModelBuilderFacade().getModelId(structTypeFullID)))
+ {
+ declaredTypeID = getModelBuilderFacade().stripFullId(structTypeFullID);
+ }
+ else
+ {
+ declaredTypeID = "typeDeclaration:{"
+ + getModelBuilderFacade().getModelId(structTypeFullID) + "}"
+ + getModelBuilderFacade().stripFullId(structTypeFullID);
+ }
+ AttributeUtil.setAttribute(element, "carnot:engine:dataType", declaredTypeID);
+ DataTypeType dataTypeType = new ModelBuilderFacade().findDataType(model,
+ PredefinedConstants.STRUCTURED_DATA);
+ element.setType(dataTypeType);
+ return self();
+ }
+
+ private ModelBuilderFacade getModelBuilderFacade()
+ {
+ if (facade == null)
+ {
+ facade = new ModelBuilderFacade();
+ }
+ return facade;
+ }
+
+}
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 8df87d7..424c151 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
@@ -138,13 +138,22 @@ public class CrossModelSupportModelBuilderTest
facade.setFormalParameter(implementingProcess, "FormalParameter2", implementingComposite);
//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);
- facade.createApplication(providerModel, "UI MashUp", "UI MashUp", ModelerConstants.EXTERNAL_WEB_APP_CONTEXT_TYPE_KEY);
+ ApplicationType mta = facade.createApplication(providerModel, "MyMTA", "MyMTA", ModelerConstants.MESSAGE_TRANSFORMATION_APPLICATION_TYPE_ID);
+ facade.createPrimitiveAccessPoint(mta, "InputString1", "InputString", Type.String.getId(), "IN");
+ facade.createPrimitiveAccessPoint(mta, "OuputString1", "OutputString", Type.String.getId(), "OUT");
+ facade.createStructuredAccessPoint(mta, "InputStruct1", "InputStruct", "ProviderModel:ProvidedComposite", "IN");
+ facade.createStructuredAccessPoint(mta, "OutputStruct1", "OutputStruct", "ProviderModel:ProvidedComposite", "OUT");
+
+
+ ApplicationType externalWebApp = facade.createApplication(providerModel, "UI MashUp", "UI MashUp", ModelerConstants.EXTERNAL_WEB_APP_CONTEXT_TYPE_KEY);
+ facade.createPrimitiveAccessPoint(externalWebApp, "NewPrimitive", "NewPrimitive", Type.String.getId() , "IN");
+ facade.createStructuredAccessPoint(externalWebApp, "NewStruct", "NewStruct", "ProviderModel:ProvidedComposite", "IN");
+
+ ApplicationType consumedExtWebApp = facade.createApplication(consumerModel, "UI MashUp", "UI MashUp", ModelerConstants.EXTERNAL_WEB_APP_CONTEXT_TYPE_KEY);
+ facade.createStructuredAccessPoint(consumedExtWebApp, "NewStruct", "NewStruct", "ProviderModel:ProvidedComposite", "IN");
//Activities
ActivityType activity1 = facade.createActivity(providerModel, providedProcess2, "Manual", "ManualActivity1", "ManualActivity1", "ProviderModel:Administrator", null, null);
- facade.createActivity(providerModel, providedProcess2, "Application", "AppActivity1", "AppActivity1", null, "ProviderModel:WebService", null);
facade.createActivity(consumerModel, consumerProcess, "Subprocess", "ProvidedProcess1", "ProvidedProcess1", null, null, "ProviderModel:ProvidedProcess");
//Symbols
@@ -155,7 +164,6 @@ public class CrossModelSupportModelBuilderTest
//Search & Find
searchedDataType1 = facade.findData("ProviderModel:ProvidedPrimitive");
searchedDataType2 = facade.findData(providerModel, "ProvidedPrimitive");
- searchedApplicationType = facade.findApplication("ProviderModel:WebService");
searchedProcess = facade.findProcessDefinition("ProviderModel:ProvidedProcess2");
searchedType = facade.findTypeDeclaration("ProviderModel:ProvidedComposite");
searchedRole = facade.findParticipant("ProviderModel:Administrator");
@@ -201,9 +209,6 @@ public class CrossModelSupportModelBuilderTest
assertThat(searchedDataType2, not(is(nullValue())));
assertThat(searchedDataType2.getId(),is("ProvidedPrimitive"));
- assertThat(searchedApplicationType, not(is(nullValue())));
- assertThat(searchedApplicationType.getId(),is("WebService"));
-
assertThat(searchedProcess, not(is(nullValue())));
assertThat(searchedProcess.getId(),is("ProvidedProcess2"));