Skip to content

Commit

Permalink
[567857] Cannot save model after IS transition from PA to EPBS (#400)
Browse files Browse the repository at this point in the history
- disabled the transition of
AbstractFunctionAbstractCapabilityInvolvement from PA to EPBS


Change-Id: I80435457b3bb2cad8fc3a83d9578eb9bea12116e
Signed-off-by: Georgiana Ecobici <[email protected]>
  • Loading branch information
georgiana-ecobici authored Oct 14, 2020
1 parent 857bcbd commit 96c749c
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,16 @@
*******************************************************************************/
package org.polarsys.capella.core.transition.system.topdown.rules.interaction;

import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.EObject;
import org.polarsys.capella.core.data.interaction.AbstractFunctionAbstractCapabilityInvolvement;
import org.polarsys.capella.core.data.interaction.InteractionPackage;
import org.polarsys.capella.core.data.pa.PhysicalFunction;
import org.polarsys.capella.core.transition.common.constants.Messages;
import org.polarsys.capella.core.transition.system.topdown.rules.common.InvolvementRule;
import org.polarsys.kitalpha.transposer.rules.handler.rules.api.IContext;

/**
*
Expand All @@ -26,5 +32,17 @@ public class FunctionCapabilityInvolvementRule extends InvolvementRule {
protected EClass getSourceType() {
return InteractionPackage.Literals.ABSTRACT_FUNCTION_ABSTRACT_CAPABILITY_INVOLVEMENT;
}

/**
* {@inheritDoc}
*/
@Override
public IStatus transformRequired(EObject element_p, IContext context_p) {
AbstractFunctionAbstractCapabilityInvolvement involvement = (AbstractFunctionAbstractCapabilityInvolvement) element_p;
if (involvement.getInvolved() instanceof PhysicalFunction) {
return new Status(IStatus.WARNING, Messages.Activity_Transformation, "involvement not transitioned");
}
return super.transformRequired(element_p, context_p);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ Require-Bundle: org.eclipse.ui,
org.polarsys.capella.core.transition.system.topdown.ui,
org.eclipse.emf.diffmerge.ui,
org.polarsys.capella.core.re.ui,
org.polarsys.capella.common.re.ui
org.polarsys.capella.common.re.ui,
org.polarsys.capella.core.data.interaction.validation
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-Vendor: %providerName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
<description xmi:type="description_2:SequenceDiagramDescription" href="platform:/plugin/org.polarsys.capella.core.sirius.analysis/description/oa.odesign#//@ownedViewpoints[name='Operational%20Analysis']/@ownedRepresentations[name='Activity%20Interaction%20Scenario']"/>
<target xmi:type="org.polarsys.capella.core.data.interaction:Scenario" href="CreateRule_Scenario.melodymodeller#d257c3dc-b4f2-4e7c-91f3-61c465e53a21"/>
</ownedRepresentationDescriptors>
<ownedRepresentationDescriptors xmi:type="viewpoint:DRepresentationDescriptor" uid="_8CNPUApBEeuRHtXv-7vWfA" name="[OAS] OperationalCapability 3" repPath="#_8CKMAApBEeuRHtXv-7vWfA" changeId="694445b4-c321-4d2a-a214-3e4560e9ea19">
<ownedRepresentationDescriptors xmi:type="viewpoint:DRepresentationDescriptor" uid="_8CNPUApBEeuRHtXv-7vWfA" name="[OAS] OperationalCapability 3" repPath="#_8CKMAApBEeuRHtXv-7vWfA" changeId="fda2de73-b023-4e9c-a5fa-94add6db8a6e">
<description xmi:type="description_2:SequenceDiagramDescription" href="platform:/plugin/org.polarsys.capella.core.sirius.analysis/description/oa.odesign#//@ownedViewpoints[name='Operational%20Analysis']/@ownedRepresentations[name='Activity%20Interaction%20Scenario']"/>
<target xmi:type="org.polarsys.capella.core.data.interaction:Scenario" href="CreateRule_Scenario.melodymodeller#b02a5f31-328b-4639-828e-a156aaeb2adf"/>
</ownedRepresentationDescriptors>
Expand Down Expand Up @@ -27103,7 +27103,7 @@
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_AioGhApCEeuRHtXv-7vWfA"/>
</children>
<styles xmi:type="notation:ShapeStyle" xmi:id="_AilqQQpCEeuRHtXv-7vWfA" fontColor="4210779" fontName="Segoe UI" fontHeight="8"/>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_AilqQgpCEeuRHtXv-7vWfA" x="358" y="50" width="100" height="50"/>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_AilqQgpCEeuRHtXv-7vWfA" x="395" y="50" width="100" height="50"/>
</children>
<children xmi:type="notation:Node" xmi:id="_UNXLwApCEeuRHtXv-7vWfA" type="2002" element="_UM1AQApCEeuRHtXv-7vWfA">
<children xmi:type="notation:Node" xmi:id="_UNXy0ApCEeuRHtXv-7vWfA" type="5006"/>
Expand All @@ -27112,7 +27112,7 @@
<styles xmi:type="notation:FilteringStyle" xmi:id="_UNXy0wpCEeuRHtXv-7vWfA"/>
</children>
<styles xmi:type="notation:ShapeStyle" xmi:id="_UNXLwQpCEeuRHtXv-7vWfA" fontName="Segoe UI" fontHeight="8"/>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_UNXLwgpCEeuRHtXv-7vWfA" x="358" y="244" width="100" height="50"/>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_UNXLwgpCEeuRHtXv-7vWfA" x="395" y="244" width="100" height="50"/>
</children>
<styles xmi:type="notation:DiagramStyle" xmi:id="_8CN2YgpBEeuRHtXv-7vWfA"/>
</data>
Expand All @@ -27124,7 +27124,7 @@
<target xmi:type="org.polarsys.capella.core.data.interaction:InstanceRole" href="CreateRule_Scenario.melodymodeller#0b85dd80-bcf8-48cc-91da-e593b7248470"/>
<semanticElements xmi:type="org.polarsys.capella.core.data.interaction:InstanceRole" href="CreateRule_Scenario.melodymodeller#0b85dd80-bcf8-48cc-91da-e593b7248470"/>
<semanticElements xmi:type="org.polarsys.capella.core.data.oa:OperationalActivity" href="CreateRule_Scenario.melodymodeller#323e08e4-0d7d-4775-a7ac-a9bdba0b22dc"/>
<graphicalFilters xmi:type="diagram:AbsoluteBoundsFilter" uid="_AiAbcApCEeuRHtXv-7vWfA" x="358" y="50" height="50" width="100"/>
<graphicalFilters xmi:type="diagram:AbsoluteBoundsFilter" uid="_AiAbcApCEeuRHtXv-7vWfA" x="395" y="50" height="50" width="100"/>
<ownedBorderedNodes xmi:type="diagram:DNode" uid="_Ah_0YApCEeuRHtXv-7vWfA" width="1" height="40" resizeKind="NSEW">
<target xmi:type="org.polarsys.capella.core.data.interaction:InstanceRole" href="CreateRule_Scenario.melodymodeller#0b85dd80-bcf8-48cc-91da-e593b7248470"/>
<semanticElements xmi:type="org.polarsys.capella.core.data.interaction:InstanceRole" href="CreateRule_Scenario.melodymodeller#0b85dd80-bcf8-48cc-91da-e593b7248470"/>
Expand Down Expand Up @@ -27153,7 +27153,7 @@
<semanticElements xmi:type="org.polarsys.capella.core.data.interaction:InteractionUse" href="CreateRule_Scenario.melodymodeller#5b9533fa-c5ae-4a9e-9ab7-a2c9fa0f4e59"/>
<semanticElements xmi:type="org.polarsys.capella.core.data.interaction:Scenario" href="CreateRule_Scenario.melodymodeller#2341b930-cc46-43d3-84c5-fb87723b6b3f"/>
<semanticElements xmi:type="org.polarsys.capella.core.data.oa:OperationalCapability" href="CreateRule_Scenario.melodymodeller#b1a280cf-99c6-4706-8aa9-e3de47fe03c1"/>
<graphicalFilters xmi:type="diagram:AbsoluteBoundsFilter" uid="_UM1nUQpCEeuRHtXv-7vWfA" x="358" y="244" height="50" width="100"/>
<graphicalFilters xmi:type="diagram:AbsoluteBoundsFilter" uid="_UM1nUQpCEeuRHtXv-7vWfA" x="395" y="244" height="50" width="100"/>
<ownedStyle xmi:type="diagram:FlatContainerStyle" uid="_UM1AQQpCEeuRHtXv-7vWfA" showIcon="false" labelAlignment="LEFT" borderSize="1" borderSizeComputationExpression="1" foregroundColor="242,242,242">
<description xmi:type="style:FlatContainerStyleDescription" href="platform:/plugin/org.polarsys.capella.core.sirius.analysis/description/oa.odesign#//@ownedViewpoints[name='Operational%20Analysis']/@ownedRepresentations[name='Activity%20Interaction%20Scenario']/@defaultLayer/@containerMappings[name='InteractionUse%20AIS']/@style"/>
</ownedStyle>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15439,6 +15439,8 @@
</ownedScenarios>
<ownedAbstractFunctionAbstractCapabilityInvolvements xsi:type="org.polarsys.capella.core.data.interaction:AbstractFunctionAbstractCapabilityInvolvement"
id="6dc92729-ed27-475d-a1c5-0468205599ae" involved="#323e08e4-0d7d-4775-a7ac-a9bdba0b22dc"/>
<ownedAbstractFunctionAbstractCapabilityInvolvements xsi:type="org.polarsys.capella.core.data.interaction:AbstractFunctionAbstractCapabilityInvolvement"
id="582d592e-aca6-4436-bd2b-f0f05907e6c6" involved="#6cef04a3-4469-4034-af16-e197709575d8"/>
</ownedOperationalCapabilities>
<ownedOperationalCapabilities xsi:type="org.polarsys.capella.core.data.oa:OperationalCapability"
id="7483536b-d505-4fdc-9816-6f7f3d73b9d8" name="OperationalCapability 4">
Expand Down Expand Up @@ -16228,5 +16230,24 @@
id="5bb8acd3-c606-4ccd-9d96-a9e38f17e3e6" targetElement="#9d32828d-c9a3-4a27-9e32-ad326e409306"
sourceElement="#3a7b9a6b-2c1e-4058-b1f4-be73fab19087"/>
</ownedArchitectures>
<ownedArchitectures xsi:type="org.polarsys.capella.core.data.epbs:EPBSArchitecture"
id="9751852c-0ebe-49a2-87a5-e8dbfc2af7ee" name="EPBS Architecture">
<ownedAbstractCapabilityPkg xsi:type="org.polarsys.capella.core.data.la:CapabilityRealizationPkg"
id="60f7f68d-289a-4dd9-9bed-da1fff21afc9" name="Capabilities"/>
<ownedConfigurationItemPkg xsi:type="org.polarsys.capella.core.data.epbs:ConfigurationItemPkg"
id="cba448fa-b958-4a7e-a7ea-4d041558f40f" name="Structure">
<ownedParts xsi:type="org.polarsys.capella.core.data.cs:Part" id="fee4c4f1-66a4-427c-9518-e833ccbdbc50"
name="System" abstractType="#746e99bd-8200-492f-ac45-784ff0fa8021"/>
<ownedConfigurationItems xsi:type="org.polarsys.capella.core.data.epbs:ConfigurationItem"
id="746e99bd-8200-492f-ac45-784ff0fa8021" name="System" kind="SystemCI">
<ownedPhysicalArtifactRealizations xsi:type="org.polarsys.capella.core.data.epbs:PhysicalArtifactRealization"
id="59ffb2e4-3743-46ac-97bc-3cca9ef75309" targetElement="#ec7604f5-e0b0-4b6a-94d4-628bb4b37be7"
sourceElement="#746e99bd-8200-492f-ac45-784ff0fa8021"/>
</ownedConfigurationItems>
</ownedConfigurationItemPkg>
<ownedPhysicalArchitectureRealizations xsi:type="org.polarsys.capella.core.data.epbs:PhysicalArchitectureRealization"
id="e3f8dcce-de8e-4e4b-9ed3-51253ef46226" targetElement="#3a7b9a6b-2c1e-4058-b1f4-be73fab19087"
sourceElement="#9751852c-0ebe-49a2-87a5-e8dbfc2af7ee"/>
</ownedArchitectures>
</ownedModelRoots>
</org.polarsys.capella.core.data.capellamodeller:Project>
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@
import java.util.Arrays;
import java.util.List;

import org.eclipse.emf.common.util.EList;
import org.polarsys.capella.core.data.capellacore.Involvement;
import org.polarsys.capella.core.data.interaction.InteractionPackage;
import org.polarsys.capella.core.data.interaction.InteractionUse;
import org.polarsys.capella.core.data.interaction.Scenario;
import org.polarsys.capella.core.data.interaction.validation.interactionUse.MDCHK_InteractionUse_ReferencedScenario;
import org.polarsys.capella.core.data.la.CapabilityRealization;
import org.polarsys.capella.test.transition.ju.TopDownTransitionTestCase;

/**
Expand Down Expand Up @@ -57,6 +61,9 @@ public class ReferencedScenarios_02 extends TopDownTransitionTestCase {
public static final String INTERACTIONUSE_OES_OPERATIONALCAPABILITY_2 = "0c1ada3b-b6ec-45f8-b6bd-c5110e352a54"; //$NON-NLS-1$
public static final String INTERACTIONUSE_OES_OPERATIONALCAPABILITY_2_1 = "fed23a79-5aa4-4dec-8bd5-f36833599e1f"; //$NON-NLS-1$

Scenario prevScenario;
InteractionUse prevReference;

@Override
public List<String> getRequiredTestModels() {
return Arrays.asList("CreateRule_Scenario");
Expand All @@ -69,6 +76,9 @@ public void performTest() throws Exception {
step3();
step4();
step5();
step6();
step7();
step8();
}

/*
Expand Down Expand Up @@ -103,6 +113,9 @@ private void checksStep1() {
InteractionUse reference4 = (InteractionUse) mustBeTransitionedTo(INTERACTIONUSE_OAS_OPERATIONALCAPABILITY_3_B_1,
InteractionPackage.Literals.INTERACTION_USE, scenario3);
assertTrue(reference4.getReferencedScenario().equals(scenario1));

prevScenario = scenario1;
prevReference = reference1;
}

/*
Expand Down Expand Up @@ -167,7 +180,7 @@ private void step4() {
// checks for OAS_OPERATIONALCAPABILITY_3
checksStep1();
}

/*
* OES to ES (System), when an invalid scenario is referenced
*/
Expand All @@ -186,4 +199,48 @@ private void step5() {
InteractionPackage.Literals.INTERACTION_USE, scenario1);
assertTrue(reference3.getReferencedScenario() == null);
}

/*
* continue the transition started at step1 FS (System) to FS Logical
*/
private void step6() {
performFStoFSTransition(Arrays.asList(prevScenario));

Scenario scenario = mustBeTransitioned(prevScenario.getId());

InteractionUse reference1 = (InteractionUse) mustBeTransitionedTo(prevReference.getId(),
InteractionPackage.Literals.INTERACTION_USE, scenario);

assertTrue(reference1.getReferencedScenario() != null);
assertTrue(new MDCHK_InteractionUse_ReferencedScenario().isValidReference(reference1, scenario,
reference1.getReferencedScenario()));

prevScenario = scenario;
prevReference = reference1;
}

/*
* continue the transition started at step6 FS (Logical) to FS Physical
*/
private void step7() {
step6();
}

/*
* continue the transition started at step7 FS (Physical) to IS, then IS to EPBS
*/
private void step8() {
performFStoESTransition(Arrays.asList(prevScenario));
Scenario scenario = mustBeTransitioned(prevScenario.getId());

performEStoISTransition(Arrays.asList(scenario));
Scenario scenarioIS = mustBeTransitioned(scenario.getId());

performIStoISTransition(Arrays.asList(scenarioIS));
Scenario scenarioEPBS = mustBeTransitioned(scenarioIS.getId());

// AbstractFunctionAbstractCapabilityInvolvement shall not be transited to EPBS
EList<Involvement> involvements = ((CapabilityRealization) scenarioEPBS.eContainer()).getInvolvedInvolvements();
assertTrue(involvements.isEmpty());
}
}

0 comments on commit 96c749c

Please sign in to comment.