| /***************************************************************************** |
| * 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.interoperability.sysml16.sysml14.SysMLTablesUtils; |
| import org.eclipse.papyrus.interoperability.sysml16.sysml14.SysMLUtils; |
| |
| modeltype notation "strict" uses 'http://www.eclipse.org/gmf/runtime/1.0.2/notation'; |
| modeltype UML "strict" uses 'http://www.eclipse.org/uml2/5.0.0/UML'; |
| modeltype ecore "strict" uses 'http://www.eclipse.org/emf/2002/Ecore'; |
| 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'; |
| modeltype nattable "strict" uses 'http://www.eclipse.org/papyrus/nattable/model'; |
| |
| |
| transformation SysMLRequirementTable(in umlFile : UML, in inS16Profile : SysML16, in requirementNatTableS14 : nattable, in allocationNatTableS14 : nattable, in requirementTreeNatTableS14 : nattable, in requirementNatTableS16 : nattable, in allocationNatTableS16 : nattable, in requirementTreeNatTableS16 : nattable, inout notationFile : notation); |
| |
| property rootTableConfigurationS14:nattable::nattableconfiguration::TableConfiguration = requirementNatTableS14.rootObjects()[nattable::nattableconfiguration::TableConfiguration]->any(true); |
| property oldRepresentationKindRequirementTable = "org.eclipse.papyrus.sysml14.table.requirement"; |
| property representationKindRequirementTable = "org.eclipse.papyrus.sysml16.table.requirement"; |
| |
| mapping nattable::Table::fromSysML14RequirementTable() : nattable::Table when {self.tableKindId = oldRepresentationKindRequirementTable} { |
| init{ |
| result := self; |
| } |
| |
| // Create the annotation for versionning |
| var model:UML::Model := umlFile.rootObjects()[uml::Model]->any(true); |
| result.eAnnotations += model.createEAnnotationForVersioning(); |
| |
| var rootReqTableS16 := requirementNatTableS16.rootObjects()->any(true); |
| if (rootReqTableS16.oclIsKindOf(nattable::nattableconfiguration::TableConfiguration)) { |
| tableConfiguration := rootReqTableS16.oclAsType(nattable::nattableconfiguration::TableConfiguration); |
| }; |
| |
| tableKindId := representationKindRequirementTable; |
| |
| rowAxisProvidersHistory->forEach(rowAxisProvider){ |
| if (rowAxisProvider.oclIsKindOf(nattable::nattableaxisprovider::AxisProvider)){ |
| var existingAxis:OrderedSet(nattable::nattableaxis::IAxis) := rowAxisProvider.oclAsType(nattable::nattableaxisprovider::AxisProvider).axis; |
| var axisProvider:nattable::nattableaxisprovider::AxisProvider := rowAxisProvider.oclAsType(nattable::nattableaxisprovider::AxisProvider); |
| axisProvider.axis := object OrderedSet(nattable::nattableaxis::IAxis){}; |
| axisProvider.axis += existingAxis->map fromSysML14AxisToAxis(); |
| }; |
| }; |
| |
| columnAxisProvidersHistory->forEach(columnAxisProvider){ |
| if (columnAxisProvider.oclIsKindOf(nattable::nattableaxisprovider::AxisProvider)){ |
| var existingAxis:OrderedSet(nattable::nattableaxis::IAxis) := columnAxisProvider.oclAsType(nattable::nattableaxisprovider::AxisProvider).axis; |
| var axisProvider:nattable::nattableaxisprovider::AxisProvider := columnAxisProvider.oclAsType(nattable::nattableaxisprovider::AxisProvider); |
| axisProvider.axis := object OrderedSet(nattable::nattableaxis::IAxis){}; |
| axisProvider.axis += existingAxis->map fromSysML14AxisToAxis(); |
| }; |
| }; |
| |
| prototype := null; |
| } |
| |
| mapping nattable::nattableaxis::IAxis::fromSysML14AxisToAxis() : nattable::nattableaxis::IAxis { |
| init{ |
| result := self; |
| } |
| var oldManagerId:String := getAxisManagerID(rootTableConfigurationS14, self.manager).replaceAll("sysml14", "sysml16"); |
| manager := getManagerInS16Configuration(requirementNatTableS16.objects()[nattable::nattableaxisconfiguration::AxisManagerRepresentation], oldManagerId); |
| } |
| |