diff options
author | Vincent Lorenzo | 2017-02-01 15:59:31 +0000 |
---|---|---|
committer | vincent lorenzo | 2017-02-02 10:19:51 +0000 |
commit | e2911f0576dc2496838dfc9431e771065408e0a8 (patch) | |
tree | 949a8082c8d82f37f4d4d512b7cfc87037e635c7 /extraplugins/migration/rhapsody/org.eclipse.papyrus.migration.rhapsody/transform/Rhapsody2PapyrusSemanticElements.qvto | |
parent | fa565169a68abd5bce6dfdd8c9963e1321c65217 (diff) | |
download | org.eclipse.papyrus-e2911f0576dc2496838dfc9431e771065408e0a8.tar.gz org.eclipse.papyrus-e2911f0576dc2496838dfc9431e771065408e0a8.tar.xz org.eclipse.papyrus-e2911f0576dc2496838dfc9431e771065408e0a8.zip |
Bug 511486: [Importer][Rhapsody] Refactore the mapping used for association
- commit 2
- remove useless mapping method fromClasse2Associations
- remove useless mapping method toAssociationswithoutProp (bad code, checked with JUnit tests, useless)
- remove mapping toOwnedAssociationEnd and integrate its code to toAssociationswithProp mapping
Change-Id: Ia7549cca9a8b9eba0925a681e86b53e37531a147
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-x | extraplugins/migration/rhapsody/org.eclipse.papyrus.migration.rhapsody/transform/Rhapsody2PapyrusSemanticElements.qvto | 62 |
1 files changed, 4 insertions, 58 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 02776778a0b..9f3f870c614 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 @@ -119,7 +119,7 @@ mapping umlrhapsody::DefaultSubsystemType::iDefaultSubsystemTypeToPackage():uml: packagedElement+= iSubSystem.Classes->selectByType(IClass)->any(name="TopLevel").Attrs->selectByKind(IAttribute).oclAsType(EObject).map generalMappingToUMLElement().oclAsType(PackageableElement); //TODO probably more check are required to remove TopLevel without problems (check with MARTE...) packagedElement+= iSubSystem.Classes->selectByType(IClass)->select(curr | curr.name<>"TopLevel")->selectByKind(EObject).map generalMappingToUMLElement().oclAsType(uml::PackageableElement); - packagedElement += iSubSystem.Classes[IClass].Associations[IAssociationEnd]->select(assoEnd: IAssociationEnd |not (assoEnd.oclAsType(IAssociationEnd).inverse.oclIsUndefined()))->any(true).map toAssociationswithoutProp(); + 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(); @@ -362,78 +362,24 @@ query umlrhapsody::IType::isUMLInstanceSpecification(): Boolean { //--------association code-------------- -mapping umlrhapsody::IAssociationEnd::toAssociationswithoutProp(): uml::Association { - var assoEnd:Set(umlrhapsody::IAssociationEnd) =inModel.rootObjects()[IProject].defaultSubsystem[ISubsystem].Classes[IClass].Associations[IAssociationEnd]->select(assoEnd: IAssociationEnd |not (assoEnd.oclAsType(IAssociationEnd).inverse.oclIsUndefined()))->asSet(); - memberEnd:=assoEnd.map toAssociationsEnd(); -} - mapping umlrhapsody::IAssociationEnd::toAssociationswithProp(): uml::Association { //please keep this order (O source and 1 target) -> if we change this property we broke the BDD of test2 var localMemberEnd:=self.map toAssociationsEnd(); memberEnd+= localMemberEnd; - var localOwnedEnd:=self.map toOwnedAssociationEnd(); + var localOwnedEnd:= object Property{ + type:= self.container().oclAsType(EObject).map generalMappingToUMLElement().oclAsType(Type); + }; ownedEnd+= localOwnedEnd; name:=localOwnedEnd.type.name + " refers to " + localMemberEnd.type.name + " as " + localMemberEnd.name; } -mapping umlrhapsody::IAssociationEnd::toOwnedAssociationEnd(): uml::Property{ - type:= self.container().oclAsType(EObject).map generalMappingToUMLElement().oclAsType(Type); - var type : uml::Class = type.oclAsType(Class); -} - mapping umlrhapsody::IAssociationEnd::toAssociationsEnd(): uml::Property when{self.oclIsTypeOf(IAssociationEnd)}{ name:=self.name.replaceAll("\"",""); type:= self.otherClass.oclAsType(EObject).map generalMappingToUMLElement().oclAsType(Type); aggregation:=AggregationKind::none; } -mapping umlrhapsody::IClass::fromClasse2Associations(): uml::Association -{ - -//TODO FIXME: default subsystem : bad code -var classes : Set(uml::Class) :=inModel.rootObjects()[IProject].defaultSubsystem[ISubsystem].Classes->selectByKind(EObject).map iClassToUMLClass()->asSet(); -var associations: Set(uml::Association); -var i : Integer=0; -classes->forEach(element) -{ -var newasso: uml::Association; - // collect the classes with AssociationEnd and create an association with both classes - if (not (element.oclAsType(IClass).Associations[IAssociationEnd]->isEmpty())) - then - { - newasso := object uml::Association - - { - var otherClass : IClass:= element.oclAsType(IClass).Associations[IAssociationEnd].otherClass->any(true).oclAsType(IClass); - memberEnd+= element.oclAsType(IClass).Associations[IAssociationEnd].map toAssociationsEnd(); - memberEnd+= otherClass.Associations[IAssociationEnd].map toAssociationsEnd(); - memberEnd->asSet(); - - }; - if (i=0){ - associations+=newasso; - i:= i+1; - }; - - if (not (associations->isEmpty())) - { - associations->forEach(asso) - { - if( not (asso.memberEnd->includesAll(newasso.memberEnd))) - associations+=newasso; - - } - }endif; - - }endif; - - - - }; - -} - /** * * This mapping convert a IPart into a uml Element |