diff --git a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/ied/InputsAdapter.java b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/ied/InputsAdapter.java index 4adaf5587..f7a00a39f 100644 --- a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/ied/InputsAdapter.java +++ b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/ied/InputsAdapter.java @@ -249,14 +249,19 @@ public List updateAllSourceDataSetsAndControlBlocks() { return getExtRefs().stream() .filter(this::areBindingAttributesPresent) .filter(this::isExternalBound) - //TODO: replace filter below by criteria of issue #93 RSR-389 - // - Active or Untested i.e /IED/LDevice/LN0/Inputs/Private/compas:Flow @FlowStatus="ACTIVE" OR "UNTESTED" - .filter(extRef -> !getMatchingCompasFlows(extRef, compasFlows).isEmpty()) + .filter(extRef -> matchingCompasFlowIsActiveOrUntested(extRef, compasFlows)) .map(extRef -> updateSourceDataSetsAndControlBlocks(extRef, currentBayUuid)) .flatMap(Optional::stream) .toList(); } + private boolean matchingCompasFlowIsActiveOrUntested(TExtRef extRef, List compasFlows) { + return getMatchingCompasFlows(extRef, compasFlows).stream().findFirst() + .map(TCompasFlow::getFlowStatus) + .filter(flowStatus -> flowStatus == TCompasFlowStatus.ACTIVE || flowStatus == TCompasFlowStatus.UNTESTED) + .isPresent(); + } + private boolean isExternalBound(TExtRef tExtRef) { return !tExtRef.getIedName().equals(getIedAdapter().getName()); } @@ -300,7 +305,9 @@ private Optional updateSourceDataSetsAndControlBlocks(TExtRef ext } Optional sclReportItem = removeFilteredSourceDas(extRef, sourceDas); - //TODO: map to FCDA in issue #84 RSR-433 and remove print to console + //TODO: #83 follow-up : grouping ExtRef by serviceType, iedName, ldInst, isBayInternal, and DA@fc + // will be done by calculating DataSet Name in #84 RSR-433 + // TODO: map to FCDA in issue #84 RSR-433 and remove print to console String daToPrint = sourceDas.stream() .map(da -> da.getFc() + "#" + da.getDataAttributes()) .collect(Collectors.joining(",")); diff --git a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/ied/InputsAdapterForDemoTest.java b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/ied/InputsAdapterForDemoTest.java index 7526927a5..a4d95cab4 100644 --- a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/ied/InputsAdapterForDemoTest.java +++ b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/ied/InputsAdapterForDemoTest.java @@ -113,7 +113,9 @@ public static Stream provideUpdateAllSourceDataSetsAndControlBlocksIg Arguments.of(named("should ignore binding internal to IED", new String[]{"test ignore internal binding"})), Arguments.of(named("should ignore extref with missing binding attributes", - new String[]{"test ignore missing bindings attributes"})) + new String[]{"test ignore missing bindings attributes"})), + Arguments.of(named("should ignore extref when compas:Flow.FlowStatus is neither ACTIVE nor UNTESTED", + new String[]{"test ignore when compas:Flow.FlowStatus is neither ACTIVE nor UNTESTED"})) ); } } diff --git a/sct-commons/src/test/resources/scd-extref-create-dataset-and-controlblocks/scd_create_dataset_and_controlblocks_success.xml b/sct-commons/src/test/resources/scd-extref-create-dataset-and-controlblocks/scd_create_dataset_and_controlblocks_success.xml index 72d5a7a00..a1baab1fc 100644 --- a/sct-commons/src/test/resources/scd-extref-create-dataset-and-controlblocks/scd_create_dataset_and_controlblocks_success.xml +++ b/sct-commons/src/test/resources/scd-extref-create-dataset-and-controlblocks/scd_create_dataset_and_controlblocks_success.xml @@ -36,6 +36,7 @@ + @@ -61,6 +62,9 @@ + + +