diff options
7 files changed, 51 insertions, 67 deletions
diff --git a/extraplugins/migration/rhapsody/org.eclipse.papyrus.migration.rhapsody/transform/Rhapsody2PapyrusNotation.qvto b/extraplugins/migration/rhapsody/org.eclipse.papyrus.migration.rhapsody/transform/Rhapsody2PapyrusNotation.qvto index 3405dc9be7a..732c40c4f8c 100644 --- a/extraplugins/migration/rhapsody/org.eclipse.papyrus.migration.rhapsody/transform/Rhapsody2PapyrusNotation.qvto +++ b/extraplugins/migration/rhapsody/org.eclipse.papyrus.migration.rhapsody/transform/Rhapsody2PapyrusNotation.qvto @@ -619,7 +619,7 @@ query umlrhapsody::CGIAssociationEnd::getDecorationNodes(): Set(DecorationNode) mapping umlrhapsody::CGIClass::toPapyrusNode() : Shape when { not (self.m_pParent.oclIsUndefined())} { - result.element := self.m_pModelObject.resolveIn(umlrhapsody::IClass::toClasses, uml::Class)![EObject]; + result.element := self.m_pModelObject.resolveIn(ecore::EObject::generalMappingToUMLElement, uml::Class)![EObject]; result.type := self.getNodeType(); result.children:= self.map toDecorationNode(); result.children+= self.Compartments[CGICompartment].map toBasicCompartment(); 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 eec7f778fee..aeb21a00354 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 @@ -116,9 +116,9 @@ mapping umlrhapsody::DefaultSubsystemType::iDefaultSubsystemTypeToPackage():uml: packagedElement+=iSubSystem.Events[IEvent].map toSignals(); - packagedElement+= iSubSystem.Classes[IClass]->selectByType(IClass)->any(name="TopLevel").Attrs->selectByKind(IAttribute).oclAsType(EObject).map generalMappingToUMLElement().oclAsType(PackageableElement); + 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[IClass]->select(curr:IClass | curr.name<>"TopLevel").oclAsSet().map toUMLElement().oclAsType(uml::PackageableElement); + 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[IType].oclAsSet().map iTypeToUMLElement().oclAsType(uml::PackageableElement); packagedElement += iSubSystem.Actors->selectByKind(IActor)->oclAsType(EObject).map generalMappingToUMLElement().oclAsType(uml::PackageableElement); @@ -134,11 +134,13 @@ mapping umlrhapsody::DefaultSubsystemType::iDefaultSubsystemTypeToPackage():uml: * This method has been created to be the common entry point for all the semantic transformations from the Rhapsody Model to the UML Model * TODO : rewrite all transformations in order to use me everywhere */ -mapping EObject::generalMappingToUMLElement():uml::Element disjuncts - EObject::iActorToUMLActor, - EObject::iCommentToUMLComment, - EObject::iDescriptionToUMLComment, - EObject::iAttributeToInstanceSpecification +mapping ecore::EObject::generalMappingToUMLElement():uml::Element disjuncts + ecore::EObject::iActorToUMLActor, + ecore::EObject::iCommentToUMLComment, + ecore::EObject::iDescriptionToUMLComment, + ecore::EObject::iAttributeToUMLInstanceSpecification, + ecore::EObject::iClassToUMLInterface, + ecore::EObject::iClassToUMLClass {} /** @@ -220,22 +222,14 @@ helper String::getTextWithoutMarkers():String{ return res; } - -/** -* a common method to call for the creation of all UML Element -*/ -mapping umlrhapsody::IClass::toUMLElement() : uml::Element //TODO merge me with generalMappingToUMLElement - disjuncts - umlrhapsody::IClass::toUMLInterface, - umlrhapsody::IClass::toClasses{} //TODO : rename me - /** * * return true if the IClass is representing an interface */ -mapping umlrhapsody::IClass::toUMLInterface() : uml::Interface when {self.oclIsTypeOf(IClass) and self.isInterface() /*self.isSysMLFlowSpecification()*/}{ - name:= self.name.replaceAll("\"",""); - ownedAttribute+= self.Attrs[IAttribute].map iVariableToUMLElement(); +mapping ecore::EObject::iClassToUMLInterface() : uml::Interface when {self.oclIsTypeOf(umlrhapsody::IClass) and self.oclAsType(umlrhapsody::IClass).isInterface() /*self.isSysMLFlowSpecification()*/}{ + var localIClass:umlrhapsody::IClass:=self.oclAsType(umlrhapsody::IClass); + name:= localIClass.name.replaceAll("\"",""); + ownedAttribute+= localIClass.Attrs[IAttribute].map iVariableToUMLElement(); // ownedAttribute+= self.Associations[IAssociationEnd].map toAssociationsEnd(); // ownedOperation := self.Operations [IPrimitiveOperation].map toOperations(); // ownedReception:= self.Operations[IReception].map toReceptions(); @@ -376,19 +370,9 @@ query umlrhapsody::IType::isUMLInstanceSpecification(): Boolean { -mapping umlrhapsody::IAssociationEnd::toAssociationswithoutProp(): uml::Association -{ - init { - - result := object 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::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 { @@ -402,10 +386,8 @@ mapping umlrhapsody::IAssociationEnd::toAssociationswithProp(): uml::Association } mapping umlrhapsody::IAssociationEnd::toOwnedAssociationEnd(): uml::Property{ - // map toClasses() maps the IClass to Class - type:= self.container().oclAsType(IClass).map toUMLElement().oclAsType(Type); + type:= self.container().oclAsType(EObject).map generalMappingToUMLElement().oclAsType(Type); var type : uml::Class = type.oclAsType(Class); - } mapping umlrhapsody::IType::toUMLDatatype() : uml::DataType when {self.isUMLDataType()}{ @@ -436,30 +418,32 @@ mapping umlrhapsody::IType::iTypeToUMLClass() : uml::Class when {self.isUMLClass } -mapping umlrhapsody::IClass::toClasses(): uml::Class when {self.oclIsTypeOf(IClass) and not (self.isInterface())}{ - name:= self.name.replaceAll("\"",""); - ownedAttribute+= self.Attrs[IAttribute].map iVariableToUMLElement(); - ownedAttribute+= self.Associations[IPart].map iPartToUMLElement().oclAsType(uml::Property); +mapping ecore::EObject::iClassToUMLClass(): uml::Class when {self.oclIsTypeOf(umlrhapsody::IClass) and not (self.oclAsType(umlrhapsody::IClass).isInterface())}{ + var localIClass:umlrhapsody::IClass:=self.oclAsType(umlrhapsody::IClass); + + name:= localIClass.name.replaceAll("\"",""); + ownedAttribute+= localIClass.Attrs[IAttribute].map iVariableToUMLElement(); + ownedAttribute+= localIClass.Associations[IPart].map iPartToUMLElement().oclAsType(uml::Property); - var associationsToAdd:=self.Associations[IPart].map iPartToUMLAssociation(); + var associationsToAdd:=localIClass.Associations[IPart].map iPartToUMLAssociation(); - nestedClassifier+= self.Associations[IPart]->select(current | current.implicitClass<>null).implicitClass.map toUMLElement().oclAsType(uml::Classifier); - nestedClassifier+=self.Declaratives[IClass].map toUMLElement().oclAsType(uml::Classifier); + 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+= self.Associations[IAssociationEnd].map toAssociationsEnd(); - associationsToAdd+=self.Associations[IAssociationEnd]->select(assoEnd: IAssociationEnd |assoEnd.oclAsType(IAssociationEnd).inverse.oclIsUndefined()).oclAsSet().map toAssociationswithProp(); + ownedAttribute+= localIClass.Associations[IAssociationEnd].map toAssociationsEnd(); + associationsToAdd+=localIClass.Associations[IAssociationEnd]->select(assoEnd: IAssociationEnd |assoEnd.oclAsType(IAssociationEnd).inverse.oclIsUndefined()).oclAsSet().map toAssociationswithProp(); - ownedOperation += self.Operations [IPrimitiveOperation].map toOperations(); - ownedReception += self.Operations[IReception].map toReceptions(); - generalization += self.Inheritances [IGeneralization].map toPapyrusGeneralization(); - ownedBehavior += self.StateCharts[IStateChart].map toStateMachine(); + ownedOperation += localIClass.Operations [IPrimitiveOperation].map toOperations(); + ownedReception += localIClass.Operations[IReception].map toReceptions(); + generalization += localIClass.Inheritances [IGeneralization].map toPapyrusGeneralization(); + ownedBehavior += localIClass.StateCharts[IStateChart].map toStateMachine(); - ownedAttribute+=self.Ports.map iRelationToUMLElement().oclAsType(uml::Property); - ownedConnector+=self.ObjectLinks[IObjectLink].map iObjectLinkToUMLElement().oclAsType(uml::Connector); - ownedConnector+=self.Declaratives[IInformationFlow].map iInformationFlowToUMLElement().oclAsType(uml::Connector); + ownedAttribute+=localIClass.Ports.map iRelationToUMLElement().oclAsType(uml::Property); + ownedConnector+=localIClass.ObjectLinks[IObjectLink].map iObjectLinkToUMLElement().oclAsType(uml::Connector); + ownedConnector+=localIClass.Declaratives[IInformationFlow].map iInformationFlowToUMLElement().oclAsType(uml::Connector); - ownedComment+=self.Annotations.oclAsType(IComment).oclAsType(EObject).map generalMappingToUMLElement().oclAsType(uml::Comment); + ownedComment+=localIClass.Annotations.oclAsType(IComment).oclAsType(EObject).map generalMappingToUMLElement().oclAsType(uml::Comment); registerAssociationToStore(result, associationsToAdd); } @@ -677,7 +661,7 @@ mapping umlrhapsody::IPart::iPartToUMLProperty():uml::Property when {self.oclIsT name:= self.name.replaceAll("\"",""); //TODO : manage aggregation kind aggregation:=AggregationKind::composite; - type:=self.otherClass.oclAsType(IClass).map toUMLElement().oclAsType(uml::Type); + type:=self.otherClass.oclAsType(EObject).map generalMappingToUMLElement().oclAsType(uml::Type); } mapping umlrhapsody::IPart::iPartToUMLAssociation():uml::Association when {true}{ @@ -718,7 +702,7 @@ mapping umlrhapsody::IRelation::iRelationToUMLProperty(): uml::Property when {se if (not sysPort.otherClass.oclIsUndefined()){ type := sysPort.otherClass [IType]->any(true).oclAsType(IType).map iTypeToUMLElement().oclAsType(Type); }elif(sysPort.otherClass.oclIsKindOf(IClass)){ - type := sysPort.otherClass.oclAsType(IClass).map toUMLElement().oclAsType(Type); + type := sysPort.otherClass.oclAsType(EObject).map generalMappingToUMLElement().oclAsType(Type); }; //a multiplicity has been defined if(not sysPort.multiplicity.oclIsUndefined()){ @@ -741,7 +725,7 @@ mapping umlrhapsody::IRelation::iRelationToSysMLPort(): uml::Port when {self.isR if(sysPort.otherClass.oclIsKindOf(IType)){ type := sysPort.otherClass.oclAsType(IType).map iTypeToUMLElement().oclAsType(Type); }elif(sysPort.otherClass.oclIsKindOf(IClass)){ - type := sysPort.otherClass.oclAsType(IClass).map toUMLElement().oclAsType(Type); + type := sysPort.otherClass.oclAsType(EObject).map generalMappingToUMLElement().oclAsType(Type); } }; aggregation:=AggregationKind::composite; @@ -954,7 +938,7 @@ mapping umlrhapsody::IInterfaceItemTrigger::toTrigger(): uml::Trigger mapping umlrhapsody::IAssociationEnd::toAssociationsEnd(): uml::Property when{self.oclIsTypeOf(IAssociationEnd)}{ name:=self.name.replaceAll("\"",""); - type:= self.otherClass.oclAsType(IClass).map toUMLElement().oclAsType(Type); + type:= self.otherClass.oclAsType(EObject).map generalMappingToUMLElement().oclAsType(Type); aggregation:=AggregationKind::none; } @@ -962,7 +946,7 @@ mapping umlrhapsody::IClass::fromClasse2Associations(): uml::Association { //TODO FIXME: default subsystem : bad code -var classes : Set(uml::Class) :=inModel.rootObjects()[IProject].defaultSubsystem[ISubsystem].Classes[IClass].map toClasses()->asSet(); +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) @@ -1007,7 +991,7 @@ var newasso: uml::Association; mapping umlrhapsody::IGeneralization::toPapyrusGeneralization(): uml::Generalization { - general:= self.oclAsType(IGeneralization).dependsOn.oclAsType(IClass).map toClasses(); + general:= self.oclAsType(IGeneralization).dependsOn.oclAsType(IClass).oclAsType(EObject).map iClassToUMLClass(); } @@ -1068,7 +1052,7 @@ helper umlrhapsody::IAttribute::isInstanceSpecification():Boolean{ /** * This mapping creates InstanceSpecification from IAttribute */ -mapping ecore::EObject::iAttributeToInstanceSpecification(): uml::InstanceSpecification when {self.oclIsKindOf(IAttribute) and self.oclAsType(IAttribute).isInstanceSpecification()}{ +mapping ecore::EObject::iAttributeToUMLInstanceSpecification(): uml::InstanceSpecification when {self.oclIsKindOf(IAttribute) and self.oclAsType(IAttribute).isInstanceSpecification()}{ var iAttribute:IAttribute:=self.oclAsType(IAttribute); name:=iAttribute.name; classifier+=iAttribute.typeOf.oclAsType(IType).map iTypeToUMLElement().oclAsType(uml::Classifier); diff --git a/extraplugins/migration/rhapsody/org.eclipse.papyrus.migration.rhapsody/transform/SemanticInternationalization.qvto b/extraplugins/migration/rhapsody/org.eclipse.papyrus.migration.rhapsody/transform/SemanticInternationalization.qvto index 9d40019d213..31e18371921 100755 --- a/extraplugins/migration/rhapsody/org.eclipse.papyrus.migration.rhapsody/transform/SemanticInternationalization.qvto +++ b/extraplugins/migration/rhapsody/org.eclipse.papyrus.migration.rhapsody/transform/SemanticInternationalization.qvto @@ -112,9 +112,9 @@ helper NamedElement::getRhaposdyLabel():String{ //mapping umlrhapsody::IClass::toUMLElement() : uml::Element - if(rpyElement=null){ - rpyElement:=self.invresolveoneIn(IClass::toUMLElement)->selectByKind(IModelElement)->any(true); - }; +// if(rpyElement=null){ +// rpyElement:=self.invresolveoneIn(EObject::toUMLElement)->selectByKind(IModelElement)->any(true); +// }; //mapping umlrhapsody::IClass::toUMLInterface() : uml::Interface when {self.oclIsTypeOf(IClass) and self.isInterface() /*self.isSysMLFlowSpecification()*/}{ //already managed by toUMLElement diff --git a/extraplugins/migration/rhapsody/org.eclipse.papyrus.migration.rhapsody/transform/SysML11BlockDefinitionDiagram.qvto b/extraplugins/migration/rhapsody/org.eclipse.papyrus.migration.rhapsody/transform/SysML11BlockDefinitionDiagram.qvto index 605b74c4d65..543ccc01752 100644 --- a/extraplugins/migration/rhapsody/org.eclipse.papyrus.migration.rhapsody/transform/SysML11BlockDefinitionDiagram.qvto +++ b/extraplugins/migration/rhapsody/org.eclipse.papyrus.migration.rhapsody/transform/SysML11BlockDefinitionDiagram.qvto @@ -45,7 +45,7 @@ mapping rhapsodymetamodel::IDiagram::iDiagramToSysML11BlockDefinitionDiagram(rpy var iDiagramOwner:ecore::EObject:=self[EObject].eContainer()![EObject]; if(iDiagramOwner.oclIsKindOf(umlrhapsody::IClass)){ - owner:= iDiagramOwner.resolveIn(umlrhapsody::IClass::toUMLElement, uml::Element)![EObject]; + owner:= iDiagramOwner.resolveIn(ecore::EObject::generalMappingToUMLElement, uml::Element)![EObject]; }; //TODO : check owner and owner! result:=self.map createAndInitDiagram(rpyProject,getPapyrusDiagramType(), owner, owner); diff --git a/extraplugins/migration/rhapsody/org.eclipse.papyrus.migration.rhapsody/transform/SysML11InternalBlockDiagram.qvto b/extraplugins/migration/rhapsody/org.eclipse.papyrus.migration.rhapsody/transform/SysML11InternalBlockDiagram.qvto index a9f668d4b85..04b57ba3cce 100644 --- a/extraplugins/migration/rhapsody/org.eclipse.papyrus.migration.rhapsody/transform/SysML11InternalBlockDiagram.qvto +++ b/extraplugins/migration/rhapsody/org.eclipse.papyrus.migration.rhapsody/transform/SysML11InternalBlockDiagram.qvto @@ -51,7 +51,7 @@ mapping rhapsodymetamodel::IDiagram::iDiagramToSysML11InternalBlockDiagram(rpyPr var owner:EObject; var iDiagramOwner:ecore::EObject:=self[EObject].eContainer()![EObject]; if(iDiagramOwner.oclIsKindOf(umlrhapsody::IClass)){ - owner:= iDiagramOwner.resolveIn(umlrhapsody::IClass::toUMLElement, uml::Element)![EObject]; + owner:= iDiagramOwner.resolveIn(ecore::EObject::generalMappingToUMLElement, uml::Element)![EObject]; }; result:=self.map createAndInitDiagram(rpyProject,getPapyrusDiagramType(), owner, owner); } diff --git a/extraplugins/migration/rhapsody/org.eclipse.papyrus.migration.rhapsody/transform/SysML11ParametricDiagram.qvto b/extraplugins/migration/rhapsody/org.eclipse.papyrus.migration.rhapsody/transform/SysML11ParametricDiagram.qvto index 77861625eec..87d64655ad7 100644 --- a/extraplugins/migration/rhapsody/org.eclipse.papyrus.migration.rhapsody/transform/SysML11ParametricDiagram.qvto +++ b/extraplugins/migration/rhapsody/org.eclipse.papyrus.migration.rhapsody/transform/SysML11ParametricDiagram.qvto @@ -43,7 +43,7 @@ mapping rhapsodymetamodel::IDiagram::iDiagramToSysML11ParametricDiagram(rpyProje //2. setting the diagram owner var iDiagramOwner:ecore::EObject:=self[EObject].eContainer()![EObject]; if(iDiagramOwner.oclIsKindOf(umlrhapsody::IClass)){ - owner:= iDiagramOwner.resolveIn(umlrhapsody::IClass::toUMLElement, uml::Element)![EObject]; + owner:= iDiagramOwner.resolveIn(ecore::EObject::generalMappingToUMLElement, uml::Element)![EObject]; }; result:=self.map createAndInitDiagram(rpyProject,getPapyrusDiagramType(), owner, owner); diff --git a/extraplugins/migration/rhapsody/org.eclipse.papyrus.migration.rhapsody/transform/SysML11Profile.qvto b/extraplugins/migration/rhapsody/org.eclipse.papyrus.migration.rhapsody/transform/SysML11Profile.qvto index 3d449fd57d8..8d626ba5085 100644 --- a/extraplugins/migration/rhapsody/org.eclipse.papyrus.migration.rhapsody/transform/SysML11Profile.qvto +++ b/extraplugins/migration/rhapsody/org.eclipse.papyrus.migration.rhapsody/transform/SysML11Profile.qvto @@ -113,7 +113,7 @@ mapping ecore::EObject::applyRequiredSysML11Stereotype() disjuncts mapping ecore::EObject::applyStereotypeFromIClass() when {self.oclIsTypeOf(IClass) /*and not self.oclAsType(IClass).Stereotypes->isEmpty()*/}{ //test on stereotype must be done in the method, because we always need to do some thing for IClass var rpyElement:IClass:=self.oclAsType(IClass); //we look for the created uml element - var umlElement:Element:=rpyElement.resolveoneIn(IClass::toUMLElement, uml::Element); + var umlElement:Element:=rpyElement.resolveoneIn(EObject::generalMappingToUMLElement, uml::Element); if(umlElement<>null){ rpyElement.Stereotypes->selectByType(umlrhapsody::IStereotype)->forEach(current){ umlElement.map applySysML11Stereotype(rpyElement.oclAsType(EObject), getSysML11StereotypeName(current.name)); |