summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Pielmann2012-09-11 04:24:51 (EDT)
committer Stephan Born2012-09-28 06:32:24 (EDT)
commita73df229967ad349db5bbb91b0fbcc616f6bd044 (patch)
tree3fe951bebc11f85d36a2fc81cd901413df675c66
parent826027148814577309248be36f338ca390bec336 (diff)
downloadorg.eclipse.stardust.ide-a73df229967ad349db5bbb91b0fbcc616f6bd044.zip
org.eclipse.stardust.ide-a73df229967ad349db5bbb91b0fbcc616f6bd044.tar.gz
org.eclipse.stardust.ide-a73df229967ad349db5bbb91b0fbcc616f6bd044.tar.bz2
CRNT-26126 Pepper: ModelBuilder API - Creation of Formal Parameters in Process Interface
git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/ide@59064 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.java50
-rw-r--r--model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/utils/ModelerConstants.java7
-rw-r--r--model/org.eclipse.stardust.model.xpdl.builder/src/test/java/org/eclipse/stardust/model/xpdl/builder/CrossModelSupportModelBuilderTest.java77
3 files changed, 63 insertions, 71 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 8ab8498..29588ea 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
@@ -243,7 +243,7 @@ public class ModelBuilderFacade
}
public void createPrimitiveParameter(ProcessDefinitionType processInterface,
- DataType dataType, String id, String name, ModeType mode)
+ DataType data, String id, String name, String primitiveTypeID, ModeType mode)
{
XpdlFactory xpdlFactory = XpdlPackage.eINSTANCE.getXpdlFactory();
FormalParameterType parameterType = xpdlFactory.createFormalParameterType();
@@ -254,10 +254,10 @@ public class ModelBuilderFacade
org.eclipse.stardust.model.xpdl.xpdl2.DataTypeType dataTypeType = XpdlFactory.eINSTANCE
.createDataTypeType();
BasicTypeType basicType = xpdlFactory.createBasicTypeType();
- basicType.setType(TypeType.STRING_LITERAL);
+ basicType.setType(getPrimitiveType(primitiveTypeID));
dataTypeType.setBasicType(basicType);
parameterType.setDataType(dataTypeType);
- String typeId = dataType.getType().getId();
+ String typeId = data.getType().getId();
dataTypeType.setCarnotType(typeId);
FormalParametersType parametersType = processInterface.getFormalParameters();
@@ -279,12 +279,12 @@ public class ModelBuilderFacade
.createFormalParameterMappingsType();
}
- parameterMappingsType.setMappedData(parameterType, dataType);
+ parameterMappingsType.setMappedData(parameterType, data);
processInterface.setFormalParameterMappings(parameterMappingsType);
}
public void createStructuredParameter(ProcessDefinitionType processInterface,
- DataType dataType, String id, String name, ModeType mode)
+ DataType data, String id, String name, String structTypeFullID, ModeType mode)
{
XpdlFactory xpdlFactory = XpdlPackage.eINSTANCE.getXpdlFactory();
FormalParameterType parameterType = xpdlFactory.createFormalParameterType();
@@ -295,14 +295,16 @@ public class ModelBuilderFacade
org.eclipse.stardust.model.xpdl.xpdl2.DataTypeType dataTypeType = xpdlFactory
.createDataTypeType();
- String typeId = dataType.getType().getId();
+ String typeId = data.getType().getId();
parameterType.setDataType(dataTypeType);
dataTypeType.setCarnotType(typeId);
DeclaredTypeType declaredType = xpdlFactory.createDeclaredTypeType();
- declaredType.setId(AttributeUtil.getAttributeValue(dataType,
- StructuredDataConstants.TYPE_DECLARATION_ATT));
+ //declaredType.setId(AttributeUtil.getAttributeValue(data,
+ // StructuredDataConstants.TYPE_DECLARATION_ATT));
+
+ declaredType.setId(stripFullId(structTypeFullID));
dataTypeType.setDeclaredType(declaredType);
@@ -324,7 +326,7 @@ public class ModelBuilderFacade
.createFormalParameterMappingsType();
}
- parameterMappingsType.setMappedData(parameterType, dataType);
+ parameterMappingsType.setMappedData(parameterType, data);
processInterface.setFormalParameterMappings(parameterMappingsType);
}
@@ -2098,5 +2100,35 @@ public class ModelBuilderFacade
return null;
}
+ private TypeType getPrimitiveType(String primitiveTypeID)
+ {
+ TypeType type = null;
+ if (primitiveTypeID.equals(ModelerConstants.STRING_PRIMITIVE_DATA_TYPE))
+ {
+ type = TypeType.STRING_LITERAL;
+ }
+ else if (primitiveTypeID.equals(ModelerConstants.DATE_PRIMITIVE_DATA_TYPE))
+ {
+ type = TypeType.DATETIME_LITERAL;
+ }
+ else if (primitiveTypeID.equals(ModelerConstants.INTEGER_PRIMITIVE_DATA_TYPE))
+ {
+ type = TypeType.INTEGER_LITERAL;
+ }
+ else if (primitiveTypeID.equals(ModelerConstants.DOUBLE_PRIMITIVE_DATA_TYPE))
+ {
+ type = TypeType.FLOAT_LITERAL;
+ }
+ else if (primitiveTypeID.equals(ModelerConstants.DECIMAL_PRIMITIVE_DATA_TYPE))
+ {
+ type = TypeType.FLOAT_LITERAL;
+ }
+ else if (primitiveTypeID.equals(ModelerConstants.BOOLEAN_PRIMITIVE_DATA_TYPE))
+ {
+ type = TypeType.BOOLEAN_LITERAL;
+ }
+ return type;
+ }
+
}
diff --git a/model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/utils/ModelerConstants.java b/model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/utils/ModelerConstants.java
index 60acde3..82cb1cc 100644
--- a/model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/utils/ModelerConstants.java
+++ b/model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/utils/ModelerConstants.java
@@ -23,6 +23,7 @@ public class ModelerConstants
public static final String STRING_PRIMITIVE_DATA_TYPE = "string";
public static final String DATE_PRIMITIVE_DATA_TYPE = "date";
public static final String INTEGER_PRIMITIVE_DATA_TYPE = "integer";
+ public static final String BOOLEAN_PRIMITIVE_DATA_TYPE = "boolean";
public static final String DOUBLE_PRIMITIVE_DATA_TYPE = "double";
public static final String DECIMAL_PRIMITIVE_DATA_TYPE = "decimal";
public static final String STRUCTURED_DATA_TYPE_KEY = "struct";
@@ -41,7 +42,7 @@ public class ModelerConstants
public static final String DEF_LANE_NAME = "Default Lane";
public static final String ORIENTATION_PROPERTY = "orientation";
public static final String DIAGRAM_FLOW_ORIENTATION_HORIZONTAL = "DIAGRAM_FLOW_ORIENTATION_HORIZONTAL";
- public static final String DIAGRAM_FLOW_ORIENTATION_VERTICAL = "DIAGRAM_FLOW_ORIENTATION_VERTICAL";
+ public static final String DIAGRAM_FLOW_ORIENTATION_VERTICAL = "DIAGRAM_FLOW_ORIENTATION_VERTICAL";
public static final String NULL_VALUE = "null";
public static final String DIRECTORY_MODE = "DIRECTORY_MODE";
public static final String SINGLE_FILE_MODE = "SINGLE_FILE_MODE";
@@ -145,10 +146,10 @@ public class ModelerConstants
// @deprecated
public static final int POOL_SWIMLANE_TOP_BOX_HEIGHT = 20;
/* Half the size of the review why this adjustment is needed start event symbol used in Pepper
- * TODO - may need to be handled on the client side down the line.
+ * TODO - may need to be handled on the client side down the line.
* @deprecated */
public static final int START_END_SYMBOL_LEFT_OFFSET = 12;
- // Added to set symbol type at Marshaller same as client side
+ // Added to set symbol type at Marshaller same as client side
public static final String SWIMLANE_SYMBOL = "swimlaneSymbol";
public static final String ACTIVITY_SYMBOL = "activitySymbol";
public static final String GATEWAY_SYMBOL = "gateSymbol";
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 440a826..fde2a9b 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
@@ -103,7 +103,7 @@ public class CrossModelSupportModelBuilderTest
facade.createRole(consumerModel, "Administrator", "Administrator");
//Primitive Data
- localPrimitive = facade.createPrimitiveData(providerModel, "ProvidedPrimitive", "ProvidedPrimitive", ModelerConstants.STRING_PRIMITIVE_DATA_TYPE);
+ localPrimitive = facade.createPrimitiveData(providerModel, "ProvidedPrimitive", "ProvidedPrimitive", ModelerConstants.DOUBLE_PRIMITIVE_DATA_TYPE);
localConsumerPrimitive = facade.createPrimitiveData(consumerModel, "ConsumerPrimitive", "ConsumerPrimitive", ModelerConstants.STRING_PRIMITIVE_DATA_TYPE);
facade.updatePrimitiveData(localConsumerPrimitive, Type.Integer.getId());
DataType implementingPrimitive = facade.createPrimitiveData(consumerModel, "ImplementingPrimitive", "ImplementingPrimitive", ModelerConstants.STRING_PRIMITIVE_DATA_TYPE);
@@ -125,10 +125,12 @@ public class CrossModelSupportModelBuilderTest
localConsumerComposite = facade.createStructuredData(consumerModel, "ConsumerComposite1", "ConsumerComposite1", "ConsumerModel:ConsumerComposite");
facade.updateStructuredDataType(localConsumerComposite, "ProviderModel:ProvidedComposite");
facade.createDocumentData(providerModel, "LocalDocument", "LocalDocument", "ProvidedComposite");
+ DataType test = facade.createDocumentData(consumerModel, "ConsumerDocument", "ConsumerDocument", "ConsumerComposite");
+ facade.updateDocumentDataType(test, "ProviderModel:ProvidedComposite");
//Process Interface (Creation)
- facade.createPrimitiveParameter(processInterface, localPrimitive, "FormalParameter1", "FormalParameter1", ModeType.IN);
- facade.createStructuredParameter(processInterface, localComposite, "FormalParameter2", "FormalParameter2", ModeType.IN);
+ facade.createPrimitiveParameter(processInterface, localPrimitive, "FormalParameter1", "FormalParameter1", ModelerConstants.DOUBLE_PRIMITIVE_DATA_TYPE, ModeType.IN);
+ facade.createStructuredParameter(processInterface, localComposite, "FormalParameter2", "FormalParameter2", "ProviderModel:ProvidedComposite", ModeType.IN);
//Process Interface (Usage)
facade.setProcessImplementation(processInterface, implementingProcess);
@@ -138,6 +140,7 @@ public class CrossModelSupportModelBuilderTest
//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);
//Activities
ActivityType activity1 = facade.createActivity(providerModel, providedProcess2, "Manual", "ManualActivity1", "ManualActivity1", "ProviderModel:Administrator", null, null);
@@ -158,64 +161,20 @@ public class CrossModelSupportModelBuilderTest
searchedRole = facade.findParticipant("ProviderModel:Administrator");
- //Store
- byte[] modelContent = XpdlModelIoUtils.saveModel(consumerModel);
+ try
+ {
+ //Thread.sleep(5000);
+ byte[] modelContent = XpdlModelIoUtils.saveModel(providerModel);
+ //Thread.sleep(5000);
+ System.out.println(new String(modelContent));
+ }
+ catch (Throwable t)
+ {
+ t.printStackTrace();
+ }
//Output
- System.out.println(new String(modelContent));
- }
-
- private void createPrimitiveParameter(ProcessDefinitionType processInterface)
- {
- XpdlFactory xpdlFactory = XpdlPackage.eINSTANCE.getXpdlFactory();
- FormalParameterType parameterType = xpdlFactory.createFormalParameterType();
- parameterType.setId("FormalParameter1");
- parameterType.setName("Formal Parameter 1");
- parameterType.setMode(ModeType.IN);
-
- DataTypeType dataTypeType = xpdlFactory.createDataTypeType();
- BasicTypeType basicType = xpdlFactory.createBasicTypeType();
- basicType.setType(TypeType.STRING_LITERAL);
- dataTypeType.setBasicType(basicType);
- parameterType.setDataType(dataTypeType);
- String typeId = localPrimitive.getType().getId();
- dataTypeType.setCarnotType(typeId);
-
- FormalParametersType parametersType = xpdlFactory.createFormalParametersType();
- parametersType.addFormalParameter(parameterType);
- processInterface.setFormalParameters(parametersType);
-
- FormalParameterMappingsType parameterMappingsType = ExtensionsFactory.eINSTANCE.createFormalParameterMappingsType();
- parameterMappingsType.setMappedData(parameterType, localPrimitive);
- processInterface.setFormalParameterMappings(parameterMappingsType);
- }
-
- private void createStructuredParameter(ProcessDefinitionType processInterface)
- {
- XpdlFactory xpdlFactory = XpdlPackage.eINSTANCE.getXpdlFactory();
- FormalParameterType parameterType = xpdlFactory.createFormalParameterType();
- parameterType.setId("FormalParameter2");
- parameterType.setName("Formal Parameter 2");
- parameterType.setMode(ModeType.IN);
-
- DataTypeType dataTypeType = xpdlFactory.createDataTypeType();
- String typeId = localComposite.getType().getId();
-
- parameterType.setDataType(dataTypeType);
- dataTypeType.setCarnotType(typeId);
-
- DeclaredTypeType declaredType = xpdlFactory.createDeclaredTypeType();
- declaredType.setId(AttributeUtil.getAttributeValue(localComposite, StructuredDataConstants.TYPE_DECLARATION_ATT));
-
- dataTypeType.setDeclaredType(declaredType);
-
- FormalParametersType parametersType = processInterface.getFormalParameters();
- parametersType.addFormalParameter(parameterType);
- processInterface.setFormalParameters(parametersType);
-
- FormalParameterMappingsType parameterMappingsType = processInterface.getFormalParameterMappings();
- parameterMappingsType.setMappedData(parameterType, localComposite);
- processInterface.setFormalParameterMappings(parameterMappingsType);
+
}
@Test