diff options
author | Vincent Lorenzo | 2017-01-25 14:19:55 +0000 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org | 2017-01-25 15:16:59 +0000 |
commit | 8aac176a9446923008485058c3b69c5b72095c69 (patch) | |
tree | 2bceaa8d9bae7b867bd2fe6f817d023321d56474 /extraplugins/migration | |
parent | 3cdf071bddbde309721f0548a0ff87f77b401537 (diff) | |
download | org.eclipse.papyrus-8aac176a9446923008485058c3b69c5b72095c69.tar.gz org.eclipse.papyrus-8aac176a9446923008485058c3b69c5b72095c69.tar.xz org.eclipse.papyrus-8aac176a9446923008485058c3b69c5b72095c69.zip |
Bug 511031: [Importer][Rhapsody] Rhapsody IAttribute declared in a package to represent constant must be imported as UML InstanceSpecification
Change-Id: I169606462754397d265a49585d7793fbd0df33c4
Signed-off-by: Vincent Lorenzo <vincent.lorenzo@cea.fr>
Diffstat (limited to 'extraplugins/migration')
-rwxr-xr-x | extraplugins/migration/rhapsody/org.eclipse.papyrus.migration.rhapsody/transform/Rhapsody2PapyrusSemanticElements.qvto | 38 |
1 files changed, 37 insertions, 1 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 64a18a64712..eec7f778fee 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,6 +116,7 @@ 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); //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[IClass].Associations[IAssociationEnd]->select(assoEnd: IAssociationEnd |not (assoEnd.oclAsType(IAssociationEnd).inverse.oclIsUndefined()))->any(true).map toAssociationswithoutProp(); @@ -136,7 +137,8 @@ mapping umlrhapsody::DefaultSubsystemType::iDefaultSubsystemTypeToPackage():uml: mapping EObject::generalMappingToUMLElement():uml::Element disjuncts EObject::iActorToUMLActor, EObject::iCommentToUMLComment, - EObject::iDescriptionToUMLComment + EObject::iDescriptionToUMLComment, + EObject::iAttributeToInstanceSpecification {} /** @@ -1042,6 +1044,8 @@ mapping umlrhapsody::IVariable::iVariableToUMLElement():uml::Property disjuncts umlrhapsody::IAttribute::iAttributeToUMLElement {} + + mapping umlrhapsody::IArgument::iArgumentToUMLElement(): uml::Property when {self.oclIsTypeOf(umlrhapsody::IArgument)}{ name:= self.oclAsType(IArgument).name.replaceAll("\"",""); // should add the PtR Stereotpe if the type is a C++ Declaration : i,e: Class *; @@ -1053,6 +1057,38 @@ mapping umlrhapsody::IArgument::iArgumentToUMLElement(): uml::Property when {sel }; } +/** +* We map IAttribute declared in the TopLevel class as instance specifications +*/ +helper umlrhapsody::IAttribute::isInstanceSpecification():Boolean{ + var owner:EObject:=self.oclAsType(EObject).eContainer(); + return owner.oclIsKindOf(IClass) and owner.oclAsType(IClass).name="TopLevel"; +} + +/** +* This mapping creates InstanceSpecification from IAttribute +*/ +mapping ecore::EObject::iAttributeToInstanceSpecification(): 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); + var tmp:String:=""; + if(not iAttribute.ValueSpecifications.oclIsUndefined()){ + tmp:=iAttribute.ValueSpecifications.value; + }; + if(classifier->any(true).oclIsTypeOf(Enumeration)){ + specification:=object InstanceValue{ + name:="InstanceValue1"; + instance:=classifier.oclAsType(Enumeration).member->any(name=tmp).oclAsType(InstanceSpecification); + } + }else{ + specification:=object OpaqueExpression{ + body:=tmp; + } + } + +} + mapping umlrhapsody::IAttribute::iAttributeToUMLElement(): uml::Property when {self.oclIsTypeOf(umlrhapsody::IAttribute)}{ name:= self.name.replaceAll("\"",""); // should add the PtR Stereotpe if the type is a C++ Declaration : i,e: Class *; |