Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Lorenzo2017-02-01 08:36:25 +0000
committervincent lorenzo2017-02-02 21:48:37 +0000
commit75fb8e4f9ea1b8055690ebf117dd252a4f202f83 (patch)
tree1b387161575e0f4125400197f436ce36855a3788 /extraplugins/migration/rhapsody/org.eclipse.papyrus.migration.rhapsody/transform/Rhapsody2PapyrusSemanticElements.qvto
parent62f56e645b9c9f59f4415686aecdaafc6f7bf82b (diff)
downloadorg.eclipse.papyrus-75fb8e4f9ea1b8055690ebf117dd252a4f202f83.tar.gz
org.eclipse.papyrus-75fb8e4f9ea1b8055690ebf117dd252a4f202f83.tar.xz
org.eclipse.papyrus-75fb8e4f9ea1b8055690ebf117dd252a4f202f83.zip
Bug 511497: [Importer][Rhapsody] IAssociationEnd are not managed when inverse property!=null
- add mapping method to create Association when IAssociationEnd.inverser!=null, called iAssociationEndToUMLAssociation_case2 - rename toAssociationswithProp into iAssociationEndToUMLAssociation_case1 - add a common mapping method iAssociationEndToUMLAssociation to create association from an IAssociationEnd Change-Id: I4416f3275ec61fae2e12fc2c71078a4e7c4f69d1 Signed-off-by: Vincent Lorenzo <vincent.lorenzo@cea.fr>
Diffstat (limited to 'extraplugins/migration/rhapsody/org.eclipse.papyrus.migration.rhapsody/transform/Rhapsody2PapyrusSemanticElements.qvto')
-rwxr-xr-xextraplugins/migration/rhapsody/org.eclipse.papyrus.migration.rhapsody/transform/Rhapsody2PapyrusSemanticElements.qvto40
1 files changed, 36 insertions, 4 deletions
diff --git a/extraplugins/migration/rhapsody/org.eclipse.papyrus.migration.rhapsody/transform/Rhapsody2PapyrusSemanticElements.qvto b/extraplugins/migration/rhapsody/org.eclipse.papyrus.migration.rhapsody/transform/Rhapsody2PapyrusSemanticElements.qvto
index c94bc1714b8..b65bcdc3fd8 100755
--- a/extraplugins/migration/rhapsody/org.eclipse.papyrus.migration.rhapsody/transform/Rhapsody2PapyrusSemanticElements.qvto
+++ b/extraplugins/migration/rhapsody/org.eclipse.papyrus.migration.rhapsody/transform/Rhapsody2PapyrusSemanticElements.qvto
@@ -124,6 +124,7 @@ mapping umlrhapsody::DefaultSubsystemType::iDefaultSubsystemTypeToPackage():uml:
packagedElement+=iSubSystem.AssociationElements->selectByType(IAssociationClass)->selectByKind(EObject).map generalMappingToUMLElement().oclAsType(uml::PackageableElement);
packagedElement += iSubSystem.Types->selectByType(IType)->selectByKind(EObject).map generalMappingToUMLElement().oclAsType(uml::PackageableElement);
+
packagedElement += iSubSystem.Actors->selectByKind(IActor)->oclAsType(EObject).map generalMappingToUMLElement().oclAsType(uml::PackageableElement);
packagedElement +=iSubSystem.Declaratives[DefaultSubsystemType].oclAsSet().map iDefaultSubsystemTypeToPackage();
ownedComment += iSubSystem.Annotations->select(a | (a.oclIsTypeOf(IAnnotation) or a.oclIsTypeOf(IComment)))->oclAsType(EObject).map generalMappingToUMLElement().oclAsType(uml::Comment);
@@ -400,8 +401,20 @@ helper umlrhapsody::IAssociationEnd::isNavigable():Boolean{
return self.navigability.equalsIgnoreCase("Navigable");
}
-mapping umlrhapsody::IAssociationEnd::toAssociationswithProp(): uml::Association when{self.isNavigable() and self.inverse.oclIsUndefined()}{
+/**
+* Common method to create association from an IAssociationEnd
+*/
+mapping umlrhapsody::IAssociationEnd::iAssociationEndToUMLAssociation(): uml::Association disjuncts
+ umlrhapsody::IAssociationEnd::iAssociationEndToUMLAssociation_case1,
+ umlrhapsody::IAssociationEnd::iAssociationEndToUMLAssociation_case2
+{}
+
+mapping umlrhapsody::IAssociationEnd::iAssociationEndToUMLAssociation_case1(): uml::Association when {self.isNavigable() and self.inverse.oclIsUndefined()}{
//please keep this order (O source and 1 target) -> if we change this property we broke the BDD of test2
+
+ //when isNavigable() returns true, the property is owned by the classifier
+ //when isNavigable() returns false, the property is owned by the association
+ //here, in the Rhapsody model, we have only one end, so here this end will be owned by the classifier and the other one by the association
var localMemberEnd:=self.map toAssociationsEnd();
memberEnd+= localMemberEnd;
var localOwnedEnd:= object Property{
@@ -412,6 +425,26 @@ mapping umlrhapsody::IAssociationEnd::toAssociationswithProp(): uml::Association
}
+mapping umlrhapsody::IAssociationEnd::iAssociationEndToUMLAssociation_case2():uml::Association when{
+ self.isNavigable() and
+ (not self.inverse.oclIsUndefined())
+ and self.inverse.oclIsTypeOf(IAssociationEnd)
+ and self.inverse.oclAsType(IAssociationEnd).isNavigable()
+ and self.m_associationClass.oclIsUndefined()}{ //in this case, the association is created by the mapping for IAssociationClass
+ //when isNavigable() returns true, the property is owned by the classifier
+ //when isNavigable() returns false, the property is owned by the association
+ //-> here the 2 properties are owned by the classifier
+ init{
+ //this resolve is not a mistake. We call resolve to avoid to create several time the same association
+ result:=self.inverse.resolveoneIn(umlrhapsody::IAssociationEnd::iAssociationEndToUMLAssociation_case2);
+ }
+ if(result.memberEnd->size()=0){//the result has been created goint out of the init, because the resolve doesn't allow to find an existing association
+ result.memberEnd+=self.map toAssociationsEnd();
+ result.memberEnd+=self.inverse.oclAsType(IAssociationEnd).map toAssociationsEnd();
+ //order of member can't be determined in this case
+ }
+}
+
mapping umlrhapsody::IAssociationEnd::toAssociationsEnd(): uml::Property when{self.oclIsTypeOf(IAssociationEnd)}{
name:=self.name.replaceAll("\"","");
type:= self.otherClass.oclAsType(EObject).map generalMappingToUMLElement().oclAsType(Type);
@@ -513,9 +546,8 @@ mapping ecore::EObject::iClassToUMLClass(): uml::Class when {self.oclIsTypeOf(um
nestedClassifier+= localIClass.Associations[IPart]->select(current | current.implicitClass<>null).implicitClass.oclAsType(EObject).map generalMappingToUMLElement().oclAsType(uml::Classifier);
nestedClassifier+=localIClass.Declaratives->selectByType(IClass)->selectByKind(EObject).map generalMappingToUMLElement().oclAsType(uml::Classifier);
- ownedAttribute+= localIClass.Associations[IAssociationEnd].map toAssociationsEnd();
- associationsToAdd+=localIClass.Associations[IAssociationEnd]->select(assoEnd: IAssociationEnd |assoEnd.oclAsType(IAssociationEnd).inverse.oclIsUndefined()).oclAsSet().map toAssociationswithProp();
-
+ ownedAttribute+= localIClass.Associations->selectByType(IAssociationEnd)->select(a | a.isNavigable()).map toAssociationsEnd();
+ associationsToAdd+=localIClass.Associations[IAssociationEnd].map iAssociationEndToUMLAssociation();
ownedOperation += localIClass.Operations [IPrimitiveOperation].map toOperations();
ownedReception += localIClass.Operations[IReception].map toReceptions();

Back to the top