Skip to content

Commit 32116f0

Browse files
committed
fix(#185): fix bug update extref cb
Signed-off-by: Aliou DIAITE <[email protected]> Signed-off-by: SABATIER Philippe Ext <[email protected]> Signed-off-by: Aliou DIAITE <[email protected]>
1 parent 5407cda commit 32116f0

File tree

10 files changed

+470
-382
lines changed

10 files changed

+470
-382
lines changed

sct-commons/src/main/java/org/lfenergy/compas/sct/commons/dto/DataSetInfo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public static DataSetInfo from(TDataSet tDataSet) {
6565
* @return Set of DataSetInfo
6666
*/
6767
public static Set<DataSetInfo> getDataSets(AbstractLNAdapter<? extends TAnyLN> lnAdapter){
68-
return lnAdapter.getDataSet(null)
68+
return lnAdapter.getDataSetMatchingExtRefInfo(null)
6969
.stream().map(DataSetInfo::from).collect(Collectors.toSet());
7070
}
7171

sct-commons/src/main/java/org/lfenergy/compas/sct/commons/dto/ExtRefInfo.java

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,8 @@
66

77

88
import lombok.*;
9-
import org.apache.commons.lang3.StringUtils;
109
import org.lfenergy.compas.scl2007b4.model.TExtRef;
1110
import org.lfenergy.compas.scl2007b4.model.TFCDA;
12-
import org.lfenergy.compas.scl2007b4.model.TLLN0Enum;
13-
import org.lfenergy.compas.sct.commons.scl.ied.AbstractLNAdapter;
14-
15-
import java.util.Objects;
1611
/**
1712
* A representation of the model object <em><b>ExtRef</b></em>.
1813
*
@@ -75,48 +70,6 @@ public static ExtRefInfo from(TExtRef tExtRef, String iedName, String ldInst,
7570
return extRefInfo;
7671
}
7772

78-
/**
79-
* Check match between FCDA and ExtRef information (for binding)
80-
* @param tfcda FCDA data object
81-
* @return match state
82-
*/
83-
//TODO this method should be checked, return if parameter tested are not present in FCDA even if two object are different
84-
public boolean matchFCDA(@NonNull TFCDA tfcda){
85-
boolean returnValue = true;
86-
if(AbstractLNAdapter.isFCDANull(tfcda)) {
87-
returnValue = false;
88-
}
89-
90-
if(tfcda.getLdInst() != null &&
91-
(bindingInfo == null || !tfcda.getLdInst().equals(bindingInfo.getLdInst()))){
92-
returnValue = false;
93-
}
94-
if (!tfcda.getLnClass().isEmpty() &&
95-
( bindingInfo == null || !tfcda.getLnClass().contains(bindingInfo.getLnClass())) ){
96-
returnValue = false;
97-
}
98-
99-
boolean isLN0 = tfcda.getLnClass().contains(TLLN0Enum.LLN_0.value());
100-
if (!isLN0 && tfcda.getLnInst() != null &&
101-
(bindingInfo == null || !tfcda.getLnInst().equals(bindingInfo.getLnInst()))) {
102-
returnValue = false;
103-
}
104-
if (!isLN0 && !StringUtils.isBlank(tfcda.getPrefix()) &&
105-
(bindingInfo == null || !tfcda.getPrefix().equals(bindingInfo.getPrefix()))) {
106-
returnValue = false;
107-
}
108-
109-
if(!StringUtils.isBlank(tfcda.getDoName()) &&
110-
(signalInfo == null || !Objects.equals(signalInfo.getPDO(),tfcda.getDoName())) ){
111-
returnValue = false;
112-
}
113-
114-
if(!StringUtils.isBlank(tfcda.getDaName()) &&
115-
(signalInfo == null || !Objects.equals(signalInfo.getPDA(),tfcda.getDaName())) ){
116-
returnValue = false;
117-
}
118-
return returnValue;
119-
}
12073
/**
12174
* Check matching between FCDA and ExtRef information (for external binding)
12275
* Check is done for parameter lDInst(mandatory), lNClass(mandatory), lNInst, prefix doName as pDO(mandatory) and daName as pDA

sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/SclService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ public static TExtRef updateExtRefSource(SCL scd, ExtRefInfo extRefInfo) throws
365365
if (bindingInfo == null || !bindingInfo.isValid()) {
366366
throw new ScdException(INVALID_OR_MISSING_ATTRIBUTES_IN_EXT_REF_BINDING_INFO);
367367
}
368-
if (bindingInfo.getIedName().equals(iedName)) {
368+
if (bindingInfo.getIedName().equals(iedName) || TServiceType.POLL.equals(bindingInfo.getServiceType())) {
369369
throw new ScdException("Internal binding can't have control block");
370370
}
371371
ExtRefSourceInfo sourceInfo = extRefInfo.getSourceInfo();
@@ -377,7 +377,7 @@ public static TExtRef updateExtRefSource(SCL scd, ExtRefInfo extRefInfo) throws
377377
IEDAdapter iedAdapter = sclRootAdapter.getIEDAdapterByName(iedName);
378378
LDeviceAdapter lDeviceAdapter = iedAdapter.findLDeviceAdapterByLdInst(ldInst)
379379
.orElseThrow(() -> new ScdException(String.format(UNKNOWN_LDEVICE_S_IN_IED_S, ldInst, iedName)));
380-
var anLNAdapter = AbstractLNAdapter.builder()
380+
AbstractLNAdapter<?> anLNAdapter = AbstractLNAdapter.builder()
381381
.withLDeviceAdapter(lDeviceAdapter)
382382
.withLnClass(lnClass)
383383
.withLnInst(lnInst)

0 commit comments

Comments
 (0)