blob: 80c07fe16baa115cbeb003bcba4bf9a6dfee8b96 [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.uml.m2m.qvto.common.blackboxes.ecore.EcoreHelper;
import org.eclipse.papyrus.interoperability.sysml14.sysml.blackboxes.notation.NotationBlackboxHelper;
import org.eclipse.papyrus.interoperability.sysml14.sysml.SysMLDiagramsUtils;
import org.eclipse.papyrus.interoperability.sysml14.sysml.SysMLDiagramsConstants;
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 viewpoint "strict" uses 'http://www.eclipse.org/papyrus/infra/viewpoints/configuration';
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 SysMLBlockDefinitionDiagram(in blockDefinitionViewpoint : viewpoint, in internalBlockViewpoint : viewpoint, in parametricViewpoint : viewpoint, in requirementViewpoint : viewpoint, in umlFile : UML, in inS14Profile : SysML14, in requirementNatTableS11 : nattable, in allocationNatTableS11 : nattable, in requirementNatTableS14 : nattable, in allocationNatTableS14 : nattable, in requirementTableViewPoint : viewpoint, in allocationTableViewPoint : viewpoint, inout notationFile : notation);
// Define needed constants
property diagramName:String = "BlockDefinition";
property diagramConfigurationName:String = "SysML 1.4 Block Definition";
property model:UML::Model = umlFile.rootObjects()[uml::Model]->any(true);
property rootDiagram:notation::Diagram;
property childrenToRemove:OrderedSet(notation::View);
mapping notation::Diagram::fromSysML11BlockDefinitionDiagram() : notation::Diagram when {self.type=diagramName} {
init{
var existingChildren:OrderedSet(notation::Node) := self.children;
var existingEdges:OrderedSet(notation::Edge) := self.edges;
result := self;
rootDiagram := result;
result.edges := object OrderedSet(notation::Edge){};
result.edges := existingEdges->map fromSysML11Edge();
result.children := object OrderedSet(notation::Node){};
result.children := existingChildren->map fromSysML11Shape(result);
}
type := "PapyrusUMLClassDiagram";
// Create the annotation for versionning
var model:UML::Model := umlFile.rootObjects()[uml::Model]->any(true);
result.eAnnotations += model.createEAnnotationForVersioning();
// Modify or create the compatibility version
setOrCreateCompatibilityVersion(result);
// Add the viewpoint configuration to the papyrus view style
addPapyrusViewStyleConfiguration(result, model, getBlockDefinitionPapyrusDiagramConfiguration());
// Remove the needed children
childrenToRemove->forEach(childToRemove){
var parent:ecore::EObject := childToRemove.oclAsType(ecore::EObject).eContainer();
if (parent.oclIsKindOf(notation::View)) {
var parentView:notation::View := parent.oclAsType(notation::View);
removeFromOwnerView(parentView, childToRemove);
};
};
}
// Get the requirement papyrus diagram configuration from the viewpoint file
helper getBlockDefinitionPapyrusDiagramConfiguration() : viewpoint::PapyrusDiagram {
return blockDefinitionViewpoint.objects()->selectByType(viewpoint::PapyrusDiagram)->any(curr | curr.name = diagramConfigurationName);
}
// Nodes ans shapes management
mapping notation::Node::fromSysML11Shape(parent:notation::View) : notation::Node disjuncts
notation::BasicCompartment::fromSysML11BasicCompartment,
notation::DecorationNode::fromSysML11DecorationNode,
notation::Shape::fromSysML11StereotypeComment,
notation::Shape::fromSysML11ActorAsClass,
notation::Shape::fromSysML11AffixedPortAsAffixedPort,
notation::Shape::fromSysML11BlockAsClass,
notation::Shape::fromSysML11ConstraintBlockAsClass,
notation::Shape::fromSysML11DataTypeAsDataType,
notation::Shape::fromSysML11DimensionAsInstanceSpecification,
notation::Shape::fromSysML11EnumerationAsEnumeration,
notation::Shape::fromSysML11FlowSpecificationAsClass,
notation::Shape::fromSysML11InterfaceAsInterface,
notation::Shape::fromSysML11PackageShapeAsModel, // Must be done before PackageShapeAsPackage
notation::Shape::fromSysML11PackageShapeAsPackage,
notation::Shape::fromSysML11PrimitiveTypeAsPrimitiveType,
notation::Shape::fromSysML11SignalAsSignal,
notation::Shape::fromSysML11UnitAsInstanceSpecification,
notation::Shape::fromSysML11ValueTypeAsDataType,
notation::Shape::fromSysML11DefaultShape,
notation::Node::fromSysML11EnumerationLiteralAsEnumerationLiteral,
notation::Node::fromSysML11OperationAsOperation,
notation::Node::fromSysML11PropertyAsProperty,
notation::Node::fromSysML11ReceptionAsReception
{}
mapping notation::Shape::fromSysML11ActorAsClass(parent:notation::View) : notation::Shape when {self.oclIsTypeOf(notation::Shape) and self.type = ACTOR_AS_CLASSIFIER_SYSML11} {
init {
result := self;
}
// Remove the existing children
var existingChildren:OrderedSet(notation::Node) := self.children;
children := object OrderedSet(notation::Node){};
var isCN:Boolean := not parent.oclIsTypeOf(notation::Diagram);
var isClassNameDecorationNodeExist:Boolean := false;
var isAttributeCompartmentExist:Boolean := false;
var isOperationCompartmentExist:Boolean := false;
var isShapeCompartmentExist:Boolean := false;
// Loop on existing children to map with the new correct type
existingChildren->forEach(existingChild){
if (existingChild.type = NAMEDELEMENT_LABEL_DECORATIONNODE_SYSML11) {
if (isCN) {
existingChild.type := CLASS_NAME_LABEL_DECORATIONNODE_CN_SYSML14;
} else {
existingChild.type := CLASS_NAME_LABEL_DECORATIONNODE_SYSML14;
};
setPapyrusCSSForceValueVisible(existingChild, TRUE);
isClassNameDecorationNodeExist := true;
children += existingChild;
} elif (existingChild.type = PROPERTY_UML_COMPARTMENT_SYSML11) {
if (isCN) {
existingChild.type := CLASS_ATTRIBUTE_COMPARTMENT_CN_SYSML14;
} else {
existingChild.type := CLASS_ATTRIBUTE_COMPARTMENT_SYSML14;
};
setPapyrusCSSForceValueVisible(existingChild, TRUE);
setShowTitle(existingChild, true);
// Calculate the new children
existingChild.children := existingChild.children->map fromSysML11Shape(result);
isAttributeCompartmentExist := true;
children += existingChild;
} elif (existingChild.type = OPERATION_UML_COMPARTMENT_SYSML11) {
if (isCN) {
existingChild.type := CLASS_OPERATION_COMPARTMENT_CN_SYSML14;
} else {
existingChild.type := CLASS_OPERATION_COMPARTMENT_SYSML14;
};
setPapyrusCSSForceValueVisible(existingChild, TRUE);
setShowTitle(existingChild, true);
// Calculate the new children
existingChild.children := existingChild.children->map fromSysML11Shape(result);
isOperationCompartmentExist := true;
children += existingChild;
} elif (existingChild.type = COMPARTMENT_SHAPE_DISPLAY) {
isShapeCompartmentExist := true;
children += existingChild;
};
};
// If the shape is not in the diagram, this is a Child node
if (not isCN) {
type := CLASS_SHAPE_SYSML14;
if(not isClassNameDecorationNodeExist){
children += createDefaultFloatingNameLabelDecorationNode(CLASS_NAME_LABEL_DECORATIONNODE_SYSML14);
};
children += createDefaultFloatingNameLabelDecorationNode(CLASS_FLOATING_LABEL_DECORATIONNODE_SYSML14);
if(not isAttributeCompartmentExist){
children += createDefaultBasicCompartement(CLASS_ATTRIBUTE_COMPARTMENT_SYSML14);
};
if(not isOperationCompartmentExist){
children += createDefaultBasicCompartement(CLASS_OPERATION_COMPARTMENT_SYSML14);
};
children += createDefaultBasicCompartement(CLASS_NESTEDCLASSIFIER_COMPARTMENT_SYSML14);
} else {
type := CLASS_SHAPE_CN_SYSML14;
if(not isClassNameDecorationNodeExist){
children += createDefaultFloatingNameLabelDecorationNode(CLASS_NAME_LABEL_DECORATIONNODE_CN_SYSML14);
};
children += createDefaultFloatingNameLabelDecorationNode(CLASS_FLOATING_LABEL_DECORATIONNODE_CN_SYSML14);
if(not isAttributeCompartmentExist){
children += createDefaultBasicCompartement(CLASS_ATTRIBUTE_COMPARTMENT_CN_SYSML14);
};
if(not isOperationCompartmentExist){
children += createDefaultBasicCompartement(CLASS_OPERATION_COMPARTMENT_CN_SYSML14);
};
children += createDefaultBasicCompartement(CLASS_NESTEDCLASSIFIER_COMPARTMENT_CN_SYSML14);
};
children += createDefaultCompartement(FLOWPORTS_COMPARTMENT_SYSML14);
children += createDefaultCompartement(CONSTRAINTS_COMPARTMENT_SYSML14);
children += createDefaultCompartement(PARTS_COMPARTMENT_SYSML14);
children += createDefaultCompartement(PROXYPORTS_COMPARTMENT_SYSML14);
children += createDefaultCompartement(FULLPORTS_COMPARTMENT_SYSML14);
children += createDefaultCompartement(REFERENCES_COMPARTMENT_SYSML14);
children += createDefaultCompartement(FLOWPROPERTIES_COMPARTMENT_SYSML14);
children += createDefaultCompartement(PARAMETERS_COMPARTMENT_SYSML14);
children += existingChildren[notation::DecorationNode]->any(curr | curr.type = STEREOTYPE_LABEL_DECORATION_NODE)->map fromSysML11StereotypeLabel(result);
children += existingChildren[notation::BasicCompartment]->any(curr | curr.type = STEREOTYPE_BRACE_COMPARTMENT)->map fromSysML11StereotypeBraceAndCompartment(result);
children += existingChildren[notation::BasicCompartment]->any(curr | curr.type = STEREOTYPE_COMPARTMENT_COMPARTMENT)->map fromSysML11StereotypeBraceAndCompartment(result);
}
mapping notation::Shape::fromSysML11AffixedPortAsAffixedPort(parent:notation::View) : notation::Shape when {self.oclIsTypeOf(notation::Shape) and ((self.type = PORT_AS_AFFIXED_SYSML11) or (self.type = FLOWPORT_AS_AFFIXED_SYSML11))} {
init {
result := self;
}
// Remove the existing children
var existingChildren:OrderedSet(notation::Node) := self.children;
children := object OrderedSet(notation::Node){};
var isBorderItemLabelDecorationNodeExist:Boolean := false;
// Loop on existing children to map with the new correct type
existingChildren->forEach(existingChild){
if (existingChild.type = AFFIXED_PORT_LABEL_DECORATIONNODE_SYSML11) {
existingChild.type := OPERATION_BODERITEM_LABEL_COMPARTMENT_SYSML14;
setPapyrusCSSForceValueVisible(existingChild, TRUE);
isBorderItemLabelDecorationNodeExist := true;
children += existingChild;
} elif (existingChild.type = AFFIXED_FLOWPORT_LABEL_DECORATIONNODE_SYSML11) {
existingChild.type := OPERATION_BODERITEM_LABEL_COMPARTMENT_SYSML14;
setPapyrusCSSForceValueVisible(existingChild, TRUE);
isBorderItemLabelDecorationNodeExist := true;
children += existingChild;
};
};
// If the shape is not in the diagram, this is a Child node
type := CLASS_PORT_SYSML14;
if(not isBorderItemLabelDecorationNodeExist){
var borderItemLabel:notation::DecorationNode := createDefaultFloatingNameLabelDecorationNode(OPERATION_BODERITEM_LABEL_COMPARTMENT_SYSML14);
borderItemLabel.layoutConstraint.oclAsType(notation::Location).x := 25;
borderItemLabel.layoutConstraint.oclAsType(notation::Location).y := 3;
children += borderItemLabel;
};
}
mapping notation::Shape::fromSysML11BlockAsClass(parent:notation::View) : notation::Shape when {self.oclIsTypeOf(notation::Shape) and self.type = BLOCK_AS_CLASSIFIER_SYSML11} {
init {
result := self;
}
// Remove the existing children
var existingChildren:OrderedSet(notation::Node) := self.children;
children := object OrderedSet(notation::Node){};
var isCN:Boolean := not parent.oclIsTypeOf(notation::Diagram);
var isClassNameDecorationNodeExist:Boolean := false;
var isAttributeCompartmentExist:Boolean := false;
var isOperationCompartmentExist:Boolean := false;
var isPartsCompartmentExist:Boolean := false;
var isReferencesCompartmentExist:Boolean := false;
var isFlowPortsCompartmentExist:Boolean := false;
var isConstraintsCompartmentExist:Boolean := false;
var isFullPortsCompartmentExist:Boolean := false;
// Loop on existing children to map with the new correct type
existingChildren->forEach(existingChild){
if (existingChild.type = LABEL_BLOCK_COMPARTMENT_SYSML11) {
if (isCN) {
existingChild.type := CLASS_NAME_LABEL_DECORATIONNODE_CN_SYSML14;
} else {
existingChild.type := CLASS_NAME_LABEL_DECORATIONNODE_SYSML14;
};
setPapyrusCSSForceValueVisible(existingChild, TRUE);
isClassNameDecorationNodeExist := true;
children += existingChild;
} elif (existingChild.type = PROPERTY_SYSML_COMPARTMENT_SYSML11) {
if (isCN) {
existingChild.type := CLASS_ATTRIBUTE_COMPARTMENT_CN_SYSML14;
} else {
existingChild.type := CLASS_ATTRIBUTE_COMPARTMENT_SYSML14;
};
setPapyrusCSSForceValueVisible(existingChild, TRUE);
setShowTitle(existingChild, true);
// Calculate the new children
existingChild.children := existingChild.children->map fromSysML11Shape(result);
isAttributeCompartmentExist := true;
children += existingChild;
} elif (existingChild.type = OPERATION_UML_COMPARTMENT_SYSML11) {
if (isCN) {
existingChild.type := CLASS_OPERATION_COMPARTMENT_CN_SYSML14;
} else {
existingChild.type := CLASS_OPERATION_COMPARTMENT_SYSML14;
};
setPapyrusCSSForceValueVisible(existingChild, TRUE);
setShowTitle(existingChild, true);
// Calculate the new children
existingChild.children := existingChild.children->map fromSysML11Shape(result);
isOperationCompartmentExist := true;
children += existingChild;
} elif (existingChild.type = COMPARTMENT_SHAPE_DISPLAY) {
children += existingChild;
} elif (existingChild.type = PART_COMPARTMENT_SYSML11) {
var createPartsCompartment:notation::Compartment := createDefaultCompartement(PARTS_COMPARTMENT_SYSML14);
isPartsCompartmentExist := true;
// Check if the title EAnnotation exist, if this is the case, modify the show title
createPartsCompartment.eAnnotations += manageShowTitleEAnnotationAsCompartmentAttribute(createPartsCompartment, existingChild);
createPartsCompartment.children := existingChild.children->map fromSysML11Shape(result);
children += createPartsCompartment;
} elif (existingChild.type = REFERENCE_COMPARTMENT_SYSML11) {
var createReferencesCompartment:notation::Compartment := createDefaultCompartement(REFERENCES_COMPARTMENT_SYSML14);
isReferencesCompartmentExist := true;
// Check if the title EAnnotation exist, if this is the case, modify the show title
createReferencesCompartment.eAnnotations += manageShowTitleEAnnotationAsCompartmentAttribute(createReferencesCompartment, existingChild);
createReferencesCompartment.children := existingChild.children->map fromSysML11Shape(result);
children += createReferencesCompartment;
} elif (existingChild.type = FLOWPORT_COMPARTMENT_SYSML11) {
var createFlowPortsCompartment:notation::Compartment := createDefaultCompartement(FLOWPORTS_COMPARTMENT_SYSML14);
isFlowPortsCompartmentExist := true;
// Check if the title EAnnotation exist, if this is the case, modify the show title
createFlowPortsCompartment.eAnnotations += manageShowTitleEAnnotationAsCompartmentAttribute(createFlowPortsCompartment, existingChild);
createFlowPortsCompartment.children := existingChild.children->map fromSysML11Shape(result);
children += createFlowPortsCompartment;
} elif (existingChild.type = CONSTRAINT_COMPARTMENT_SYSML11) {
var createConstraintsCompartment:notation::Compartment := createDefaultCompartement(CONSTRAINTS_COMPARTMENT_SYSML14);
isConstraintsCompartmentExist := true;
// Check if the title EAnnotation exist, if this is the case, modify the show title
createConstraintsCompartment.eAnnotations += manageShowTitleEAnnotationAsCompartmentAttribute(createConstraintsCompartment, existingChild);
createConstraintsCompartment.children := existingChild.children->map fromSysML11Shape(result);
children += createConstraintsCompartment;
} elif (existingChild.type = PORTS_COMPARTMENT_SYSML11) {
var createConstraintsCompartment:notation::Compartment := createDefaultCompartement(FULLPORTS_COMPARTMENT_SYSML14);
isFullPortsCompartmentExist := true;
// Check if the title EAnnotation exist, if this is the case, modify the show title
createConstraintsCompartment.eAnnotations += manageShowTitleEAnnotationAsCompartmentAttribute(createConstraintsCompartment, existingChild);
createConstraintsCompartment.children := existingChild.children->map fromSysML11Shape(result);
children += createConstraintsCompartment;
};
};
// If the shape is not in the diagram, this is a Child node
if (not isCN) {
type := CLASS_SHAPE_SYSML14;
if(not isClassNameDecorationNodeExist){
children += createDefaultNameLabelDecorationNode(CLASS_NAME_LABEL_DECORATIONNODE_SYSML14);
};
children += createDefaultFloatingNameLabelDecorationNode(CLASS_FLOATING_LABEL_DECORATIONNODE_SYSML14);
if(not isAttributeCompartmentExist){
children += createDefaultBasicCompartement(CLASS_ATTRIBUTE_COMPARTMENT_SYSML14);
};
if(not isOperationCompartmentExist){
children += createDefaultBasicCompartement(CLASS_OPERATION_COMPARTMENT_SYSML14);
};
children += createDefaultBasicCompartement(CLASS_NESTEDCLASSIFIER_COMPARTMENT_SYSML14);
} else {
type := CLASS_SHAPE_CN_SYSML14;
if(not isClassNameDecorationNodeExist){
children += createDefaultNameLabelDecorationNode(CLASS_NAME_LABEL_DECORATIONNODE_CN_SYSML14);
};
children += createDefaultFloatingNameLabelDecorationNode(CLASS_FLOATING_LABEL_DECORATIONNODE_CN_SYSML14);
if(not isAttributeCompartmentExist){
children += createDefaultBasicCompartement(CLASS_ATTRIBUTE_COMPARTMENT_CN_SYSML14);
};
if(not isOperationCompartmentExist){
children += createDefaultBasicCompartement(CLASS_OPERATION_COMPARTMENT_CN_SYSML14);
};
children += createDefaultBasicCompartement(CLASS_NESTEDCLASSIFIER_COMPARTMENT_CN_SYSML14);
};
if(not isFlowPortsCompartmentExist){
children += createDefaultCompartement(FLOWPORTS_COMPARTMENT_SYSML14);
};
if(not isConstraintsCompartmentExist){
var constraintsCompartment:notation::Compartment := createDefaultCompartement(CONSTRAINTS_COMPARTMENT_SYSML14);
constraintsCompartment.visible := false;
children += constraintsCompartment;
};
if(not isPartsCompartmentExist){
children += createDefaultCompartement(PARTS_COMPARTMENT_SYSML14);
};
children += createDefaultCompartement(PROXYPORTS_COMPARTMENT_SYSML14);
if(not isFullPortsCompartmentExist){
children += createDefaultCompartement(FULLPORTS_COMPARTMENT_SYSML14);
};
if(not isReferencesCompartmentExist){
children += createDefaultCompartement(REFERENCES_COMPARTMENT_SYSML14);
};
children += createDefaultCompartement(FLOWPROPERTIES_COMPARTMENT_SYSML14);
children += createDefaultCompartement(PARAMETERS_COMPARTMENT_SYSML14);
children += existingChildren[notation::DecorationNode]->any(curr | curr.type = STEREOTYPE_LABEL_DECORATION_NODE)->map fromSysML11StereotypeLabel(result);
// If the stereotype label decoration node and stereotype brace basic compartment are not available, create it
if(result.children[notation::DecorationNode]->any(curr | curr.type = STEREOTYPE_LABEL_DECORATION_NODE).oclIsUndefined()){
createStereotypeLabelDecorationNode(result, BLOCK_STEREOTYPE_QN);
};
children += existingChildren[notation::BasicCompartment]->any(curr | curr.type = STEREOTYPE_BRACE_COMPARTMENT)->map fromSysML11StereotypeBraceAndCompartment(result);
if(result.children[notation::BasicCompartment]->any(curr | curr.type = STEREOTYPE_BRACE_COMPARTMENT).oclIsUndefined()){
createStereotypeBraceBasicCompartment(result, BLOCK_STEREOTYPE_QN);
};
children += existingChildren[notation::BasicCompartment]->any(curr | curr.type = STEREOTYPE_COMPARTMENT_COMPARTMENT)->map fromSysML11StereotypeBraceAndCompartment(result);
// Manage affixed ports
children += existingChildren[notation::Shape]->map fromSysML11AffixedPortAsAffixedPort(result);
}
mapping notation::Shape::fromSysML11ConstraintBlockAsClass(parent:notation::View) : notation::Shape when {self.oclIsTypeOf(notation::Shape) and self.type = CONSTRAINTBLOCK_AS_CLASSIFIER_SYSML11} {
init {
result := self;
}
// Remove the existing children
var existingChildren:OrderedSet(notation::Node) := self.children;
children := object OrderedSet(notation::Node){};
var isCN:Boolean := not parent.oclIsTypeOf(notation::Diagram);
var isClassNameDecorationNodeExist:Boolean := false;
var isParametersCompartmentExist:Boolean := false;
var isConstraintsCompartmentExist:Boolean := false;
// Loop on existing children to map with the new correct type
existingChildren->forEach(existingChild){
if (existingChild.type = CONTRAINTBLOCK_LABEL_DECORATIONNODE_SYSML11) {
if (isCN) {
existingChild.type := CLASS_NAME_LABEL_DECORATIONNODE_CN_SYSML14;
} else {
existingChild.type := CLASS_NAME_LABEL_DECORATIONNODE_SYSML14;
};
setPapyrusCSSForceValueVisible(existingChild, TRUE);
isClassNameDecorationNodeExist := true;
children += existingChild;
} elif (existingChild.type = COMPARTMENT_SHAPE_DISPLAY) {
children += existingChild;
} elif (existingChild.type = PARAMETER_COMPARTMENT_SYSML11) {
var createParametersCompartment:notation::Compartment := createDefaultCompartement(PARAMETERS_COMPARTMENT_SYSML14);
isParametersCompartmentExist := true;
// Check if the title EAnnotation exist, if this is the case, modify the show title
createParametersCompartment.eAnnotations += manageShowTitleEAnnotationAsCompartmentAttribute(createParametersCompartment, existingChild);
createParametersCompartment.children := existingChild.children->map fromSysML11Shape(result);
children += createParametersCompartment;
} elif (existingChild.type = CONSTRAINT_COMPARTMENT_SYSML11) {
var createConstraintsCompartment:notation::Compartment := createDefaultCompartement(CONSTRAINTS_COMPARTMENT_SYSML14);
isConstraintsCompartmentExist := true;
// Check if the title EAnnotation exist, if this is the case, modify the show title
createConstraintsCompartment.eAnnotations += manageShowTitleEAnnotationAsCompartmentAttribute(createConstraintsCompartment, existingChild);
createConstraintsCompartment.children := existingChild.children->map fromSysML11Shape(result);
children += createConstraintsCompartment;
};
};
// If the shape is not in the diagram, this is a Child node
if (not isCN) {
type := CLASS_SHAPE_SYSML14;
if(not isClassNameDecorationNodeExist){
children += createDefaultNameLabelDecorationNode(CLASS_NAME_LABEL_DECORATIONNODE_SYSML14);
};
children += createDefaultFloatingNameLabelDecorationNode(CLASS_FLOATING_LABEL_DECORATIONNODE_SYSML14);
children += createDefaultBasicCompartement(CLASS_ATTRIBUTE_COMPARTMENT_SYSML14);
children += createDefaultBasicCompartement(CLASS_OPERATION_COMPARTMENT_SYSML14);
children += createDefaultBasicCompartement(CLASS_NESTEDCLASSIFIER_COMPARTMENT_SYSML14);
} else {
type := CLASS_SHAPE_CN_SYSML14;
if(not isClassNameDecorationNodeExist){
children += createDefaultNameLabelDecorationNode(CLASS_NAME_LABEL_DECORATIONNODE_CN_SYSML14);
};
children += createDefaultFloatingNameLabelDecorationNode(CLASS_FLOATING_LABEL_DECORATIONNODE_CN_SYSML14);
children += createDefaultBasicCompartement(CLASS_ATTRIBUTE_COMPARTMENT_CN_SYSML14);
children += createDefaultBasicCompartement(CLASS_OPERATION_COMPARTMENT_CN_SYSML14);
children += createDefaultBasicCompartement(CLASS_NESTEDCLASSIFIER_COMPARTMENT_CN_SYSML14);
};
children += createDefaultCompartement(FLOWPORTS_COMPARTMENT_SYSML14);
if(not isConstraintsCompartmentExist){
children += createDefaultCompartement(CONSTRAINTS_COMPARTMENT_SYSML14);
};
children += createDefaultCompartement(PARTS_COMPARTMENT_SYSML14);
children += createDefaultCompartement(PROXYPORTS_COMPARTMENT_SYSML14);
children += createDefaultCompartement(FULLPORTS_COMPARTMENT_SYSML14);
children += createDefaultCompartement(REFERENCES_COMPARTMENT_SYSML14);
children += createDefaultCompartement(FLOWPROPERTIES_COMPARTMENT_SYSML14);
if(not isParametersCompartmentExist){
children += createDefaultCompartement(PARAMETERS_COMPARTMENT_SYSML14);
};
children += existingChildren[notation::DecorationNode]->any(curr | curr.type = STEREOTYPE_LABEL_DECORATION_NODE)->map fromSysML11StereotypeLabel(result);
// If the stereotype label decoration node and stereotype brace basic compartment are not available, create it
if(result.children[notation::DecorationNode]->any(curr | curr.type = STEREOTYPE_LABEL_DECORATION_NODE).oclIsUndefined()){
createStereotypeLabelDecorationNode(result, CONSTRAINTBLOCK_STEREOTYPE_QN);
};
children += existingChildren[notation::BasicCompartment]->any(curr | curr.type = STEREOTYPE_BRACE_COMPARTMENT)->map fromSysML11StereotypeBraceAndCompartment(result);
if(result.children[notation::BasicCompartment]->any(curr | curr.type = STEREOTYPE_BRACE_COMPARTMENT).oclIsUndefined()){
createStereotypeBraceBasicCompartment(result, CONSTRAINTBLOCK_STEREOTYPE_QN);
};
children += existingChildren[notation::BasicCompartment]->any(curr | curr.type = STEREOTYPE_COMPARTMENT_COMPARTMENT)->map fromSysML11StereotypeBraceAndCompartment(result);
// Manage affixed ports
children += existingChildren[notation::Shape]->map fromSysML11AffixedPortAsAffixedPort(result);
}
mapping notation::Shape::fromSysML11DataTypeAsDataType(parent:notation::View) : notation::Shape when {self.oclIsTypeOf(notation::Shape) and self.type = DATATYPE_AS_CLASSIFIER_SYSML11} {
init {
result := self;
}
// Remove the existing children
var existingChildren:OrderedSet(notation::Node) := self.children;
children := object OrderedSet(notation::Node){};
var isCN:Boolean := not parent.oclIsTypeOf(notation::Diagram);
var isClassNameDecorationNodeExist:Boolean := false;
var isAttributeCompartmentExist:Boolean := false;
var isOperationCompartmentExist:Boolean := false;
// Loop on existing children to map with the new correct type
existingChildren->forEach(existingChild){
if (existingChild.type = NAMEDELEMENT_LABEL_DECORATIONNODE_SYSML11) {
if (isCN) {
existingChild.type := DATATYPE_NAME_LABEL_DECORATIONNODE_CN_SYSML14;
} else {
existingChild.type := DATATYPE_NAME_LABEL_DECORATIONNODE_SYSML14;
};
setPapyrusCSSForceValueVisible(existingChild, TRUE);
isClassNameDecorationNodeExist := true;
children += existingChild;
} elif (existingChild.type = PROPERTY_UML_COMPARTMENT_SYSML11) {
if (isCN) {
existingChild.type := DATATYPE_ATTRIBUTE_COMPARTMENT_CN_SYSML14;
} else {
existingChild.type := DATATYPE_ATTRIBUTE_COMPARTMENT_SYSML14;
};
setPapyrusCSSForceValueVisible(existingChild, TRUE);
setShowTitle(existingChild, true);
// Calculate the new children
existingChild.children := existingChild.children->map fromSysML11Shape(result);
isAttributeCompartmentExist := true;
children += existingChild;
} elif (existingChild.type = OPERATION_UML_COMPARTMENT_SYSML11) {
if (isCN) {
existingChild.type := DATATYPE_OPERATION_COMPARTMENT_CN_SYSML14;
} else {
existingChild.type := DATATYPE_OPERATION_COMPARTMENT_SYSML14;
};
setPapyrusCSSForceValueVisible(existingChild, TRUE);
setShowTitle(existingChild, true);
// Calculate the new children
existingChild.children := existingChild.children->map fromSysML11Shape(result);
isOperationCompartmentExist := true;
children += existingChild;
} elif (existingChild.type = COMPARTMENT_SHAPE_DISPLAY) {
children += existingChild;
};
};
// If the shape is not in the diagram, this is a Child node
if (not isCN) {
type := DATATYPE_SHAPE_SYSML14;
if(not isClassNameDecorationNodeExist){
children += createDefaultFloatingNameLabelDecorationNode(DATATYPE_NAME_LABEL_DECORATIONNODE_SYSML14);
};
children += createDefaultFloatingNameLabelDecorationNode(DATATYPE_FLOATING_LABEL_DECORATIONNODE_SYSML14);
if(not isAttributeCompartmentExist){
children += createDefaultBasicCompartement(DATATYPE_ATTRIBUTE_COMPARTMENT_SYSML14);
};
if(not isOperationCompartmentExist){
children += createDefaultBasicCompartement(DATATYPE_OPERATION_COMPARTMENT_SYSML14);
};
} else {
type := DATATYPE_SHAPE_CN_SYSML14;
if(not isClassNameDecorationNodeExist){
children += createDefaultFloatingNameLabelDecorationNode(DATATYPE_NAME_LABEL_DECORATIONNODE_CN_SYSML14);
};
children += createDefaultFloatingNameLabelDecorationNode(DATATYPE_FLOATING_LABEL_DECORATIONNODE_CN_SYSML14);
if(not isAttributeCompartmentExist){
children += createDefaultBasicCompartement(DATATYPE_ATTRIBUTE_COMPARTMENT_CN_SYSML14);
};
if(not isOperationCompartmentExist){
children += createDefaultBasicCompartement(DATATYPE_OPERATION_COMPARTMENT_CN_SYSML14);
};
};
children += existingChildren[notation::DecorationNode]->any(curr | curr.type = STEREOTYPE_LABEL_DECORATION_NODE)->map fromSysML11StereotypeLabel(result);
children += existingChildren[notation::BasicCompartment]->any(curr | curr.type = STEREOTYPE_BRACE_COMPARTMENT)->map fromSysML11StereotypeBraceAndCompartment(result);
children += existingChildren[notation::BasicCompartment]->any(curr | curr.type = STEREOTYPE_COMPARTMENT_COMPARTMENT)->map fromSysML11StereotypeBraceAndCompartment(result);
}
mapping notation::Shape::fromSysML11DimensionAsInstanceSpecification(parent:notation::View) : notation::Shape when {self.oclIsTypeOf(notation::Shape) and self.type = DIMENSION_AS_CLASSIFIER_SYSML11} {
init {
result := self;
}
// Remove the existing children
var existingChildren:OrderedSet(notation::Node) := self.children;
children := object OrderedSet(notation::Node){};
styles := object OrderedSet(notation::Style){};
var isCN:Boolean := not parent.oclIsTypeOf(notation::Diagram);
// If the shape is not in the diagram, this is a Child node
if (not isCN) {
type := INSTANCESPECIFICATION_SHAPE_SYSML14;
children += createDefaultNameLabelDecorationNode(INSTANCESPECIFICATION_NAME_LABEL_DECORATIONNODE_SYSML14);
children += createDefaultFloatingNameLabelDecorationNode(INSTANCESPECIFICATION_FLOATING_LABEL_DECORATIONNODE_SYSML14);
children += createDefaultBasicCompartement(INSTANCESPECIFICATION_SLOP_COMPARTMENT_SYSML14);
} else {
type := INSTANCESPECIFICATION_SHAPE_CN_SYSML14;
children += createDefaultNameLabelDecorationNode(INSTANCESPECIFICATION_NAME_LABEL_DECORATIONNODE_CN_SYSML14);
children += createDefaultFloatingNameLabelDecorationNode(INSTANCESPECIFICATION_FLOATING_LABEL_DECORATIONNODE_CN_SYSML14);
children += createDefaultBasicCompartement(INSTANCESPECIFICATION_SLOP_COMPARTMENT_SYSML14);
};
children += existingChildren[notation::DecorationNode]->any(curr | curr.type = STEREOTYPE_LABEL_DECORATION_NODE)->map fromSysML11StereotypeLabel(result);
children += existingChildren[notation::BasicCompartment]->any(curr | curr.type = STEREOTYPE_BRACE_COMPARTMENT)->map fromSysML11StereotypeBraceAndCompartment(result);
children += existingChildren[notation::BasicCompartment]->any(curr | curr.type = STEREOTYPE_COMPARTMENT_COMPARTMENT)->map fromSysML11StereotypeBraceAndCompartment(result);
}
mapping notation::Shape::fromSysML11EnumerationAsEnumeration(parent:notation::View) : notation::Shape when {self.oclIsTypeOf(notation::Shape) and self.type = ENUMERATION_AS_CLASSIFIER_SYSML11} {
init {
result := self;
}
// Remove the existing children
var existingChildren:OrderedSet(notation::Node) := self.children;
children := object OrderedSet(notation::Node){};
var isCN:Boolean := not parent.oclIsTypeOf(notation::Diagram);
var isClassNameDecorationNodeExist:Boolean := false;
var isLiteralCompartmentExist:Boolean := false;
// Loop on existing children to map with the new correct type
existingChildren->forEach(existingChild){
if (existingChild.type = NAMEDELEMENT_LABEL_DECORATIONNODE_SYSML11) {
if (isCN) {
existingChild.type := ENUMERATION_NAME_LABEL_DECORATIONNODE_CN_SYSML14;
} else {
existingChild.type := ENUMERATION_NAME_LABEL_DECORATIONNODE_SYSML14;
};
setPapyrusCSSForceValueVisible(existingChild, TRUE);
isClassNameDecorationNodeExist := true;
children += existingChild;
} elif (existingChild.type = ENUMERATIONLITERAL_COMPARTMENT_SYSML11) {
if (isCN) {
existingChild.type := ENUMERATION_LITERAL_COMPARTMENT_CN_SYSML14;
} else {
existingChild.type := ENUMERATION_LITERAL_COMPARTMENT_SYSML14;
};
setPapyrusCSSForceValueVisible(existingChild, TRUE);
setShowTitle(existingChild, true);
// Calculate the new children
existingChild.children := existingChild.children->map fromSysML11Shape(result);
isLiteralCompartmentExist := true;
children += existingChild;
} elif (existingChild.type = COMPARTMENT_SHAPE_DISPLAY) {
children += existingChild;
};
};
// If the shape is not in the diagram, this is a Child node
if (not isCN) {
type := ENUMERATION_SHAPE_SYSML14;
if(not isClassNameDecorationNodeExist){
children += createDefaultFloatingNameLabelDecorationNode(ENUMERATION_NAME_LABEL_DECORATIONNODE_SYSML14);
};
children += createDefaultFloatingNameLabelDecorationNode(ENUMERATION_FLOATING_LABEL_DECORATIONNODE_SYSML14);
if(not isLiteralCompartmentExist){
children += createDefaultBasicCompartement(ENUMERATION_LITERAL_COMPARTMENT_SYSML14);
};
} else {
type := ENUMERATION_SHAPE_CN_SYSML14;
if(not isClassNameDecorationNodeExist){
children += createDefaultFloatingNameLabelDecorationNode(ENUMERATION_NAME_LABEL_DECORATIONNODE_CN_SYSML14);
};
children += createDefaultFloatingNameLabelDecorationNode(ENUMERATION_FLOATING_LABEL_DECORATIONNODE_CN_SYSML14);
if(not isLiteralCompartmentExist){
children += createDefaultBasicCompartement(ENUMERATION_LITERAL_COMPARTMENT_CN_SYSML14);
};
};
children += existingChildren[notation::DecorationNode]->any(curr | curr.type = STEREOTYPE_LABEL_DECORATION_NODE)->map fromSysML11StereotypeLabel(result);
children += existingChildren[notation::BasicCompartment]->any(curr | curr.type = STEREOTYPE_BRACE_COMPARTMENT)->map fromSysML11StereotypeBraceAndCompartment(result);
children += existingChildren[notation::BasicCompartment]->any(curr | curr.type = STEREOTYPE_COMPARTMENT_COMPARTMENT)->map fromSysML11StereotypeBraceAndCompartment(result);
}
mapping notation::Shape::fromSysML11FlowSpecificationAsClass(parent:notation::View) : notation::Shape when {self.oclIsTypeOf(notation::Shape) and self.type = FLOWSPECIFICATION_AS_CLASSIFIER_SYSML11} {
init {
result := self;
}
// Remove the existing children
var existingChildren:OrderedSet(notation::Node) := self.children;
children := object OrderedSet(notation::Node){};
var isCN:Boolean := not parent.oclIsTypeOf(notation::Diagram);
var isClassNameDecorationNodeExist:Boolean := false;
var isFlowPropertiesCompartmentExist:Boolean := false;
// Loop on existing children to map with the new correct type
existingChildren->forEach(existingChild){
if (existingChild.type = FLOWSEPCIFICATION_LABEL_DECORATIONNODE_SYSML11) {
if (isCN) {
existingChild.type := INTERFACE_NAME_LABEL_DECORATIONNODE_CN_SYSML14;
} else {
existingChild.type := INTERFACE_NAME_LABEL_DECORATIONNODE_SYSML14;
};
setPapyrusCSSForceValueVisible(existingChild, TRUE);
isClassNameDecorationNodeExist := true;
children += existingChild;
} elif (existingChild.type = FLOWPROPERTY_COMPARTMENT_SYSML11) {
var createFlowPropertiesCompartment:notation::Compartment := createDefaultCompartement(FLOWPROPERTIES_COMPARTMENT_SYSML14);
isFlowPropertiesCompartmentExist := true;
// Check if the title EAnnotation exist, if this is the case, modify the show title
createFlowPropertiesCompartment.eAnnotations += manageShowTitleEAnnotationAsCompartmentAttribute(createFlowPropertiesCompartment, existingChild);
createFlowPropertiesCompartment.children := existingChild.children->map fromSysML11Shape(result);
setPapyrusCSSForceValueVisible(createFlowPropertiesCompartment, TRUE);
children += createFlowPropertiesCompartment;
} elif (existingChild.type = COMPARTMENT_SHAPE_DISPLAY) {
children += existingChild;
};
};
// If the shape is not in the diagram, this is a Child node
if (not isCN) {
type := INTERFACE_SHAPE_SYSML14;
if(not isClassNameDecorationNodeExist){
children += createDefaultFloatingNameLabelDecorationNode(INTERFACE_NAME_LABEL_DECORATIONNODE_SYSML14);
};
children += createDefaultFloatingNameLabelDecorationNode(INTERFACE_FLOATING_LABEL_DECORATIONNODE_SYSML14);
children += createDefaultBasicCompartement(INTERFACE_ATTRIBUTE_COMPARTMENT_SYSML14);
children += createDefaultBasicCompartement(INTERFACE_OPERATION_COMPARTMENT_SYSML14);
children += createDefaultBasicCompartement(INTERFACE_NESTEDCLASSIFIER_COMPARTMENT_SYSML14);
} else {
type := INTERFACE_SHAPE_CN_SYSML14;
if(not isClassNameDecorationNodeExist){
children += createDefaultFloatingNameLabelDecorationNode(INTERFACE_NAME_LABEL_DECORATIONNODE_CN_SYSML14);
};
children += createDefaultFloatingNameLabelDecorationNode(INTERFACE_FLOATING_LABEL_DECORATIONNODE_CN_SYSML14);
children += createDefaultBasicCompartement(INTERFACE_ATTRIBUTE_COMPARTMENT_CN_SYSML14);
children += createDefaultBasicCompartement(INTERFACE_OPERATION_COMPARTMENT_CN_SYSML14);
children += createDefaultBasicCompartement(INTERFACE_NESTEDCLASSIFIER_COMPARTMENT_CN_SYSML14);
};
if (not isFlowPropertiesCompartmentExist) {
children += createDefaultCompartement(FLOWPROPERTIES_COMPARTMENT_SYSML14);
};
children += existingChildren[notation::DecorationNode]->any(curr | curr.type = STEREOTYPE_LABEL_DECORATION_NODE)->map fromSysML11StereotypeLabel(result);
// If the stereotype label decoration node and stereotype brace basic compartment are not available, create it
if(result.children[notation::DecorationNode]->any(curr | curr.type = STEREOTYPE_LABEL_DECORATION_NODE).oclIsUndefined()){
createStereotypeLabelDecorationNode(result, FLOWSPECIFICATION_STEREOTYPE_QN);
};
children += existingChildren[notation::BasicCompartment]->any(curr | curr.type = STEREOTYPE_BRACE_COMPARTMENT)->map fromSysML11StereotypeBraceAndCompartment(result);
if(result.children[notation::BasicCompartment]->any(curr | curr.type = STEREOTYPE_BRACE_COMPARTMENT).oclIsUndefined()){
createStereotypeBraceBasicCompartment(result, FLOWSPECIFICATION_STEREOTYPE_QN);
};
children += existingChildren[notation::BasicCompartment]->any(curr | curr.type = STEREOTYPE_COMPARTMENT_COMPARTMENT)->map fromSysML11StereotypeBraceAndCompartment(result);
}
mapping notation::Shape::fromSysML11InterfaceAsInterface(parent:notation::View) : notation::Shape when {self.oclIsTypeOf(notation::Shape) and self.type = INTERFACE_AS_CLASSIFIER_SYSML11} {
init {
result := self;
}
// Remove the existing children
var existingChildren:OrderedSet(notation::Node) := self.children;
children := object OrderedSet(notation::Node){};
var isCN:Boolean := not parent.oclIsTypeOf(notation::Diagram);
var isClassNameDecorationNodeExist:Boolean := false;
var isAttributeCompartmentExist:Boolean := false;
var isOperationCompartmentExist:Boolean := false;
// Loop on existing children to map with the new correct type
existingChildren->forEach(existingChild){
if (existingChild.type = NAMEDELEMENT_LABEL_DECORATIONNODE_SYSML11) {
if (isCN) {
existingChild.type := INTERFACE_NAME_LABEL_DECORATIONNODE_CN_SYSML14;
} else {
existingChild.type := INTERFACE_NAME_LABEL_DECORATIONNODE_SYSML14;
};
setPapyrusCSSForceValueVisible(existingChild, TRUE);
isClassNameDecorationNodeExist := true;
children += existingChild;
} elif (existingChild.type = PROPERTY_UML_COMPARTMENT_SYSML11) {
if (isCN) {
existingChild.type := INTERFACE_ATTRIBUTE_COMPARTMENT_CN_SYSML14;
} else {
existingChild.type := INTERFACE_ATTRIBUTE_COMPARTMENT_SYSML14;
};
setPapyrusCSSForceValueVisible(existingChild, TRUE);
setShowTitle(existingChild, true);
// Calculate the new children
existingChild.children := existingChild.children->map fromSysML11Shape(result);
isAttributeCompartmentExist := true;
children += existingChild;
} elif (existingChild.type = OPERATION_UML_COMPARTMENT_SYSML11) {
if (isCN) {
existingChild.type := INTERFACE_OPERATION_COMPARTMENT_CN_SYSML14;
} else {
existingChild.type := INTERFACE_OPERATION_COMPARTMENT_SYSML14;
};
setPapyrusCSSForceValueVisible(existingChild, TRUE);
setShowTitle(existingChild, true);
// Calculate the new children
existingChild.children := existingChild.children->map fromSysML11Shape(result);
isOperationCompartmentExist := true;
children += existingChild;
} elif (existingChild.type = COMPARTMENT_SHAPE_DISPLAY) {
children += existingChild;
};
};
// If the shape is not in the diagram, this is a Child node
if (not isCN) {
type := INTERFACE_SHAPE_SYSML14;
if(not isClassNameDecorationNodeExist){
children += createDefaultFloatingNameLabelDecorationNode(INTERFACE_NAME_LABEL_DECORATIONNODE_SYSML14);
};
children += createDefaultFloatingNameLabelDecorationNode(INTERFACE_FLOATING_LABEL_DECORATIONNODE_SYSML14);
if(not isAttributeCompartmentExist){
children += createDefaultBasicCompartement(INTERFACE_ATTRIBUTE_COMPARTMENT_SYSML14);
};
if(not isOperationCompartmentExist){
children += createDefaultBasicCompartement(INTERFACE_OPERATION_COMPARTMENT_SYSML14);
};
children += createDefaultBasicCompartement(INTERFACE_NESTEDCLASSIFIER_COMPARTMENT_SYSML14);
} else {
type := INTERFACE_SHAPE_CN_SYSML14;
if(not isClassNameDecorationNodeExist){
children += createDefaultFloatingNameLabelDecorationNode(INTERFACE_NAME_LABEL_DECORATIONNODE_CN_SYSML14);
};
children += createDefaultFloatingNameLabelDecorationNode(INTERFACE_FLOATING_LABEL_DECORATIONNODE_CN_SYSML14);
if(not isAttributeCompartmentExist){
children += createDefaultBasicCompartement(INTERFACE_ATTRIBUTE_COMPARTMENT_CN_SYSML14);
};
if(not isOperationCompartmentExist){
children += createDefaultBasicCompartement(INTERFACE_OPERATION_COMPARTMENT_CN_SYSML14);
};
children += createDefaultBasicCompartement(INTERFACE_NESTEDCLASSIFIER_COMPARTMENT_CN_SYSML14);
};
children += createDefaultCompartement(FLOWPROPERTIES_COMPARTMENT_SYSML14);
children += existingChildren[notation::DecorationNode]->any(curr | curr.type = STEREOTYPE_LABEL_DECORATION_NODE)->map fromSysML11StereotypeLabel(result);
children += existingChildren[notation::BasicCompartment]->any(curr | curr.type = STEREOTYPE_BRACE_COMPARTMENT)->map fromSysML11StereotypeBraceAndCompartment(result);
children += existingChildren[notation::BasicCompartment]->any(curr | curr.type = STEREOTYPE_COMPARTMENT_COMPARTMENT)->map fromSysML11StereotypeBraceAndCompartment(result);
}
mapping notation::Shape::fromSysML11PrimitiveTypeAsPrimitiveType(parent:notation::View) : notation::Shape when {self.oclIsTypeOf(notation::Shape) and self.type = PRIMITIVETYPE_AS_CLASSIFIER_SYSML11} {
init {
result := self;
}
// Remove the existing children
var existingChildren:OrderedSet(notation::Node) := self.children;
children := object OrderedSet(notation::Node){};
var isCN:Boolean := not parent.oclIsTypeOf(notation::Diagram);
var isClassNameDecorationNodeExist:Boolean := false;
// Loop on existing children to map with the new correct type
existingChildren->forEach(existingChild){
if (existingChild.type = NAMEDELEMENT_LABEL_DECORATIONNODE_SYSML11) {
if (isCN) {
existingChild.type := PRIMITIVETYPE_NAME_LABEL_DECORATIONNODE_CN_SYSML14;
} else {
existingChild.type := PRIMITIVETYPE_NAME_LABEL_DECORATIONNODE_SYSML14;
};
setPapyrusCSSForceValueVisible(existingChild, TRUE);
isClassNameDecorationNodeExist := true;
children += existingChild;
} elif (existingChild.type = COMPARTMENT_SHAPE_DISPLAY) {
children += existingChild;
};
};
// If the shape is not in the diagram, this is a Child node
if (not isCN) {
type := PRIMITIVETYPE_SHAPE_SYSML14;
if(not isClassNameDecorationNodeExist){
children += createDefaultFloatingNameLabelDecorationNode(PRIMITIVETYPE_NAME_LABEL_DECORATIONNODE_SYSML14);
};
children += createDefaultFloatingNameLabelDecorationNode(PRIMITIVETYPE_FLOATING_LABEL_DECORATIONNODE_SYSML14);
children += createDefaultBasicCompartement(PRIMITIVETYPE_ATTRIBUTE_COMPARTMENT_SYSML14);
children += createDefaultBasicCompartement(PRIMITIVETYPE_OPERATION_COMPARTMENT_SYSML14);
} else {
type := PRIMITIVETYPE_SHAPE_CN_SYSML14;
if(not isClassNameDecorationNodeExist){
children += createDefaultFloatingNameLabelDecorationNode(PRIMITIVETYPE_NAME_LABEL_DECORATIONNODE_CN_SYSML14);
};
children += createDefaultFloatingNameLabelDecorationNode(PRIMITIVETYPE_FLOATING_LABEL_DECORATIONNODE_CN_SYSML14);
children += createDefaultBasicCompartement(PRIMITIVETYPE_ATTRIBUTE_COMPARTMENT_CN_SYSML14);
children += createDefaultBasicCompartement(PRIMITIVETYPE_OPERATION_COMPARTMENT_CN_SYSML14);
};
children += existingChildren[notation::DecorationNode]->any(curr | curr.type = STEREOTYPE_LABEL_DECORATION_NODE)->map fromSysML11StereotypeLabel(result);
children += existingChildren[notation::BasicCompartment]->any(curr | curr.type = STEREOTYPE_BRACE_COMPARTMENT)->map fromSysML11StereotypeBraceAndCompartment(result);
children += existingChildren[notation::BasicCompartment]->any(curr | curr.type = STEREOTYPE_COMPARTMENT_COMPARTMENT)->map fromSysML11StereotypeBraceAndCompartment(result);
}
mapping notation::Shape::fromSysML11SignalAsSignal(parent:notation::View) : notation::Shape when {self.oclIsTypeOf(notation::Shape) and self.type = SIGNAL_AS_CLASSIFIER_SYSML11} {
init {
result := self;
}
// Remove the existing children
var existingChildren:OrderedSet(notation::Node) := self.children;
children := object OrderedSet(notation::Node){};
var isCN:Boolean := not parent.oclIsTypeOf(notation::Diagram);
var isClassNameDecorationNodeExist:Boolean := false;
var isAttributeCompartmentExist:Boolean := false;
// Loop on existing children to map with the new correct type
existingChildren->forEach(existingChild){
if (existingChild.type = NAMEDELEMENT_LABEL_DECORATIONNODE_SYSML11) {
if (isCN) {
existingChild.type := SIGNAL_NAME_LABEL_DECORATIONNODE_CN_SYSML14;
} else {
existingChild.type := SIGNAL_NAME_LABEL_DECORATIONNODE_SYSML14;
};
setPapyrusCSSForceValueVisible(existingChild, TRUE);
isClassNameDecorationNodeExist := true;
children += existingChild;
} elif (existingChild.type = PROPERTY_UML_COMPARTMENT_SYSML11) {
if (isCN) {
existingChild.type := SIGNAL_ATTRIBUTE_COMPARTMENT_CN_SYSML14;
} else {
existingChild.type := SIGNAL_ATTRIBUTE_COMPARTMENT_SYSML14;
};
setPapyrusCSSForceValueVisible(existingChild, TRUE);
setShowTitle(existingChild, true);
// Calculate the new children
existingChild.children := existingChild.children->map fromSysML11Shape(result);
isAttributeCompartmentExist := true;
children += existingChild;
} elif (existingChild.type = COMPARTMENT_SHAPE_DISPLAY) {
children += existingChild;
};
};
// If the shape is not in the diagram, this is a Child node
if (not isCN) {
type := SIGNAL_SHAPE_SYSML14;
if(not isClassNameDecorationNodeExist){
children += createDefaultFloatingNameLabelDecorationNode(SIGNAL_NAME_LABEL_DECORATIONNODE_SYSML14);
};
children += createDefaultFloatingNameLabelDecorationNode(SIGNAL_FLOATING_LABEL_DECORATIONNODE_SYSML14);
if(not isAttributeCompartmentExist){
children += createDefaultBasicCompartement(SIGNAL_ATTRIBUTE_COMPARTMENT_SYSML14);
};
} else {
type := SIGNAL_SHAPE_CN_SYSML14;
if(not isClassNameDecorationNodeExist){
children += createDefaultFloatingNameLabelDecorationNode(SIGNAL_NAME_LABEL_DECORATIONNODE_CN_SYSML14);
};
children += createDefaultFloatingNameLabelDecorationNode(SIGNAL_FLOATING_LABEL_DECORATIONNODE_CN_SYSML14);
if(not isAttributeCompartmentExist){
children += createDefaultBasicCompartement(SIGNAL_ATTRIBUTE_COMPARTMENT_CN_SYSML14);
};
};
children += existingChildren[notation::DecorationNode]->any(curr | curr.type = STEREOTYPE_LABEL_DECORATION_NODE)->map fromSysML11StereotypeLabel(result);
children += existingChildren[notation::BasicCompartment]->any(curr | curr.type = STEREOTYPE_BRACE_COMPARTMENT)->map fromSysML11StereotypeBraceAndCompartment(result);
children += existingChildren[notation::BasicCompartment]->any(curr | curr.type = STEREOTYPE_COMPARTMENT_COMPARTMENT)->map fromSysML11StereotypeBraceAndCompartment(result);
}
mapping notation::Shape::fromSysML11UnitAsInstanceSpecification(parent:notation::View) : notation::Shape when {self.oclIsTypeOf(notation::Shape) and self.type = UNIT_AS_CLASSIFIER_SYSML11} {
init {
result := self;
}
// Remove the existing children
var existingChildren:OrderedSet(notation::Node) := self.children;
children := object OrderedSet(notation::Node){};
styles := object OrderedSet(notation::Style){};
var isCN:Boolean := not parent.oclIsTypeOf(notation::Diagram);
// If the shape is not in the diagram, this is a Child node
if (not isCN) {
type := INSTANCESPECIFICATION_SHAPE_SYSML14;
children += createDefaultNameLabelDecorationNode(INSTANCESPECIFICATION_NAME_LABEL_DECORATIONNODE_SYSML14);
children += createDefaultFloatingNameLabelDecorationNode(INSTANCESPECIFICATION_FLOATING_LABEL_DECORATIONNODE_SYSML14);
children += createDefaultBasicCompartement(INSTANCESPECIFICATION_SLOP_COMPARTMENT_SYSML14);
} else {
type := INSTANCESPECIFICATION_SHAPE_CN_SYSML14;
children += createDefaultNameLabelDecorationNode(INSTANCESPECIFICATION_NAME_LABEL_DECORATIONNODE_CN_SYSML14);
children += createDefaultFloatingNameLabelDecorationNode(INSTANCESPECIFICATION_FLOATING_LABEL_DECORATIONNODE_CN_SYSML14);
children += createDefaultBasicCompartement(INSTANCESPECIFICATION_SLOP_COMPARTMENT_CN_SYSML14);
};
children += existingChildren[notation::DecorationNode]->any(curr | curr.type = STEREOTYPE_LABEL_DECORATION_NODE)->map fromSysML11StereotypeLabel(result);
children += existingChildren[notation::BasicCompartment]->any(curr | curr.type = STEREOTYPE_BRACE_COMPARTMENT)->map fromSysML11StereotypeBraceAndCompartment(result);
children += existingChildren[notation::BasicCompartment]->any(curr | curr.type = STEREOTYPE_COMPARTMENT_COMPARTMENT)->map fromSysML11StereotypeBraceAndCompartment(result);
}
mapping notation::Shape::fromSysML11ValueTypeAsDataType(parent:notation::View) : notation::Shape when {self.oclIsTypeOf(notation::Shape) and self.type = VALUETYPE_AS_CLASSIFIER_SYSML11} {
init {
result := self;
}
// Remove the existing children
var existingChildren:OrderedSet(notation::Node) := self.children;
children := object OrderedSet(notation::Node){};
var isCN:Boolean := not parent.oclIsTypeOf(notation::Diagram);
var isClassNameDecorationNodeExist:Boolean := false;
var isAttributeCompartmentExist:Boolean := false;
var isOperationCompartmentExist:Boolean := false;
// Loop on existing children to map with the new correct type
existingChildren->forEach(existingChild){
if (existingChild.type = VALUETYPE_NAME_COMPARTMENT_SYSML11) {
if (isCN) {
existingChild.type := DATATYPE_NAME_LABEL_DECORATIONNODE_CN_SYSML14;
} else {
existingChild.type := DATATYPE_NAME_LABEL_DECORATIONNODE_SYSML14;
};
setPapyrusCSSForceValueVisible(existingChild, TRUE);
isClassNameDecorationNodeExist := true;
children += existingChild;
} elif (existingChild.type = PROPERTY_UML_COMPARTMENT_SYSML11) {
if (isCN) {
existingChild.type := DATATYPE_ATTRIBUTE_COMPARTMENT_CN_SYSML14;
} else {
existingChild.type := DATATYPE_ATTRIBUTE_COMPARTMENT_SYSML14;
};
setPapyrusCSSForceValueVisible(existingChild, TRUE);
setShowTitle(existingChild, true);
// Calculate the new children
existingChild.children := existingChild.children->map fromSysML11Shape(result);
isAttributeCompartmentExist := true;
children += existingChild;
} elif (existingChild.type = OPERATION_UML_COMPARTMENT_SYSML11) {
if (isCN) {
existingChild.type := DATATYPE_OPERATION_COMPARTMENT_CN_SYSML14;
} else {
existingChild.type := DATATYPE_OPERATION_COMPARTMENT_SYSML14;
};
setPapyrusCSSForceValueVisible(existingChild, TRUE);
setShowTitle(existingChild, true);
// Calculate the new children
existingChild.children := existingChild.children->map fromSysML11Shape(result);
isOperationCompartmentExist := true;
children += existingChild;
} elif (existingChild.type = COMPARTMENT_SHAPE_DISPLAY) {
children += existingChild;
};
};
// If the shape is not in the diagram, this is a Child node
if (not isCN) {
type := DATATYPE_SHAPE_SYSML14;
if(not isClassNameDecorationNodeExist){
children += createDefaultFloatingNameLabelDecorationNode(DATATYPE_NAME_LABEL_DECORATIONNODE_SYSML14);
};
children += createDefaultFloatingNameLabelDecorationNode(DATATYPE_FLOATING_LABEL_DECORATIONNODE_SYSML14);
if(not isAttributeCompartmentExist){
children += createDefaultBasicCompartement(DATATYPE_ATTRIBUTE_COMPARTMENT_SYSML14);
};
if(not isOperationCompartmentExist){
children += createDefaultBasicCompartement(DATATYPE_OPERATION_COMPARTMENT_SYSML14);
};
} else {
type := DATATYPE_SHAPE_CN_SYSML14;
if(not isClassNameDecorationNodeExist){
children += createDefaultFloatingNameLabelDecorationNode(DATATYPE_NAME_LABEL_DECORATIONNODE_CN_SYSML14);
};
children += createDefaultFloatingNameLabelDecorationNode(DATATYPE_FLOATING_LABEL_DECORATIONNODE_CN_SYSML14);
if(not isAttributeCompartmentExist){
children += createDefaultBasicCompartement(DATATYPE_ATTRIBUTE_COMPARTMENT_CN_SYSML14);
};
if(not isOperationCompartmentExist){
children += createDefaultBasicCompartement(DATATYPE_OPERATION_COMPARTMENT_CN_SYSML14);
};
};
children += existingChildren[notation::DecorationNode]->any(curr | curr.type = STEREOTYPE_LABEL_DECORATION_NODE)->map fromSysML11StereotypeLabel(result);
children += existingChildren[notation::BasicCompartment]->any(curr | curr.type = STEREOTYPE_BRACE_COMPARTMENT)->map fromSysML11StereotypeBraceAndCompartment(result);
children += existingChildren[notation::BasicCompartment]->any(curr | curr.type = STEREOTYPE_COMPARTMENT_COMPARTMENT)->map fromSysML11StereotypeBraceAndCompartment(result);
}
mapping notation::Node::fromSysML11EnumerationLiteralAsEnumerationLiteral(parent:notation::View) : notation::Shape when {self.oclIsTypeOf(notation::Node) and self.type = ENUMERATIONLITERAL_AS_LABEL_SYSML11} {
// Initialize the new shape fields
eAnnotations := self.eAnnotations;
visible := self.visible;
mutable := self.mutable;
sourceEdges := self.sourceEdges;
targetEdges := self.targetEdges;
styles := self.styles;
element := self.element;
transientChildren := self.transientChildren;
layoutConstraint := self.layoutConstraint;
// Manage type
type := ENUMERATIONLITERAL_LITERALLABEL_DECORATIONNODE_SYSML14;
children := self.children->map fromSysML11Shape(result);
}
mapping notation::Node::fromSysML11OperationAsOperation(parent:notation::View) : notation::Shape when {self.oclIsTypeOf(notation::Node) and self.type = OPERATION_AS_LABEL_SYSML11} {
// Initialize the new shape fields
eAnnotations := self.eAnnotations;
visible := self.visible;
mutable := self.mutable;
sourceEdges := self.sourceEdges;
targetEdges := self.targetEdges;
styles := self.styles;
element := self.element;
transientChildren := self.transientChildren;
layoutConstraint := self.layoutConstraint;
// Manage type
if (parent.element.oclIsKindOf(UML::PrimitiveType)) {
type := OPERATION_PRIMITIVETYPEOPERATIONLABEL_SYSML14;
} elif (parent.element.oclIsKindOf(UML::DataType)) {
type := OPERATION_DATATYPEOPERATIONLABEL_SYSML14;
} elif (parent.element.oclIsKindOf(UML::Interface)) {
type := OPERATION_INTERFACEOPERATIONLABEL_SYSML14;
} elif (parent.element.oclIsKindOf(UML::Class)) {
type := OPERATION_CLASSOPERATIONLABEL_SYSML14;
} else {
type := OPERATION_OPERATIONLABEL_SYSML14;
};
children := self.children->map fromSysML11Shape(result);
}
mapping notation::Node::fromSysML11PropertyAsProperty(parent:notation::View) : notation::Shape when {self.oclIsTypeOf(notation::Node) and
((self.type = PROPERTY_AS_LABEL_SYSML11)
or (self.type = CONSTRAINTPROPERTY_AS_LABEL_SYSML11)
or (self.type = FLOWPORT_AS_LABEL_SYSML11)
or (self.type = FLOWPROPERTY_AS_LABEL_SYSML11)
or (self.type = PART_AS_LABEL_SYSML11)
or (self.type = REFERENCE_AS_LABEL_SYSML11)
or (self.type = VALUE_AS_LABEL_SYSML11))} {
// Initialize the new shape fields
eAnnotations := self.eAnnotations;
visible := self.visible;
mutable := self.mutable;
sourceEdges := self.sourceEdges;
targetEdges := self.targetEdges;
styles := self.styles;
element := self.element;
transientChildren := self.transientChildren;
layoutConstraint := self.layoutConstraint;
// Manage type
if (parent.element.oclIsKindOf(UML::Signal)) {
type := PROPERTY_SIGNALATTRIBUTELABEL_SYSML14;
} elif (parent.element.oclIsKindOf(UML::PrimitiveType)) {
type := PROPERTY_PRIMITIVETYPEATTRIBUTELABEL_SYSML14;
} elif (parent.element.oclIsKindOf(UML::DataType)) {
type := PROPERTY_DATATYPEATTRIBUTELABEL_SYSML14;
} elif (parent.element.oclIsKindOf(UML::Interface)) {
type := PROPERTY_INTERFACEATTRIBUTELABEL_SYSML14;
} elif (parent.element.oclIsKindOf(UML::Class)) {
type := PROPERTY_CLASSATTRIBUTELABEL_SYSML14;
} else {
type := PROPERTY_ATTRIBUTELABEL_SYSML14;
};
children := self.children->map fromSysML11Shape(result);
}
mapping notation::Node::fromSysML11ReceptionAsReception(parent:notation::View) : notation::Shape when {self.oclIsTypeOf(notation::Node) and self.type = RECEPTION_AS_LABEL_SYSML11} {
// Initialize the new shape fields
eAnnotations := self.eAnnotations;
visible := self.visible;
mutable := self.mutable;
sourceEdges := self.sourceEdges;
targetEdges := self.targetEdges;
styles := self.styles;
element := self.element;
transientChildren := self.transientChildren;
layoutConstraint := self.layoutConstraint;
// Manage type
if (parent.element.oclIsKindOf(UML::Interface)) {
type := RECEPTION_INTERFACERECEPTIONLABEL_SYSML14;
} else {
type := RECEPTION_RECEPTIONLABEL_SYSML14;
};
children := self.children->map fromSysML11Shape(result);
}
mapping notation::Shape::fromSysML11PackageShapeAsModel(parent:notation::View) : notation::Shape when {self.oclIsTypeOf(notation::Shape) and self.element.oclIsKindOf(UML::Model)} {
init {
result := self;
}
var isCN:Boolean := not parent.oclIsTypeOf(notation::Diagram);
// Remove the existing children
var existingChildren:OrderedSet(notation::Node) := self.children;
children := object OrderedSet(notation::Node){};
var typeLabel:String = MODEL_SHAPE_SYSML14;
var modelNameLabel:String := MODEL_NAME_LABEL_DECORATIONNODE_SYSML14;
var modelPackagedElementCompartment:String := MODEL_PACKAGEDELEMENT_COMPARTMENT_SYSML14;
// If the shape is not in the diagram, this is a Child node
if (isCN) {
typeLabel := MODEL_SHAPE_CN_SYSML14;
modelNameLabel := MODEL_NAME_LABEL_DECORATIONNODE_CN_SYSML14;
modelPackagedElementCompartment:= MODEL_PACKAGEDELEMENT_COMPARTMENT_CN_SYSML14;
};
type := typeLabel;
if(self.type = NAMEDELEMENT_DEFAULTSHAPE){
children += createDefaultNameLabelDecorationNode(modelNameLabel);
var packageElementCompartment:notation::BasicCompartment := createDefaultBasicCompartement(modelPackagedElementCompartment);
packageElementCompartment.styles += object notation::TitleStyle{};
packageElementCompartment.layoutConstraint := object notation::Bounds{};
children += packageElementCompartment;
}else{
// Search if the packaged element compartment is existing
existingChildren->forEach(existingChild){
if (existingChild.type = PACKAGE_NAME_LABEL_DECORATIONNODE_SYSML14 or existingChild.type = PACKAGE_NAME_LABEL_DECORATIONNODE_CN_SYSML14) {
existingChild.type := modelNameLabel;
setPapyrusCSSForceValueVisible(existingChild, TRUE);
children += existingChild;
} elif (existingChild.type = PACKAGE_PACKAGEDELEMENT_COMPARTMENT_SYSML14 or existingChild.type = PACKAGE_PACKAGEDELEMENT_COMPARTMENT_CN_SYSML14) {
existingChild.type := modelPackagedElementCompartment;
setPapyrusCSSForceValueVisible(existingChild, TRUE);
setShowTitle(existingChild, true);
// Map the existing children shapes
existingChild.children := existingChild.children->map fromSysML11Shape(result);
children += existingChild;
} elif (existingChild.type = COMPARTMENT_SHAPE_DISPLAY) {
children += existingChild;
};
};
};
children += existingChildren[notation::DecorationNode]->any(curr | curr.type = STEREOTYPE_LABEL_DECORATION_NODE)->map fromSysML11StereotypeLabel(result);
children += existingChildren[notation::BasicCompartment]->any(curr | curr.type = STEREOTYPE_BRACE_COMPARTMENT)->map fromSysML11StereotypeBraceAndCompartment(result);
children += existingChildren[notation::BasicCompartment]->any(curr | curr.type = STEREOTYPE_COMPARTMENT_COMPARTMENT)->map fromSysML11StereotypeBraceAndCompartment(result);
}
mapping notation::Shape::fromSysML11PackageShapeAsPackage(parent:notation::View) : notation::Shape when {self.oclIsTypeOf(notation::Shape) and self.type = PACKAGE_SHAPE_SYSML14 and self.element.oclIsKindOf(UML::Package)} {
init {
result := self;
}
// Remove the existing children
var existingChildren:OrderedSet(notation::Node) := self.children;
children := object OrderedSet(notation::Node){};
children := existingChildren->map fromSysML11Shape(result);
var isCN:Boolean := not parent.oclIsTypeOf(notation::Diagram);
// Search if the packaged element compartment is existing
existingChildren->forEach(existingChild){
if (existingChild.type = PACKAGE_PACKAGEDELEMENT_COMPARTMENT_SYSML14 or existingChild.type = PACKAGE_PACKAGEDELEMENT_COMPARTMENT_CN_SYSML14) {
setPapyrusCSSForceValueVisible(existingChild, TRUE);
setShowTitle(existingChild, true);
// Map the existing children shapes
existingChild.children := existingChild.children->map fromSysML11Shape(result);
}
};
children += existingChildren[notation::DecorationNode]->any(curr | curr.type = STEREOTYPE_LABEL_DECORATION_NODE)->map fromSysML11StereotypeLabel(result);
children += existingChildren[notation::BasicCompartment]->any(curr | curr.type = STEREOTYPE_BRACE_COMPARTMENT)->map fromSysML11StereotypeBraceAndCompartment(result);
children += existingChildren[notation::BasicCompartment]->any(curr | curr.type = STEREOTYPE_COMPARTMENT_COMPARTMENT)->map fromSysML11StereotypeBraceAndCompartment(result);
}
mapping notation::Shape::fromSysML11StereotypeComment(parent:notation::View) : notation::Shape when {self.type = STEREOTYPE_COMMENT} {
init {
result := self;
}
childrenToRemove += result;
}
mapping notation::Shape::fromSysML11DefaultShape(parent:notation::View) : notation::Shape when {self.oclIsTypeOf(notation::Shape)} {
init {
var existingChildren:OrderedSet(notation::Node) := self.children;
result := self;
result.children := object OrderedSet(notation::Node){};
result.children := existingChildren->map fromSysML11Shape(result);
}
}
mapping notation::BasicCompartment::fromSysML11BasicCompartment(parent:notation::View) : notation::BasicCompartment disjuncts
notation::BasicCompartment::fromSysML11StereotypeBraceAndCompartment,
notation::BasicCompartment::fromSysML11BasicCompartmentDefault
{}
mapping notation::BasicCompartment::fromSysML11BasicCompartmentDefault(parent:notation::View) : notation::BasicCompartment when {self.oclIsTypeOf(notation::BasicCompartment) and self.type <> REQUIREMENT_IDINFO_COMPARTMENT_SYSML11}{
init{
result := self;
setPapyrusCSSForceValueVisible(result, TRUE);
}
}
mapping notation::BasicCompartment::fromSysML11StereotypeBraceAndCompartment(parent:notation::View) : notation::BasicCompartment when {self.oclIsTypeOf(notation::BasicCompartment) and (self.type = STEREOTYPE_BRACE_COMPARTMENT or self.type = STEREOTYPE_COMPARTMENT_COMPARTMENT) }{
init{
result := self;
if(self.element.oclIsKindOf(UML::Stereotype)){
var stereotype:UML::Stereotype := self.element.oclAsType(UML::Stereotype).toSysML14Stereotype(inS14Profile.objectsOfType(UML::Stereotype));
if (stereotype.oclIsUndefined()) {
// The stereotype was not find in SysML1.4, remove the compartment
childrenToRemove += result;
} else {
result.element := stereotype.oclAsType(ecore::EObject);
}
};
}
}
mapping notation::DecorationNode::fromSysML11DecorationNode(parent:notation::View) : notation::DecorationNode disjuncts
notation::DecorationNode::fromSysML11StereotypeLabel,
notation::DecorationNode::fromSysML11DecorationNodeDefault
{}
mapping notation::DecorationNode::fromSysML11StereotypeLabel(parent:notation::View) : notation::DecorationNode when {self.oclIsTypeOf(notation::DecorationNode) and self.type = STEREOTYPE_LABEL_DECORATION_NODE}{
init{
result := self;
if(self.element.oclIsKindOf(UML::Stereotype)){
var stereotype:UML::Stereotype := self.element.oclAsType(UML::Stereotype).toSysML14Stereotype(inS14Profile.objectsOfType(UML::Stereotype));
if (stereotype.oclIsUndefined()) {
// The stereotype was not find in SysML1.4, remove the decoration node
childrenToRemove += result;
} else {
result.element := stereotype.oclAsType(ecore::EObject);
}
};
}
}
mapping notation::DecorationNode::fromSysML11DecorationNodeDefault(parent:notation::View) : notation::DecorationNode when {self.oclIsTypeOf(notation::DecorationNode)} {
init{
result := self;
setPapyrusCSSForceValueVisible(result, TRUE);
setShowTitle(result, true);
}
}
// Helpers to create stereotypes decoration nodes and compartments
helper createStereotypeLabelDecorationNode(inout parent:notation::View, stereotypeQualifiedName:String){
var stereotypeElement:UML::Stereotype := inS14Profile.objectsOfType(UML::Stereotype)->any(curr | curr.getQualifiedName()=stereotypeQualifiedName);
if(not stereotypeElement.oclIsUndefined()){
var createdStereotypeLabelDecorationNode:notation::DecorationNode := object DecorationNode{
type := STEREOTYPE_LABEL_DECORATION_NODE;
styles += object notation::StringValueStyle{
name := "stereotype";
stringValue := stereotypeQualifiedName;
};
layoutConstraint := object notation::Bounds{};
element := stereotypeElement.oclAsType(ecore::EObject);
};
parent.children += createdStereotypeLabelDecorationNode;
};
}
helper createStereotypeBraceBasicCompartment(inout parent:notation::View, stereotypeQualifiedName:String){
var stereotypeElement:UML::Stereotype := inS14Profile.objectsOfType(UML::Stereotype)->any(curr | curr.getQualifiedName()=stereotypeQualifiedName);
if(not stereotypeElement.oclIsUndefined()){
var createdStereotypeBraceBasicCompartment:notation::BasicCompartment := object BasicCompartment{
type := STEREOTYPE_BRACE_COMPARTMENT;
styles += object notation::TitleStyle{};
styles += object notation::StringValueStyle{
name := "stereotype";
stringValue := stereotypeQualifiedName;
};
layoutConstraint := object notation::Bounds{};
element := stereotypeElement.oclAsType(ecore::EObject);
};
parent.children += createdStereotypeBraceBasicCompartment;
};
}
// Edges management
mapping notation::Edge::fromSysML11Edge() : notation::Edge disjuncts
notation::Edge::fromSysML11StereotypeCommentLink,
notation::Edge::fromSysML11AssociationAsAssociation,
notation::Edge::fromSysML11DependencyAsDependency,
notation::Edge::fromSysML11GeneralizationAsGeneralization,
notation::Edge::fromSysML11InterfaceRealizationAsInterfaceRealization,
notation::Edge::fromSysML11UsageAsUsage,
notation::Edge::fromSysML11DefaultEdge
{}
mapping notation::Edge::fromSysML11AssociationAsAssociation() : notation::Edge when {((self.type = LINK_SYSML_ASSOCIATION_SYSML11) or (self.type = LINK_UML_ASSOCIATION_SYSML11))} {
init {
result := self;
}
type := ASSOCIATION_EDGE_SYSML14;
var existingChildren:OrderedSet(notation::Node) := self.children;
children := object OrderedSet(notation::Node){};
var isNameLabelCompartmentExist:Boolean := false;
var isStereotypeLabelCompartmentExist:Boolean := false;
var isSourceRoleCompartmentExist:Boolean := false;
var isSourceMultiplicityCompartmentExist:Boolean := false;
var isTargetRoleCompartmentExist:Boolean := false;
var isTargetMultiplicityCompartmentExist:Boolean := false;
existingChildren->forEach(existingChild){
if (existingChild.type = APPLIEDSTEREOTYPE_LINK_LABEL_DECORATIONODE_SYSML11) {
existingChild.type := ASSOCIATION_STEREOTYPE_LABEL_DECORATIONNODE_SYSML14;
setPapyrusCSSForceValueVisible(existingChild, TRUE);
isStereotypeLabelCompartmentExist := true;
children += existingChild;
} elif (existingChild.type = NAMEDELEMENT_LINK_NAME_DECORATIONODE_SYSML11) {
existingChild.type := ASSOCIATION_NAME_LABEL_DECORATIONNODE_SYSML14;
setPapyrusCSSForceValueVisible(existingChild, TRUE);
isNameLabelCompartmentExist := true;
children += existingChild;
} elif (existingChild.type = ASSOCIATION_SOURCE_ROLE_DECORATIONODE_SYSML11) {
existingChild.type := ASSOCIATION_SOURCEROLE_LABEL_DECORATIONNODE_SYSML14;
setPapyrusCSSForceValueVisible(existingChild, TRUE);
isSourceRoleCompartmentExist := true;
children += existingChild;
} elif (existingChild.type = ASSOCIATION_SOURCE_MULTIPLICITY_DECORATIONODE_SYSML11) {
existingChild.type := ASSOCIATION_SOURCEMULTIPLICITY_LABEL_DECORATIONNODE_SYSML14;
setPapyrusCSSForceValueVisible(existingChild, TRUE);
isSourceMultiplicityCompartmentExist := true;
children += existingChild;
} elif (existingChild.type = ASSOCIATION_TARGET_ROLE_DECORATIONODE_SYSML11) {
existingChild.type := ASSOCIATION_TARGETROLE_LABEL_DECORATIONNODE_SYSML14;
setPapyrusCSSForceValueVisible(existingChild, TRUE);
isTargetRoleCompartmentExist := true;
children += existingChild;
} elif (existingChild.type = ASSOCIATION_TARGET_MULTIPLICITY_DECORATIONODE_SYSML11) {
existingChild.type := ASSOCIATION_TARGETMULTIPLICITY_LABEL_DECORATIONNODE_SYSML14;
setPapyrusCSSForceValueVisible(existingChild, TRUE);
isTargetMultiplicityCompartmentExist := true;
children += existingChild;
};
};
if(not isNameLabelCompartmentExist){
var associationNameLabel:notation::DecorationNode := createDefaultFloatingNameLabelDecorationNode(ASSOCIATION_NAME_LABEL_DECORATIONNODE_SYSML14);
associationNameLabel.layoutConstraint.oclAsType(notation::Location).y := 20;
children += associationNameLabel;
};
if(not isStereotypeLabelCompartmentExist){
var associationStereotypeLabel:notation::DecorationNode := createDefaultFloatingNameLabelDecorationNode(ASSOCIATION_STEREOTYPE_LABEL_DECORATIONNODE_SYSML14);
associationStereotypeLabel.layoutConstraint.oclAsType(notation::Location).y := -20;
children += associationStereotypeLabel;
};
if(not isSourceRoleCompartmentExist){
var associationNameLabel:notation::DecorationNode := createDefaultFloatingNameLabelDecorationNode(ASSOCIATION_SOURCEROLE_LABEL_DECORATIONNODE_SYSML14);
associationNameLabel.layoutConstraint.oclAsType(notation::Location).y := 20;
children += associationNameLabel;
};
if(not isSourceMultiplicityCompartmentExist){
var associationStereotypeLabel:notation::DecorationNode := createDefaultFloatingNameLabelDecorationNode(ASSOCIATION_SOURCEMULTIPLICITY_LABEL_DECORATIONNODE_SYSML14);
associationStereotypeLabel.layoutConstraint.oclAsType(notation::Location).y := 20;
children += associationStereotypeLabel;
};
if(not isTargetRoleCompartmentExist){
var associationNameLabel:notation::DecorationNode := createDefaultFloatingNameLabelDecorationNode(ASSOCIATION_TARGETROLE_LABEL_DECORATIONNODE_SYSML14);
associationNameLabel.layoutConstraint.oclAsType(notation::Location).y := -20;
children += associationNameLabel;
};
if(not isTargetMultiplicityCompartmentExist){
var associationStereotypeLabel:notation::DecorationNode := createDefaultFloatingNameLabelDecorationNode(ASSOCIATION_TARGETMULTIPLICITY_LABEL_DECORATIONNODE_SYSML14);
associationStereotypeLabel.layoutConstraint.oclAsType(notation::Location).y := -20;
children += associationStereotypeLabel;
};
}
mapping notation::Edge::fromSysML11DependencyAsDependency() : notation::Edge when {self.type = LINK_UML_DEPENDENCY_SYSML11} {
init {
result := self;
}
type := DEPENDENCY_EDGE_SYSML14;
var existingChildren:OrderedSet(notation::Node) := self.children;
children := object OrderedSet(notation::Node){};
var isNameLabelCompartmentExist:Boolean := false;
var isStereotypeLabelCompartmentExist:Boolean := false;
existingChildren->forEach(existingChild){
if (existingChild.type = APPLIEDSTEREOTYPE_LINK_LABEL_DECORATIONODE_SYSML11) {
existingChild.type := DEPENDENCY_STEREOTYPE_LABEL_DECORATIONNODE_SYSML14;
setPapyrusCSSForceValueVisible(existingChild, TRUE);
isStereotypeLabelCompartmentExist := true;
children += existingChild;
} elif (existingChild.type = NAMEDELEMENT_LINK_NAME_DECORATIONODE_SYSML11) {
existingChild.type := DEPENDENCY_NAME_LABEL_DECORATIONNODE_SYSML14;
setPapyrusCSSForceValueVisible(existingChild, TRUE);
isNameLabelCompartmentExist := true;
children += existingChild;
};
};
if(not isStereotypeLabelCompartmentExist){
var stereotypeLabelDecorationNode:notation::DecorationNode := createDefaultFloatingNameLabelDecorationNode(DEPENDENCY_STEREOTYPE_LABEL_DECORATIONNODE_SYSML14);
stereotypeLabelDecorationNode.layoutConstraint.oclAsType(notation::Location).y := 40;
children += stereotypeLabelDecorationNode;
};
if(not isNameLabelCompartmentExist){
var nameLabelDecorationNode:notation::DecorationNode := createDefaultFloatingNameLabelDecorationNode(DEPENDENCY_NAME_LABEL_DECORATIONNODE_SYSML14);
nameLabelDecorationNode.layoutConstraint.oclAsType(notation::Location).y := 60;
children += nameLabelDecorationNode;
};
}
mapping notation::Edge::fromSysML11GeneralizationAsGeneralization() : notation::Edge when {self.type = LINK_UML_GENERALIZATION_SYSML11} {
init {
result := self;
}
type := GENERALIZATION_EDGE_SYSML14;
var existingChildren:OrderedSet(notation::Node) := self.children;
children := object OrderedSet(notation::Node){};
var isStereotypeLabelCompartmentExist:Boolean := false;
existingChildren->forEach(existingChild){
if (existingChild.type = APPLIEDSTEREOTYPE_LINK_LABEL_DECORATIONODE_SYSML11) {
existingChild.type := GENERALIZATION_STEREOTYPE_LABEL_DECORATIONNODE_SYSML14;
setPapyrusCSSForceValueVisible(existingChild, TRUE);
isStereotypeLabelCompartmentExist := true;
children += existingChild;
};
};
if(not isStereotypeLabelCompartmentExist){
var stereotypeLabelDecorationNode:notation::DecorationNode := createDefaultFloatingNameLabelDecorationNode(GENERALIZATION_STEREOTYPE_LABEL_DECORATIONNODE_SYSML14);
stereotypeLabelDecorationNode.layoutConstraint.oclAsType(notation::Location).y := 40;
children += stereotypeLabelDecorationNode;
};
}
mapping notation::Edge::fromSysML11InterfaceRealizationAsInterfaceRealization() : notation::Edge when {self.type = LINK_UML_INTERFACEREALIZATION_SYSML11} {
init {
result := self;
}
type := INTERFACEREALIZATION_EDGE_SYSML14;
var existingChildren:OrderedSet(notation::Node) := self.children;
children := object OrderedSet(notation::Node){};
var isNameLabelCompartmentExist:Boolean := false;
var isStereotypeLabelCompartmentExist:Boolean := false;
existingChildren->forEach(existingChild){
if (existingChild.type = APPLIEDSTEREOTYPE_LINK_LABEL_DECORATIONODE_SYSML11) {
existingChild.type := INTERFACEREALIZATION_STEREOTYPE_LABEL_DECORATIONNODE_SYSML14;
setPapyrusCSSForceValueVisible(existingChild, TRUE);
isStereotypeLabelCompartmentExist := true;
children += existingChild;
} elif (existingChild.type = NAMEDELEMENT_LINK_NAME_DECORATIONODE_SYSML11) {
existingChild.type := INTERFACEREALIZATION_NAME_LABEL_DECORATIONNODE_SYSML14;
setPapyrusCSSForceValueVisible(existingChild, TRUE);
isNameLabelCompartmentExist := true;
children += existingChild;
};
};
if(not isStereotypeLabelCompartmentExist){
var stereotypeLabelDecorationNode:notation::DecorationNode := createDefaultFloatingNameLabelDecorationNode(INTERFACEREALIZATION_STEREOTYPE_LABEL_DECORATIONNODE_SYSML14);
stereotypeLabelDecorationNode.layoutConstraint.oclAsType(notation::Location).y := 40;
children += stereotypeLabelDecorationNode;
};
if(not isNameLabelCompartmentExist){
var nameLabelDecorationNode:notation::DecorationNode := createDefaultFloatingNameLabelDecorationNode(INTERFACEREALIZATION_NAME_LABEL_DECORATIONNODE_SYSML14);
nameLabelDecorationNode.layoutConstraint.oclAsType(notation::Location).y := 60;
children += nameLabelDecorationNode;
};
}
mapping notation::Edge::fromSysML11UsageAsUsage() : notation::Edge when {self.type = LINK_UML_USAGE_SYSML11} {
init {
result := self;
}
type := USAGE_EDGE_SYSML14;
var existingChildren:OrderedSet(notation::Node) := self.children;
children := object OrderedSet(notation::Node){};
var isNameLabelCompartmentExist:Boolean := false;
var isStereotypeLabelCompartmentExist:Boolean := false;
existingChildren->forEach(existingChild){
if (existingChild.type = APPLIEDSTEREOTYPE_LINK_LABEL_DECORATIONODE_SYSML11) {
existingChild.type := USAGE_STEREOTYPE_LABEL_DECORATIONNODE_SYSML14;
setPapyrusCSSForceValueVisible(existingChild, TRUE);
isStereotypeLabelCompartmentExist := true;
children += existingChild;
} elif (existingChild.type = NAMEDELEMENT_LINK_NAME_DECORATIONODE_SYSML11) {
existingChild.type := USAGE_NAME_LABEL_DECORATIONNODE_SYSML14;
setPapyrusCSSForceValueVisible(existingChild, TRUE);
isNameLabelCompartmentExist := true;
children += existingChild;
};
};
if(not isStereotypeLabelCompartmentExist){
var stereotypeLabelDecorationNode:notation::DecorationNode := createDefaultFloatingNameLabelDecorationNode(USAGE_STEREOTYPE_LABEL_DECORATIONNODE_SYSML14);
stereotypeLabelDecorationNode.layoutConstraint.oclAsType(notation::Location).y := 40;
children += stereotypeLabelDecorationNode;
};
if(not isNameLabelCompartmentExist){
var nameLabelDecorationNode:notation::DecorationNode := createDefaultFloatingNameLabelDecorationNode(USAGE_NAME_LABEL_DECORATIONNODE_SYSML14);
nameLabelDecorationNode.layoutConstraint.oclAsType(notation::Location).y := 60;
children += nameLabelDecorationNode;
};
}
mapping notation::Edge::fromSysML11StereotypeCommentLink() : notation::Edge when {self.type = STEREOTYPE_COMMENT_LINK} {
init {
result := self;
}
childrenToRemove += result;
}
mapping notation::Edge::fromSysML11DefaultEdge() : notation::Edge {
init {
result := self;
}
}