summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Pielmann2012-09-14 03:29:09 (EDT)
committerStephan Born2012-09-14 03:29:09 (EDT)
commit27a5b1a95659355d9393fa17526d21c370d69cc3 (patch)
tree615c6b8fbbda1fa95ed47a2925aee8079172ed94
parente5352dff09a211441219e94b950557fa39c0a217 (diff)
downloadorg.eclipse.stardust.ide-27a5b1a95659355d9393fa17526d21c370d69cc3.zip
org.eclipse.stardust.ide-27a5b1a95659355d9393fa17526d21c370d69cc3.tar.gz
org.eclipse.stardust.ide-27a5b1a95659355d9393fa17526d21c370d69cc3.tar.bz2
CRNT-26125 Pepper: ModelBuilder API - Create accesspoints for MTA / UI Mashup (Create correct ApplicationMetaTypes)
git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/ide@59198 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
-rw-r--r--model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/utils/ModelBuilderFacade.java57
-rw-r--r--model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/variable/MessageTransformationApplicationBuilder.java8
-rw-r--r--model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/variable/WebserviceApplicationBuilder.java67
3 files changed, 128 insertions, 4 deletions
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 dbdc88a..e7235dc 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
@@ -27,6 +27,7 @@ import static org.eclipse.stardust.model.xpdl.builder.BpmModelBuilder.newRouteAc
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 static org.eclipse.stardust.model.xpdl.builder.BpmModelBuilder.newWebserviceApplication;
import java.util.ArrayList;
import java.util.Calendar;
@@ -340,6 +341,55 @@ public class ModelBuilderFacade
return parameterType;
}
+ public FormalParameterType createDocumentParameter(ProcessDefinitionType processInterface,
+ DataType data, String id, String name, String structTypeFullID, ModeType mode)
+ {
+ XpdlFactory xpdlFactory = XpdlPackage.eINSTANCE.getXpdlFactory();
+ FormalParameterType parameterType = xpdlFactory.createFormalParameterType();
+
+ parameterType.setId(id);
+ parameterType.setName(name);
+ parameterType.setMode(mode);
+
+ org.eclipse.stardust.model.xpdl.xpdl2.DataTypeType dataTypeType = xpdlFactory
+ .createDataTypeType();
+ String typeId = data.getType().getId();
+
+ parameterType.setDataType(dataTypeType);
+ dataTypeType.setCarnotType(typeId);
+
+ DeclaredTypeType declaredType = xpdlFactory.createDeclaredTypeType();
+ //declaredType.setId(AttributeUtil.getAttributeValue(data,
+ // StructuredDataConstants.TYPE_DECLARATION_ATT));
+
+ declaredType.setId(stripFullId(structTypeFullID));
+
+ dataTypeType.setDeclaredType(declaredType);
+
+ FormalParametersType parametersType = processInterface.getFormalParameters();
+
+ if (parametersType == null)
+ {
+ parametersType = xpdlFactory.createFormalParametersType();
+ }
+ parametersType.addFormalParameter(parameterType);
+ processInterface.setFormalParameters(parametersType);
+
+ FormalParameterMappingsType parameterMappingsType = processInterface
+ .getFormalParameterMappings();
+
+ if (parameterMappingsType == null)
+ {
+ parameterMappingsType = ExtensionsFactory.eINSTANCE
+ .createFormalParameterMappingsType();
+ }
+
+ parameterMappingsType.setMappedData(parameterType, data);
+ processInterface.setFormalParameterMappings(parameterMappingsType);
+
+ return parameterType;
+ }
+
public AccessPointType createPrimitiveAccessPoint(IAccessPointOwner application, String id,
String name, String primaryDataTypeID, String direction)
{
@@ -932,6 +982,13 @@ public class ModelBuilderFacade
applicationName).build();
}
+ if (applicationTypeID
+ .equalsIgnoreCase(ModelerConstants.WEB_SERVICE_APPLICATION_TYPE_ID))
+ {
+ return newWebserviceApplication(model).withIdAndName(applicationID,
+ applicationName).build();
+ }
+
return null;
}
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
index 06922ef..b848754 100644
--- 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
@@ -46,11 +46,11 @@ public class MessageTransformationApplicationBuilder extends AbstractModelElemen
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);
}
+ element.setType(applicationMetaType);
+ TransformationProperty property = MappingFactory.eINSTANCE.createTransformationProperty();
+ String xmlString = MappingModelUtil.transformEcore2XML(property);
+ AttributeUtil.setAttribute(element, "messageTransformation:TransformationProperty", xmlString);
}
@Override
diff --git a/model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/variable/WebserviceApplicationBuilder.java b/model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/variable/WebserviceApplicationBuilder.java
new file mode 100644
index 0000000..eb1f30a
--- /dev/null
+++ b/model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/variable/WebserviceApplicationBuilder.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.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 WebserviceApplicationBuilder extends AbstractModelElementBuilder<ApplicationType, WebserviceApplicationBuilder>
+{
+
+ public WebserviceApplicationBuilder(ModelType model)
+ {
+ super(F_CWM.createApplicationType());
+
+ forModel(model);
+
+ ApplicationTypeType applicationMetaType = XpdlModelUtils.findIdentifiableElement(
+ model.getApplicationType(), ModelerConstants.WEB_SERVICE_APPLICATION_TYPE_ID);
+ if (null == applicationMetaType)
+ {
+ applicationMetaType = AbstractElementBuilder.F_CWM.createApplicationTypeType();
+ applicationMetaType.setId(ModelerConstants.WEB_SERVICE_APPLICATION_TYPE_ID);
+ applicationMetaType.setName("Web Service Application");
+ applicationMetaType.setIsPredefined(true);
+ AttributeUtil.setAttribute(applicationMetaType, "carnot:engine:applicationInstance", "org.eclipse.stardust.engine.extensions.jaxws.app.WebserviceApplicationInstance");
+ AttributeUtil.setAttribute(applicationMetaType, "carnot:engine:validator", "org.eclipse.stardust.engine.extensions.jaxws.app.WebserviceApplicationValidator");
+ long maxElementOid = XpdlModelUtils.getMaxUsedOid(model);
+ applicationMetaType.setElementOid(++maxElementOid);
+ model.getApplicationType().add(applicationMetaType);
+ }
+ element.setType(applicationMetaType);
+ }
+
+ @Override
+ protected String getDefaultElementIdPrefix()
+ {
+ return "Application";
+ }
+
+ public static WebserviceApplicationBuilder newWebserviceApplication(ModelType model)
+ {
+ return new WebserviceApplicationBuilder(model);
+ }
+
+ @Override
+ protected ApplicationType finalizeElement()
+ {
+ super.finalizeElement();
+ model.getApplication().add(element);
+ return element;
+ }
+
+}