summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Pielmann2012-09-07 07:09:59 (EDT)
committerStephan Born2012-09-10 08:46:57 (EDT)
commitcabcb580b11080c572fb429c2f7041189585a9b2 (patch)
tree2866cf2d4e421578ae16063b097ab515752646f1
parenta69a3ebfb0884286d1579dfdc8ae00a3ec996264 (diff)
downloadorg.eclipse.stardust.ide-cabcb580b11080c572fb429c2f7041189585a9b2.zip
org.eclipse.stardust.ide-cabcb580b11080c572fb429c2f7041189585a9b2.tar.gz
org.eclipse.stardust.ide-cabcb580b11080c572fb429c2f7041189585a9b2.tar.bz2
CRNT-26096 Pepper: Provide methods in ModelBuilderFacade to transform a data into another
git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/ide@59007 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.java43
1 files changed, 41 insertions, 2 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 e7569cd..25983ab 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
@@ -431,9 +431,10 @@ public class ModelBuilderFacade
return;
}
ModelType model = ModelUtils.findContainingModel(data);
+ data.setType(ModelUtils.findIdentifiableElement(model.getDataType(), targetTypeID));
IDataInitializer init = getInitializer(targetTypeID);
init.initialize(data, data.getAttribute());
- data.setType(ModelUtils.findIdentifiableElement(model.getDataType(), targetTypeID));
+
}
@@ -497,8 +498,44 @@ public class ModelBuilderFacade
data.setExternalReference(reference);
}
}
+ }
+
+ public void updateDocumentDataType(DataType data, String typeFullID)
+ {
+ ModelType model = ModelUtils.findContainingModel(data);
+ String sourceModelID = getModelId(typeFullID);
+ ModelType typeDeclarationModel = getModelManagementStrategy().getModels().get(
+ sourceModelID);
+ if (typeDeclarationModel != null) {
+ String declarationID = stripFullId(typeFullID);
+ TypeDeclarationType typeDeclaration = this.findTypeDeclaration(typeFullID);
+ if(sourceModelID.equals(model.getId()))
+ {
+ AttributeUtil.setAttribute(data, "carnot:engine:dms:resourceMetadataSchema",
+ declarationID);
+ } else {
+ String fileConnectionId = WebModelerConnectionManager.createFileConnection(model, typeDeclarationModel);
+ String bundleId = CarnotConstants.DIAGRAM_PLUGIN_ID;
+ URI uri = URI.createURI("cnx://" + fileConnectionId + "/");
+
+ ReplaceEObjectDescriptor descriptor = new ReplaceEObjectDescriptor(MergeUtils.createQualifiedUri(uri, typeDeclaration, true), data,
+ typeDeclaration.getId(), typeDeclaration.getName(), typeDeclaration.getDescription(),
+ bundleId, null);
+
+ AttributeUtil.setAttribute(data, "carnot:engine:path:separator", StructuredDataConstants.ACCESS_PATH_SEGMENT_SEPARATOR); //$NON-NLS-1$
+ AttributeUtil.setBooleanAttribute(data, "carnot:engine:data:bidirectional", true); //$NON-NLS-1$
+ AttributeUtil.setAttribute(data, IConnectionManager.URI_ATTRIBUTE_NAME, descriptor.getURI().toString());
+ ExternalReferenceType reference = XpdlFactory.eINSTANCE.createExternalReferenceType();
+ if (typeDeclarationModel != null)
+ {
+ reference.setLocation(ImportUtils.getPackageRef(descriptor, model, typeDeclarationModel).getId());
+ }
+ reference.setXref(declarationID);
+ data.setExternalReference(reference);
+ }
+ }
}
/**
@@ -2026,10 +2063,12 @@ public class ModelBuilderFacade
{
return new SerializableDataInitializer();
}
- if (dataTypeTypeID.equals("dmsDocument"))
+ if (dataTypeTypeID.equals(PredefinedConstants.DOCUMENT_DATA))
{
return new DmsDocumentInitializer();
}
return null;
}
+
+
}