| /***************************************************************************** |
| * Copyright (c) 2017 CEA LIST and others. |
| * |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Initial API and implementation |
| *****************************************************************************/ |
| |
| import org.eclipse.papyrus.interoperability.sysml14.sysml.blackboxes.VersioningHelper; |
| |
| modeltype ecore "strict" uses 'http://www.eclipse.org/emf/2002/Ecore'; |
| modeltype UML "strict" uses 'http://www.eclipse.org/uml2/5.0.0/UML'; |
| modeltype SysML11 "strict" uses 'http://www.eclipse.org/papyrus/0.7.0/SysML'; |
| modeltype SysML14 "strict" uses 'http://www.eclipse.org/papyrus/sysml/1.4/SysML'; |
| |
| /** |
| * This file provides useful method for SysML. |
| */ |
| library SysMLUtils; |
| |
| /** |
| * Create the eAnnotation for the versioning with : |
| * <li> |
| * <ul> Source model name </ul> |
| * <ul> Migration date </ul> |
| * <ul> Migration bundle version </ul> |
| * </li> |
| **/ |
| helper UML::Model::createEAnnotationForVersioning() : ecore::EAnnotation{ |
| var versionning:EAnnotation:=object EAnnotation{ |
| source := getEAnnotationSourceNameForVersioning(); |
| details+= object EStringToStringMapEntry{ |
| key := getKeyForSourceModelName(); |
| value := getPapyrusResourceName(self); |
| }; |
| details+= object EStringToStringMapEntry{ |
| key := getKeyForPapyrusMigrationDate(); |
| value := getPapyrusMigrationDate(); |
| }; |
| details+= object EStringToStringMapEntry{ |
| key := getKeyForPapyrusMigrationBundleVersion(); |
| value := getImportBundleSysMLMigrationVersion(); |
| }; |
| }; |
| return versionning; |
| } |
| |
| // This allows to transform the SysML1.1 FlowDirection to SysML1.4 FlowDirection |
| helper getDirection(direction:SysML11::portandflows::FlowDirection) : SysML14::portsandflows::FlowDirection { |
| if(direction = SysML11::portandflows::FlowDirection::_in){ |
| return SysML14::portsandflows::FlowDirection::_in; |
| }elif(direction = SysML11::portandflows::FlowDirection::_out){ |
| return SysML14::portsandflows::FlowDirection::_out; |
| }elif(direction = SysML11::portandflows::FlowDirection::_inout){ |
| return SysML14::portsandflows::FlowDirection::_inout; |
| }; |
| return null; |
| } |
| |
| helper UML::Stereotype::toSysML14Stereotype(stereotypeElements:Set(UML::Stereotype)) : UML::Stereotype { |
| return stereotypeElements->any(curr | curr.name=self.name); |
| } |