Skip to content

Commit 2692ce9

Browse files
committed
refactor(core): move more code from transpose flow graph into separate methods
1 parent fcad3d9 commit 2692ce9

File tree

2 files changed

+167
-146
lines changed

2 files changed

+167
-146
lines changed

bundles/mdpa.gdpr.analysis/src/mdpa/gdpr/analysis/UncertaintyUtils.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
import java.util.ArrayList;
44
import java.util.List;
5+
import java.util.NoSuchElementException;
6+
import java.util.Optional;
7+
58
import mdpa.gdpr.analysis.core.ContextDependentAttributeScenario;
69
import mdpa.gdpr.analysis.core.ContextDependentAttributeSource;
710
import mdpa.gdpr.analysis.dfd.DFDGDPRTransposeFlowGraph;
@@ -181,17 +184,19 @@ public static Behavior createBehavior(DFDGDPRVertex impactedElement, DataDiction
181184
List<Label> values = UncertaintyUtils.getAppliedLabel(scenario, source, dd);
182185

183186
List<Pin> inputPins = behaviour.getInPin();
184-
Pin outputPin = behaviour.getOutPin()
187+
Optional<Pin> outputPin = behaviour.getOutPin()
185188
.stream()
186189
.filter(it -> it.getEntityName()
187190
.equals(targetData.getEntityName()))
188-
.findAny()
189-
.orElseThrow();
191+
.findAny();
192+
if (outputPin.isEmpty()) {
193+
return behaviour;
194+
}
190195
Assignment attributeAssignment = datadictionaryFactory.eINSTANCE.createAssignment();
191196
attributeAssignment.setTerm(datadictionaryFactory.eINSTANCE.createTRUE());
192197
attributeAssignment.getInputPins()
193198
.addAll(inputPins);
194-
attributeAssignment.setOutputPin(outputPin);
199+
attributeAssignment.setOutputPin(outputPin.get());
195200
attributeAssignment.getOutputLabels()
196201
.addAll(values);
197202
assignments.add(attributeAssignment);

0 commit comments

Comments
 (0)