blob: 528b9654a33d76b69082a94715c4c4645423f3e8 [file] [log] [blame]
/*****************************************************************************
* 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.table.TableBlackboxHelper;
import org.eclipse.papyrus.interoperability.sysml14.sysml.SysMLTablesUtils;
import org.eclipse.papyrus.interoperability.sysml14.sysml.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 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';
modeltype nattable "strict" uses 'http://www.eclipse.org/papyrus/nattable/model';
transformation SysMLAllocationTable(in umlFile : UML, in inS14Profile : SysML14, in requirementNatTableS11 : nattable, in allocationNatTableS11 : nattable, in requirementNatTableS14 : nattable, in allocationNatTableS14 : nattable, inout notationFile : notation);
property rootTableConfigurationS11:nattable::nattableconfiguration::TableConfiguration = requirementNatTableS11.rootObjects()[nattable::nattableconfiguration::TableConfiguration]->any(true);
property tableRepresentationKindName:String = "SysML 1.4 Allocation Table";
property representationKindAllocationTable = "org.eclipse.papyrus.sysml14.table.allocation";
mapping nattable::Table::fromSysML11AllocationTable() : nattable::Table when {self.tableConfiguration.name = "AllocationTable" and self.tableConfiguration.type = "PapyrusSysMLAllocationTable"} {
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 rootAllocationTableS14 := allocationNatTableS14.rootObjects()->any(true);
if (rootAllocationTableS14.oclIsKindOf(nattable::nattableconfiguration::TableConfiguration)) {
tableConfiguration := rootAllocationTableS14.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 fromSysML11AxisToAxis();
};
};
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 fromSysML11AxisToAxis();
};
};
prototype := null;
}
mapping nattable::nattableaxis::IAxis::fromSysML11AxisToAxis() : nattable::nattableaxis::IAxis {
init{
result := self;
}
var tmpManager := getAxisManager(rootTableConfigurationS11, self.manager);
manager := getManagerInS14Configuration(requirementNatTableS14.objects()[nattable::nattableaxisconfiguration::AxisManagerRepresentation], tmpManager);
}