Commit b44bd6e1 authored by Liana Soima's avatar Liana Soima

Accountability for Assurance Cases

Signed-off-by: Liana Soima's avatarLiana Soima <soima@fortiss.org>
Issue-Ref: 4114
parent 0c30cae8
......@@ -21,6 +21,8 @@ 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__CREATOR;
import static org.fortiss.af3.safetycases.model.SafetyCasesPackage.Literals.ARGUMENT_ELEMENT__LAST_MODIFIED;
import static org.fortiss.af3.safetycases.model.SafetyCasesPackage.Literals.ARGUMENT_ELEMENT__TEXTUAL_INFORMATION;
import static org.fortiss.af3.safetycases.utils.SafetyCasesUtils.getAllLogicalComponents;
import static org.fortiss.tooling.kernel.service.IPersistencyService.getInstance;
......@@ -41,6 +43,13 @@ import java.util.regex.Pattern;
import org.apache.commons.lang.ArrayUtils;
import org.eclipse.emf.common.util.EList;
import org.eclipse.jface.fieldassist.ControlDecoration;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.ComboViewer;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
......@@ -63,6 +72,8 @@ 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.safetycases.model.ASSESSMENT_STATUS;
import org.fortiss.af3.safetycases.model.ArgumentElement;
import org.fortiss.af3.safetycases.model.ArgumentElementBase;
import org.fortiss.af3.safetycases.model.AwayArgumentElement;
import org.fortiss.af3.safetycases.model.AwaySolution;
......@@ -77,6 +88,7 @@ import org.fortiss.tooling.base.ui.fieldassist.FieldAssist;
import org.fortiss.tooling.base.ui.fieldassist.ProposalProviderBase;
import org.fortiss.tooling.kernel.extension.data.ITopLevelElement;
import org.fortiss.tooling.kernel.model.INamedElement;
import org.fortiss.tooling.kernel.service.IPersistencyService;
import org.fortiss.tooling.kernel.ui.extension.base.PropertySectionBase;
/**
......@@ -113,6 +125,23 @@ public class ArgumentElementPropertySection extends PropertySectionBase {
/** {@link Link} to display the referenced document path. */
private Link documentReferenceLink;
/** {@link Text} to display the name of the creator. */
private Text creatorText;
/** {@link Text} to display last modified date. */
private Text lastModifiedText;
/** Combobox for the assessment of argument elements. */
private ComboViewer assessmentStatusCombo;
/**
* Flag to know whether the selection is made by the class or by the user.
* Needed because a "selected" event is triggered in all cases and we do not want to register
* any transaction if the change does not come from the user. Not so nice but the interface of
* the ComboViewer does not provide any tool allowing to do better.
*/
private boolean userSelection;
/** Constructor. */
public ArgumentElementPropertySection() {
super();
......@@ -137,7 +166,9 @@ public class ArgumentElementPropertySection extends PropertySectionBase {
e.printStackTrace();
}
}
creatorText = createFormText("Creator");
lastModifiedText = createFormText("Last modified");
createAssessmentDropDown();
documentReferenceLabel = getWidgetFactory().createLabel(composite, "Document Ref");
documentReferenceLabel.setToolTipText(
"The claim made by this argument element is backed by this document");
......@@ -222,6 +253,10 @@ public class ArgumentElementPropertySection extends PropertySectionBase {
@Override
protected void setSectionInput(Object input) {
currentlySelectedGSNElement = (ArgumentElementBase)input;
userSelection = false;
assessmentStatusCombo.setSelection(new StructuredSelection(
((ArgumentElement)currentlySelectedGSNElement).getAssessmentStatus()));
userSelection = true;
}
/** {@inheritDoc} */
......@@ -255,6 +290,14 @@ public class ArgumentElementPropertySection extends PropertySectionBase {
performComplexTextBinding(dbc, claimText,
observeValue(currentlySelectedGSNElement, ARGUMENT_ELEMENT__TEXTUAL_INFORMATION),
null, null, null, null);
// code for binding creator
performComplexTextBinding(dbc, creatorText,
observeValue(currentlySelectedGSNElement, ARGUMENT_ELEMENT__CREATOR), null, null,
null, null);
// code for binding last modified Date
performComplexTextBinding(dbc, lastModifiedText,
observeValue(currentlySelectedGSNElement, ARGUMENT_ELEMENT__LAST_MODIFIED), null,
null, null, null);
// code for binding document reference explanation
performComplexTextBinding(dbc, documentReferenceExplText,
observeValue(currentlySelectedGSNElement,
......@@ -433,6 +476,55 @@ public class ArgumentElementPropertySection extends PropertySectionBase {
return proposals;
}
/** Creates ComboViewer for assessment of assurance cases. */
private void createAssessmentDropDown() {
assessmentStatusCombo = createFormComboViewer("Assessment Status");
assessmentStatusCombo.setContentProvider(new ArrayContentProvider());
assessmentStatusCombo.setLabelProvider(new LabelProvider() {
@Override
public String getText(Object element) {
if(element instanceof ASSESSMENT_STATUS) {
ASSESSMENT_STATUS status = (ASSESSMENT_STATUS)element;
if(status.equals(ASSESSMENT_STATUS.NOT_REVIEWED)) {
return "Not Reviewed";
} else if(status.equals(ASSESSMENT_STATUS.REVIEW_LATER)) {
return "Review Later";
} else if(status.equals(ASSESSMENT_STATUS.ACCEPTED)) {
return "Accepted";
} else if(status.equals(ASSESSMENT_STATUS.WEAK)) {
return "Weak";
} else {
return "Incorrect";
}
}
return null;
}
});
assessmentStatusCombo.setInput(ASSESSMENT_STATUS.values());
assessmentStatusCombo.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection sel = (IStructuredSelection)event.getSelection();
final ASSESSMENT_STATUS value = (ASSESSMENT_STATUS)sel.getFirstElement();
if(userSelection && sel.getFirstElement() instanceof ASSESSMENT_STATUS) {
assessmentStatusChangeHandler(value);
}
}
});
}
/** Store the value of assessment status when it changes. */
private void assessmentStatusChangeHandler(final ASSESSMENT_STATUS value) {
ITopLevelElement topLevel = IPersistencyService.getInstance()
.getTopLevelElementFor(currentlySelectedGSNElement);
topLevel.runAsCommand(new Runnable() {
@Override
public void run() {
((ArgumentElement)currentlySelectedGSNElement).setAssessmentStatus(value);
}
});
}
/**
* Look in the claimText for the following patterns: "@state()", "@mode()", "@component()",
* "@requirement()", "@platform()", "@allocation()". These patterns will be used in the
......
......@@ -319,6 +319,10 @@
eType="ecore:EClass platform:/resource/org.fortiss.af3.component/model/component.ecore#//Component"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="referencedRequirements"
upperBound="-1" eType="ecore:EClass platform:/resource/org.fortiss.af3.mira/model/mira.ecore#//Requirement"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="creator" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="lastModified" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="assessmentStatus" eType="#//ASSESSMENT_STATUS"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="lastAssessmentDate" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EDate"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="AwayContractModule" eSuperTypes="#//ContractModule #//AwayArgumentElement #//DecomposableSpinalElement"/>
<eClassifiers xsi:type="ecore:EEnum" name="EvidenceStatus">
......@@ -360,4 +364,11 @@
eType="#//TypeOfChange"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="maintainanceCause" eType="#//maintenanceStatus"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EEnum" name="ASSESSMENT_STATUS">
<eLiterals name="Not_Reviewed"/>
<eLiterals name="Accepted" value="2"/>
<eLiterals name="Incorrect" value="4"/>
<eLiterals name="Weak" value="3"/>
<eLiterals name="Review_Later" value="1"/>
</eClassifiers>
</ecore:EPackage>
......@@ -43,6 +43,13 @@
<genEnumLiterals ecoreEnumLiteral="safetycases.ecore#//TypeOfChange/Modified"/>
<genEnumLiterals ecoreEnumLiteral="safetycases.ecore#//TypeOfChange/Delete"/>
</genEnums>
<genEnums typeSafeEnumCompatible="false" ecoreEnum="safetycases.ecore#//ASSESSMENT_STATUS">
<genEnumLiterals ecoreEnumLiteral="safetycases.ecore#//ASSESSMENT_STATUS/Not_Reviewed"/>
<genEnumLiterals ecoreEnumLiteral="safetycases.ecore#//ASSESSMENT_STATUS/Accepted"/>
<genEnumLiterals ecoreEnumLiteral="safetycases.ecore#//ASSESSMENT_STATUS/Incorrect"/>
<genEnumLiterals ecoreEnumLiteral="safetycases.ecore#//ASSESSMENT_STATUS/Weak"/>
<genEnumLiterals ecoreEnumLiteral="safetycases.ecore#//ASSESSMENT_STATUS/Review_Later"/>
</genEnums>
<genClasses ecoreClass="safetycases.ecore#//Goal">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute safetycases.ecore#//Goal/toBeSupportedByContract"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute safetycases.ecore#//Goal/type"/>
......@@ -211,6 +218,10 @@
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference safetycases.ecore#//ArgumentElement/referencedDeployments"/>
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference safetycases.ecore#//ArgumentElement/referencedComponents"/>
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference safetycases.ecore#//ArgumentElement/referencedRequirements"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute safetycases.ecore#//ArgumentElement/creator"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute safetycases.ecore#//ArgumentElement/lastModified"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute safetycases.ecore#//ArgumentElement/assessmentStatus"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute safetycases.ecore#//ArgumentElement/lastAssessmentDate"/>
<genOperations ecoreOperation="safetycases.ecore#//ArgumentElement/getContainerSafetyCase"
body="return (SafetyCase)getContainer().eContainer();"/>
<genOperations ecoreOperation="safetycases.ecore#//ArgumentElement/getModule"
......
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