blob: 3f27163d442c7d7c12fdb978d5460eb9ff338989 [file] [log] [blame]
/*****************************************************************************
* 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 SysMLAllocationTable(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 = allocationNatTableS14.rootObjects()[nattable::nattableconfiguration::TableConfiguration]->any(true);
property oldRepresentationKindAllocationTable = "org.eclipse.papyrus.sysml14.table.allocation";
property representationKindAllocationTable = "org.eclipse.papyrus.sysml16.table.allocation";
mapping nattable::Table::fromSysML14AllocationTable() : nattable::Table when {self.tableKindId = oldRepresentationKindAllocationTable} {
init{
result := self;
}
// Create the annotation for versionning
var model:UML::Model := umlFile.rootObjects()[uml::Model]->any(true);
result.eAnnotations += model.createEAnnotationForVersioning();
tableKindId := representationKindAllocationTable;
var rootAllocationTableS16 := allocationNatTableS16.rootObjects()->any(true);
if (rootAllocationTableS16.oclIsKindOf(nattable::nattableconfiguration::TableConfiguration)) {
tableConfiguration := rootAllocationTableS16.oclAsType(nattable::nattableconfiguration::TableConfiguration);
};
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(allocationNatTableS16.objects()[nattable::nattableaxisconfiguration::AxisManagerRepresentation], oldManagerId);
}