| /***************************************************************************** |
| * Copyright (c) 2019 CEA LIST, and others. |
| * |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License 2.0 |
| * which accompanies this distribution, and is available at |
| * https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Initial API and implementation |
| * |
| *****************************************************************************/ |
| |
| import org.eclipse.papyrus.uml.m2m.qvto.common.blackboxes.emf.EMFResource; |
| import org.eclipse.papyrus.interoperability.sysml16.sysml14.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 SysML14 "strict" uses 'http://www.eclipse.org/papyrus/sysml/1.4/SysML'; |
| modeltype SysML16 "strict" uses 'http://www.eclipse.org/papyrus/sysml/1.6/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.4 FlowDirection to SysML1.6 FlowDirectionKind |
| helper getDirection(direction:SysML14::portsandflows::FlowDirection) : SysML16::portsandflows::FlowDirectionKind { |
| if(direction = SysML14::portsandflows::FlowDirection::_in){ |
| return SysML16::portsandflows::FlowDirectionKind::_in; |
| }elif(direction = SysML14::portsandflows::FlowDirection::_out){ |
| return SysML16::portsandflows::FlowDirectionKind::_out; |
| }elif(direction = SysML14::portsandflows::FlowDirection::_inout){ |
| return SysML16::portsandflows::FlowDirectionKind::_inout; |
| }; |
| return null; |
| } |
| |
| // This allows to transform the SysML1.4 FeatureDirection to SysML1.6 FeatureDirectionKind |
| helper getDirection(direction:SysML14::portsandflows::FeatureDirection) : SysML16::portsandflows::FeatureDirectionKind { |
| if(direction = SysML14::portsandflows::FeatureDirection::provided){ |
| return SysML16::portsandflows::FeatureDirectionKind::provided; |
| }elif(direction = SysML14::portsandflows::FeatureDirection::providedRequired){ |
| return SysML16::portsandflows::FeatureDirectionKind::providedRequired; |
| }elif(direction = SysML14::portsandflows::FeatureDirection::required){ |
| return SysML16::portsandflows::FeatureDirectionKind::required; |
| }; |
| return null; |
| } |