Commit 31e648e0 authored by Simon Barner's avatar Simon Barner
Browse files

Safety Cases: Use Ca2Hw allocation table instead of Deployment

* Migrate (seemingly unused) Solution::deployment to
  ArgumentElement::af3Element
* Adjust UI

Issue-Ref: 3337
Issue-Url: https://af3-developer.fortiss.org/issues/3337

Signed-off-by: Simon Barner's avatarSimon Barner <barner@fortiss.org>
parent 0cbbb29e
ComponentAllocationMigration.java d8d02e0d40db0ffdabecd428294582e9ec4b34fe GREEN
DeploymentMigratorBase.java 5c0ef79263673718228b9427b0336607ce14bbc5 YELLOW
DeploymentToAllocationMigration.java fdf0f1ddd0d9ff1ab77866a43c10ffb01e9a615e YELLOW
DeploymentToAllocationMigration.java 9086087d032da0d9a6d897f23a1e1cdba91a1d23 YELLOW
VirtualLinkNameSetter.java e50d914f218e2712189dfe1010e86445f8940497 GREEN
......@@ -82,7 +82,7 @@ public class DeploymentToAllocationMigration implements IMigrationProvider {
new HashMap<>();
/** Number for migrators that must process a {@link Deployment} before it can be deleted. */
private static final int DEPLOYMENT_MIGRATOR_COUNT = 3;
private static final int DEPLOYMENT_MIGRATOR_COUNT = 4;
/** Unicode right arrow. */
public static final String RIGHT_ARROW = "\u2192";
......
......@@ -6,7 +6,7 @@ ConnectAwaySolutionToSolutionAction.java 13714efacea12ec49d9410c187b66d2d41f4b1e
ConnectContextToAF3TestSuiteAction.java 0513764bb0e6208b716ed2efb57a8a6481af5f36 GREEN
ConnectGoalToAF3LogicalComponentAction.java 792d22985a30eab7b30d90b4d8d20cbf55396240 GREEN
ConnectGoalToSafetyRequirementAction.java 2ac8050cfd428d6d8c55e9b0dc90480a53a5f6f5 GREEN
ConnectSolutionToAF3PlatformEvidenceAction.java 20db6a23b8f876b8259a19e5d766d5172a4b5418 GREEN
ConnectSolutionToAF3PlatformEvidenceAction.java c01f45d14cb45d3234a4123cb7913f42c8c198de YELLOW
ConnectSolutionToGeneratedCode.java 426397d3a0e02954ec90d1cf6a22e896ff0db395 GREEN
ConnectSolutionToTestCoverage.java 81223eee57d3c61c82068ddd126d9bccccc90c5f GREEN
ConnectSolutionToTestSuiteResult.java bbc85b4e5f46e2037ceccc47fceec3b9268c7fc2 GREEN
......
......@@ -17,8 +17,9 @@ package org.fortiss.af3.safetycases.ui.action;
import static org.eclipse.jface.dialogs.MessageDialog.openWarning;
import static org.eclipse.ui.plugin.AbstractUIPlugin.imageDescriptorFromPlugin;
import static org.fortiss.af3.allocation.utils.AllocationUtils.getAllocationTables;
import static org.fortiss.af3.safetycases.ui.AF3SafetyCasesUIActivator.PLUGIN_ID;
import static org.fortiss.af3.safetycases.ui.utils.AF3SelectionDialogUtils.openAF3PlaformElement;
import static org.fortiss.af3.safetycases.ui.utils.AF3SelectionDialogUtils.openAF3PlatformElement;
import static org.fortiss.af3.safetycases.ui.utils.AF3SelectionDialogUtils.openPlatformArchElements;
import static org.fortiss.tooling.kernel.service.IPersistencyService.getInstance;
import static org.fortiss.tooling.kernel.utils.KernelModelElementUtils.getRootElements;
......@@ -27,17 +28,17 @@ import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.swt.widgets.Shell;
import org.fortiss.af3.deployment.model.Deployment;
import org.fortiss.af3.platform.model.IPlatformArchitectureElement;
import org.fortiss.af3.platform.model.PlatformArchitecture;
import org.fortiss.af3.platform.model.allocation.ComponentToExecutionUnitAllocationTable;
import org.fortiss.af3.safetycases.model.Solution;
import org.fortiss.tooling.kernel.extension.data.ITopLevelElement;
import org.fortiss.tooling.kernel.model.INamedCommentedElement;
import org.fortiss.tooling.kernel.ui.extension.base.EObjectActionBase;
/**
* This class implements the action of designating a {@link Deployment} or
* {@link IPlatformArchitectureElement} as evidence artefact for the selected {@link Solution}.
* This class implements the action of designating a {@link ComponentToExecutionUnitAllocationTable}
* or {@link IPlatformArchitectureElement} as evidence artefact for the selected {@link Solution}.
*
* @author carlan
*/
......@@ -58,16 +59,18 @@ public class ConnectSolutionToAF3PlatformEvidenceAction extends EObjectActionBas
public void run() {
List<PlatformArchitecture> parchList =
getRootElements(getTarget(), PlatformArchitecture.class);
List<Deployment> deploymentList = getRootElements(getTarget(), Deployment.class);
List<ComponentToExecutionUnitAllocationTable> ca2hwList =
getAllocationTables(getTarget(), ComponentToExecutionUnitAllocationTable.class);
EObject selected = null;
if(getTarget().getAf3Element() != null) {
selected = getTarget().getAf3Element();
}
INamedCommentedElement selectedAF3Element = null;
if(!deploymentList.isEmpty() && !parchList.isEmpty()) {
if(!ca2hwList.isEmpty() && !parchList.isEmpty()) {
selectedAF3Element =
openAF3PlaformElement(shell.getShell(), parchList, deploymentList, selected);
} else if(deploymentList.isEmpty() && !parchList.isEmpty()) {
openAF3PlatformElement(shell.getShell(), parchList, ca2hwList, selected);
} else if(ca2hwList.isEmpty() && !parchList.isEmpty()) {
selectedAF3Element = openPlatformArchElements(shell.getShell(), parchList, null);
} else {
openWarning(shell.getShell(), "Warning", "There are no AF3 elements in this project!");
......
......@@ -20,7 +20,7 @@ GoalUndevelopedEntity.java 4ab84e5538b8635d3b10eed140419820921e4142 GREEN
MakeAChoice.java f8e7f4185bfeb451faf47b111826830aee3f55e3 GREEN
ReferenceGeneratedCode.java 6590ec697e97cd697a42631e64bc0b1f5b34814b GREEN
ReferenceMode.java cfc5caf7d1a3383f7612d6783b6035caeb9d4832 GREEN
ReferencePlatform.java 2bf53c7571dbf52c3b2e9a070b242f300d061220 GREEN
ReferencePlatform.java 9be1e6891fe5d409dfc0244ce55334fc968bab3d YELLOW
ReferenceRequirement.java d5c5a0ea563919d232d025a7ddd7eefa0857c060 GREEN
ReferenceState.java 6e5490151cbee5f29da14034150c2fd1bcdae60c GREEN
ReferenceTestCoverage.java a1421deffae77ad4cc0e620fffa189d06faba20c GREEN
......
......@@ -27,8 +27,8 @@ import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.IContributionItem;
import org.eclipse.swt.widgets.Display;
import org.fortiss.af3.deployment.model.Deployment;
import org.fortiss.af3.platform.model.IPlatformArchitectureElement;
import org.fortiss.af3.platform.model.allocation.ComponentToExecutionUnitAllocationTable;
import org.fortiss.af3.safetycases.model.Solution;
import org.fortiss.af3.safetycases.ui.AF3SafetyCasesUIActivator;
import org.fortiss.af3.safetycases.ui.action.ConnectSolutionToAF3PlatformEvidenceAction;
......@@ -36,8 +36,8 @@ import org.fortiss.tooling.kernel.ui.extension.IContextMenuContributor;
import org.fortiss.tooling.kernel.ui.extension.data.ContextMenuContextProvider;
/**
* This class implements the action of referencing a {@link Deployment} or an
* {@link IPlatformArchitectureElement} from a {@link Solution}.
* This class implements the action of referencing a {@link ComponentToExecutionUnitAllocationTable}
* or an {@link IPlatformArchitectureElement} from a {@link Solution}.
*
* @author carlan
*/
......
ArgumentElementPropertySection.java 728096650289b29ea5a3bfd76eb7e9218d9866a0 GREEN
ArgumentElementPropertySection.java 8571cba24d88bedbf16ff4c2e354906b39cc5b49 YELLOW
ArgumentModulePropertySection.java a96fcfeed6831cfe3cc145618b5ef7ea3ebf1d31 GREEN
AwayEntityPropertySection.java 6e9737df7398a89e4dc80053df796c69c8b6ed75 GREEN
ConnectionPropertySection.java 2b2a599565b440d4e3a74b4962a5e624d35b51f5 GREEN
......
......@@ -17,6 +17,7 @@ package org.fortiss.af3.safetycases.ui.properties;
import static org.eclipse.jface.dialogs.MessageDialog.openConfirm;
import static org.eclipse.swt.widgets.Display.getCurrent;
import static org.fortiss.af3.allocation.utils.AllocationUtils.getAllocationTables;
import static org.fortiss.af3.safetycases.model.SafetyCasesPackage.Literals.ARGUMENT_ELEMENT_BASE__GSN_ID;
import static org.fortiss.af3.safetycases.model.SafetyCasesPackage.Literals.ARGUMENT_ELEMENT_BASE__INFO_DOCUMENT_REFERENCE;
import static org.fortiss.af3.safetycases.model.SafetyCasesPackage.Literals.ARGUMENT_ELEMENT__TEXTUAL_INFORMATION;
......@@ -49,10 +50,10 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
import org.fortiss.af3.component.model.Component;
import org.fortiss.af3.deployment.model.Deployment;
import org.fortiss.af3.mode.model.Mode;
import org.fortiss.af3.mode.model.ModeAutomaton;
import org.fortiss.af3.platform.model.PlatformArchitecture;
import org.fortiss.af3.platform.model.allocation.ComponentToExecutionUnitAllocationTable;
import org.fortiss.af3.safetycases.model.ArgumentElementBase;
import org.fortiss.af3.safetycases.model.AwayArgumentElement;
import org.fortiss.af3.safetycases.model.AwaySolution;
......@@ -305,10 +306,11 @@ public class ArgumentElementPropertySection extends PropertySectionBase {
}
}
}
List<Deployment> deploymentList =
getRootElements(currentlySelectedGSNElement, Deployment.class);
for(Deployment d : deploymentList) {
af3ElementsNames[index++] = d.getName();
List<ComponentToExecutionUnitAllocationTable> ca2hwList = getAllocationTables(
currentlySelectedGSNElement, ComponentToExecutionUnitAllocationTable.class);
for(ComponentToExecutionUnitAllocationTable ca2hw : ca2hwList) {
af3ElementsNames[index++] = ca2hw.getName();
}
String[] proposals = new String[index];
index = 0;
......
AF3SelectionDialogUtils.java 9ba3edf94fd25207cbf1fb5e3024018224849ed6 GREEN
AF3SelectionDialogUtils.java 83c31a7d97b5bfacd14d194d730b39d33c941f1f YELLOW
GSNSelectionDialogUtils.java 01cdc5c80a6d678e47b39d4dbd571de15b283d8f GREEN
InstantiationOfGSNElementsUtils.java 7f928f584cf3d978c35e9aad3f93049f6e82c832 RED
MaintenanceUtils.java d283c302c902309eac641187b33a5737c833ce1d GREEN
......@@ -6,5 +6,5 @@ OptionEntityInstantiation.java 05f5cf61184d6db033b47d58c19492799468943e GREEN
SafetyCasesLibraryUIUtils.java 9496176dd4c161f58f48b2cf929f1d596cc08280 GREEN
StringToClaimValidator.java 468f6f2178b1e109e113e1ef5cf3e0fca3459028 GREEN
StringToGsnIdValidator.java 3f08520777cc58340136d52f3d2d6afe0cfa8201 GREEN
TextHyperlinkingUtils.java 61a18c1254ec816639424984092819df74f24489 YELLOW
TextHyperlinkingUtils.java ba5d347e417a7497adc94a63c9d8b61ec7686966 YELLOW
Utils.java 77b982f0c4426bc64bf3c94550fe962450e422a3 GREEN
......@@ -29,7 +29,6 @@ import org.eclipse.jface.window.Window;
import org.eclipse.swt.widgets.Shell;
import org.fortiss.af3.component.model.Component;
import org.fortiss.af3.component.model.ComponentArchitecture;
import org.fortiss.af3.deployment.model.Deployment;
import org.fortiss.af3.mira.model.Analysis;
import org.fortiss.af3.mira.model.Requirement;
import org.fortiss.af3.mira.model.RequirementsContainer;
......@@ -38,6 +37,7 @@ import org.fortiss.af3.mode.model.Mode;
import org.fortiss.af3.mode.model.ModeAutomaton;
import org.fortiss.af3.platform.model.IPlatformArchitectureElement;
import org.fortiss.af3.platform.model.PlatformArchitecture;
import org.fortiss.af3.platform.model.allocation.ComponentToExecutionUnitAllocationTable;
import org.fortiss.af3.state.model.State;
import org.fortiss.af3.state.model.StateAutomaton;
import org.fortiss.af3.testing.model.TestCase;
......@@ -180,19 +180,19 @@ public class AF3SelectionDialogUtils {
* The parent shell.
* @param parchList
* The platform architecture.
* @param deploymentList
* The deployment.
* @param ca2hwList
* The component to hardware platform architecture allocation table.
* @param selected
* The currently selected item from the platform or logical architecture or the
* deployment.
* @return The selected items from the tree dialog.
*/
public static INamedCommentedElement openAF3PlaformElement(final Shell shell,
List<PlatformArchitecture> parchList, List<Deployment> deploymentList,
EObject selected) {
List<IProjectRootElement> root = new ArrayList<IProjectRootElement>();
public static INamedCommentedElement openAF3PlatformElement(final Shell shell,
List<PlatformArchitecture> parchList,
List<ComponentToExecutionUnitAllocationTable> ca2hwList, EObject selected) {
List<IModelElement> root = new ArrayList<>();
root.addAll(parchList);
root.addAll(deploymentList);
root.addAll(ca2hwList);
ElementTreeSingleSelectDialog d = new ElementTreeSingleSelectDialog(shell, root, null,
new ModelElementTreeContentProvider(root) {
......
......@@ -16,6 +16,7 @@
package org.fortiss.af3.safetycases.ui.utils;
import static java.util.stream.Collectors.toList;
import static org.fortiss.af3.allocation.utils.AllocationUtils.getAllocationTables;
import static org.fortiss.af3.safetycases.utils.SafetyCasesUtils.getAllLogicalComponents;
import static org.fortiss.af3.safetycases.utils.SafetyCasesUtils.getAllOfSameType;
import static org.fortiss.af3.safetycases.utils.SafetyCasesUtils.getAllSafetyRequirements;
......@@ -40,12 +41,12 @@ import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.fortiss.af3.component.model.Component;
import org.fortiss.af3.component.model.ComponentArchitecture;
import org.fortiss.af3.deployment.model.Deployment;
import org.fortiss.af3.mira.model.Analysis;
import org.fortiss.af3.mira.model.Requirement;
import org.fortiss.af3.mode.model.Mode;
import org.fortiss.af3.mode.model.ModeAutomaton;
import org.fortiss.af3.platform.model.PlatformArchitecture;
import org.fortiss.af3.platform.model.allocation.ComponentToExecutionUnitAllocationTable;
import org.fortiss.af3.safetycases.model.ArgumentElement;
import org.fortiss.af3.safetycases.model.Goal;
import org.fortiss.af3.state.model.State;
......@@ -131,9 +132,10 @@ public class TextHyperlinkingUtils {
}
}
// Checking for references to deployments.
List<Deployment> listOfDeployments = getRootElements(argEle, Deployment.class);
string = identifyDeploymentNames(string, textualInfo, listOfDeployments);
// Checking for references to Component to Hardware allocations.
List<ComponentToExecutionUnitAllocationTable> listOfCa2Hw =
getAllocationTables(argEle, ComponentToExecutionUnitAllocationTable.class);
string = identifyCa2HwNames(string, textualInfo, listOfCa2Hw);
// Checking for references to platform architecture elements.
List<PlatformArchitecture> listOfParch =
......@@ -158,7 +160,7 @@ public class TextHyperlinkingUtils {
}
string = identifyGoalNames(string, textualInfo, listOfGoals);
createLink(link, string, listOfComponents, listOfModeAutomata, listOfStateAutomata,
listOfDeployments, listOfParch, listOfRequirements, listOfGoals);
listOfCa2Hw, listOfParch, listOfRequirements, listOfGoals);
shell.pack();
shell.open();
}
......@@ -248,16 +250,16 @@ public class TextHyperlinkingUtils {
}
/**
* This method detects the {@link Deployment} names inside a claim and turns them into
* links, so that the user can press on a link and (s)he will be directed to the module
* containing the respective deployment.
* This method detects the {@link ComponentToExecutionUnitAllocationTable} names inside a claim
* and turns them into links, so that the user can press on a link and (s)he will be directed to
* the module containing the respective deployment.
*/
static private String identifyDeploymentNames(String string, String textualInfo,
List<Deployment> deploymentList) {
for(Deployment d : deploymentList) {
if(textualInfo.contains(d.getName()) &&
!string.contains("<a>" + d.getName() + "</a>")) {
string = string.replace(d.getName(), "<a>" + d.getName() + "</a>");
static private String identifyCa2HwNames(String string, String textualInfo,
List<ComponentToExecutionUnitAllocationTable> ca2hwList) {
for(ComponentToExecutionUnitAllocationTable ca2hw : ca2hwList) {
if(textualInfo.contains(ca2hw.getName()) &&
!string.contains("<a>" + ca2hw.getName() + "</a>")) {
string = string.replace(ca2hw.getName(), "<a>" + ca2hw.getName() + "</a>");
}
}
return string;
......@@ -311,7 +313,7 @@ public class TextHyperlinkingUtils {
* @param listOfComponents
* The list of existing components.
* @param listOfParch
* @param listOfDeployments
* @param listOfCa2Hw
* @param listOfStateAutomata
* @param listOfModeAutomata
* @param listOfRequirements
......@@ -321,7 +323,8 @@ public class TextHyperlinkingUtils {
*/
public static void createLink(Link link, String string,
final ArrayList<Component> listOfComponents, EList<ModeAutomaton> listOfModeAutomata,
EList<StateAutomaton> listOfStateAutomata, List<Deployment> listOfDeployments,
EList<StateAutomaton> listOfStateAutomata,
List<ComponentToExecutionUnitAllocationTable> listOfCa2Hw,
List<PlatformArchitecture> listOfParch, final ArrayList<Requirement> listOfRequirements,
final ArrayList<ArgumentElement> listOfGoals) {
link.setText(string);
......@@ -331,7 +334,7 @@ public class TextHyperlinkingUtils {
@Override
public void handleEvent(Event event) {
openMatchingElementsInEditor(event, listOfComponents, this::getName);
openMatchingElementsInEditor(event, listOfDeployments, this::getName);
openMatchingElementsInEditor(event, listOfCa2Hw, this::getName);
openMatchingElementsInEditor(event, listOfGoals, this::getName);
openMatchingElementsInEditor(event, listOfRequirements, this::getReqId);
......
requirementspatterns.ecore b2f09bfc949bafb0392929115b3c0321bf2b192c RED
safetyargumentationpackage.ecore e95d1c0c64d12fa1660899df86cc9009dbae1754 RED
safetycases.ecore 7ffa8dcf923a5375ab8a419a2d8a12a24dbc6647 RED
safetycases.ecore 260263d765a269c466d7a8c6c8dcff1922b0f4d7 YELLOW
......@@ -10,7 +10,11 @@
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Solution" eSuperTypes="#//SpinalElement">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="visibility" eType="#//VISIBILITY"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="deployment" eType="ecore:EClass platform:/resource/org.fortiss.af3.deployment/model/deployment.ecore#//Deployment"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="deployment" eType="ecore:EClass platform:/resource/org.fortiss.af3.deployment/model/deployment.ecore#//Deployment">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="@deprecated"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="status" eType="#//EvidenceStatus"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="safetyRequirement" eType="ecore:EClass platform:/resource/org.fortiss.af3.mira/model/mira.ecore#//Requirement"/>
</eClassifiers>
......
......@@ -339,5 +339,8 @@
objectClass="org.fortiss.af3.safetycases.model.ModuleRef">
</objectClass>
</migrationProvider>
<migrationProvider migrationProvider="org.fortiss.af3.safetycases.migration.SolutionDeploymentToCa2HwMigration">
<objectClass objectClass="org.fortiss.af3.safetycases.model.Solution"/>
</migrationProvider>
</extension>
</plugin>
SafetyModuleRefMigrator.java 92f069d3152ecc54abfa7d1024d321b3ee0abdfa GREEN
SolutionDeploymentToCa2HwMigration.java 604fa167bf676dbf76a92826a127605b3369bf8e YELLOW
/*-------------------------------------------------------------------------+
| Copyright 2018 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.safetycases.migration;
import org.fortiss.af3.deployment.migration.DeploymentMigratorBase;
import org.fortiss.af3.deployment.model.Deployment;
import org.fortiss.af3.platform.model.allocation.ComponentToExecutionUnitAllocationTable;
import org.fortiss.af3.safetycases.model.Solution;
/**
* Migration provider that replaces a {@link Deployment} referenced in
* {@code Solution::deployment} with a {@link ComponentToExecutionUnitAllocationTable} referenced
* in {@code ArgumentElement::af3Element}.
*
* @author barner
*/
@SuppressWarnings("deprecation")
public class SolutionDeploymentToCa2HwMigration extends DeploymentMigratorBase<Solution> {
/** Constructor */
public SolutionDeploymentToCa2HwMigration() {
super(Solution.class);
}
/** {@inheritDoc} */
@Override
protected Deployment getDeployment(Solution solution) {
return solution.getDeployment();
}
/** {@inheritDoc} */
@Override
protected void migrateElement(Solution solution,
ComponentToExecutionUnitAllocationTable ca2hw) {
solution.setDeployment(null);
solution.setAf3Element(ca2hw);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment