| /***************************************************************************** |
| * 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 architecture "strict" uses 'http://www.eclipse.org/papyrus/infra/core/architecture'; |
| 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'; |
| modeltype nattablerepresentation "strict" uses 'http://www.eclipse.org/papyrus/infra/nattable/representation'; |
| |
| |
| transformation SysMLRequirementTable(in sysml14architecture : architecture, 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 Requirement Table"; |
| |
| mapping nattable::Table::fromSysML11RequirementTable() : nattable::Table when {self.tableConfiguration.name = "RequirementTable" and self.tableConfiguration.type = "PapyrusSysMLRequirementTable"} { |
| init{ |
| result := self; |
| } |
| |
| // Create the annotation for versionning |
| var model:UML::Model := umlFile.rootObjects()[uml::Model]->any(true); |
| result.eAnnotations += model.createEAnnotationForVersioning(); |
| |
| var rootReqTableS14 := requirementNatTableS14.rootObjects()->any(true); |
| if (rootReqTableS14.oclIsKindOf(nattable::nattableconfiguration::TableConfiguration)) { |
| tableConfiguration := rootReqTableS14.oclAsType(nattable::nattableconfiguration::TableConfiguration); |
| }; |
| |
| prototype := sysml14architecture.objects()->selectByType(nattablerepresentation::PapyrusTable)->any(curr | curr.name = tableRepresentationKindName).oclAsType(ecore::EObject); |
| |
| 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(); |
| }; |
| }; |
| } |
| |
| 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); |
| } |
| |