Skip to content

Commit

Permalink
Conflict resolution for merge into main branch
Browse files Browse the repository at this point in the history
Signed-off-by: Aliou DIAITE <[email protected]>
  • Loading branch information
AliouDIAITE committed Aug 17, 2022
2 parents 09acc2b + 9fc367c commit 488cb22
Show file tree
Hide file tree
Showing 5 changed files with 170 additions and 160 deletions.
5 changes: 5 additions & 0 deletions sct-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@
<groupId>org.lfenergy.compas.core</groupId>
<artifactId>scl-extension</artifactId>
</artifactItem>
<artifactItem>
<groupId>org.lfenergy.compas.core</groupId>
<artifactId>scl-extension</artifactId>
<version>0.8.0</version>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
Expand Down
5 changes: 5 additions & 0 deletions sct-commons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,11 @@
<groupId>org.lfenergy.compas.core</groupId>
<artifactId>scl-extension</artifactId>
</artifactItem>
<artifactItem>
<groupId>org.lfenergy.compas.core</groupId>
<artifactId>scl-extension</artifactId>
<version>0.8.0</version>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -401,21 +401,21 @@ private static Map<String, TPrivate> createMapIEDNameAndPrivate(SclRootAdapter s
private static Map<String, Pair<TPrivate, List<SCL>>> createMapICDSystemVersionUuidAndSTDFile(Set<SCL> stds) {
Map<String, Pair<TPrivate, List<SCL>>> stringSCLMap = new HashMap<>();
stds.forEach(std -> std.getIED().forEach(ied -> ied.getPrivate().forEach(tp ->
PrivateService.getCompasICDHeader(tp).map(TCompasICDHeader::getICDSystemVersionUUID).ifPresent(icdSysVer -> {
Pair<TPrivate, List<SCL>> pair = stringSCLMap.get(icdSysVer);
List<SCL> list = pair != null ? pair.getRight() : new ArrayList<>();
list.add(std);
stringSCLMap.put(icdSysVer, Pair.of(tp, list));
})
PrivateService.getCompasICDHeader(tp).map(TCompasICDHeader::getICDSystemVersionUUID).ifPresent(icdSysVer -> {
Pair<TPrivate, List<SCL>> pair = stringSCLMap.get(icdSysVer);
List<SCL> list = pair != null ? pair.getRight() : new ArrayList<>();
list.add(std);
stringSCLMap.put(icdSysVer, Pair.of(tp, list));
})
)));
return stringSCLMap;
}

private static boolean comparePrivateCompasICDHeaders(TPrivate iedPrivate, TPrivate scdPrivate) throws ScdException {
TCompasICDHeader iedCompasICDHeader = PrivateService.getCompasICDHeader(iedPrivate).orElseThrow(
() -> new ScdException(COMPAS_ICDHEADER + "not found in IED Private "));
() -> new ScdException(COMPAS_ICDHEADER + "not found in IED Private "));
TCompasICDHeader scdCompasICDHeader = PrivateService.getCompasICDHeader(scdPrivate).orElseThrow(
() -> new ScdException(COMPAS_ICDHEADER + "not found in LNode Private "));
() -> new ScdException(COMPAS_ICDHEADER + "not found in LNode Private "));
return iedCompasICDHeader.getIEDType().equals(scdCompasICDHeader.getIEDType())
&& iedCompasICDHeader.getICDSystemVersionUUID().equals(scdCompasICDHeader.getICDSystemVersionUUID())
&& iedCompasICDHeader.getVendorName().equals(scdCompasICDHeader.getVendorName())
Expand All @@ -438,20 +438,20 @@ private static void copyCompasICDHeaderFromLNodePrivateIntoSTDPrivate(TPrivate s
public static void removeAllControlBlocksAndDatasetsAndExtRefSrcBindings(final SCL scl) {
SclRootAdapter sclRootAdapter = new SclRootAdapter(scl);
List<LDeviceAdapter> lDeviceAdapters = sclRootAdapter.getIEDAdapters().stream()
.map(IEDAdapter::getLDeviceAdapters).flatMap(List::stream).collect(Collectors.toList());
.map(IEDAdapter::getLDeviceAdapters).flatMap(List::stream).collect(Collectors.toList());

// LN0
lDeviceAdapters.stream()
.map(LDeviceAdapter::getLN0Adapter)
.forEach(ln0 -> {
ln0.removeAllControlBlocksAndDatasets();
ln0.removeAllExtRefSourceBindings();
});
.map(LDeviceAdapter::getLN0Adapter)
.forEach(ln0 -> {
ln0.removeAllControlBlocksAndDatasets();
ln0.removeAllExtRefSourceBindings();
});

// Other LN
lDeviceAdapters.stream()
.map(LDeviceAdapter::getLNAdapters).flatMap(List::stream)
.forEach(LNAdapter::removeAllControlBlocksAndDatasets);
.map(LDeviceAdapter::getLNAdapters).flatMap(List::stream)
.forEach(LNAdapter::removeAllControlBlocksAndDatasets);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ public List<TExtRef> getExtRefs(ExtRefSignalInfo filter) {
.filter(tExtRef ->
((filter.getDesc() == null && tExtRef.getDesc().isEmpty())
|| Objects.equals(filter.getDesc(),tExtRef.getDesc()) ) &&
Objects.equals(filter.getPDO(),tExtRef.getPDO()) &&
Objects.equals(filter.getPDA(),tExtRef.getPDA()) &&
Objects.equals(filter.getIntAddr(),tExtRef.getIntAddr()) &&
Objects.equals(filter.getPServT(),tExtRef.getPServT()))
Objects.equals(filter.getPDO(),tExtRef.getPDO()) &&
Objects.equals(filter.getPDA(),tExtRef.getPDA()) &&
Objects.equals(filter.getIntAddr(),tExtRef.getIntAddr()) &&
Objects.equals(filter.getPServT(),tExtRef.getPServT()))
.collect(Collectors.toList());
}

Expand All @@ -139,9 +139,9 @@ public List<TExtRef> getExtRefsBySignalInfo(ExtRefSignalInfo signalInfo) {
return currentElem.getInputs().getExtRef()
.stream()
.filter(tExtRef -> Objects.equals(signalInfo.getDesc(), tExtRef.getDesc()) &&
Objects.equals(tExtRef.getPDO(), signalInfo.getPDO()) &&
Objects.equals(signalInfo.getIntAddr(), tExtRef.getIntAddr()) &&
Objects.equals(signalInfo.getPServT(), tExtRef.getPServT())
Objects.equals(tExtRef.getPDO(), signalInfo.getPDO()) &&
Objects.equals(signalInfo.getIntAddr(), tExtRef.getIntAddr()) &&
Objects.equals(signalInfo.getPServT(), tExtRef.getPServT())
)
.collect(Collectors.toList());
}
Expand Down Expand Up @@ -229,12 +229,12 @@ protected List<ControlBlock<?>> getControlBlocks(List<TDataSet> tDataSets, TServ
tControls = this.lookUpControlBlocksByDataSetRef(tDataSet.getName(),TGSEControl.class);
controlBlocks.addAll(
tControls.stream()
.map(tgseControl -> {
var g = new GooseControlBlock((TGSEControl)tgseControl);
g.setMetaData(metaData);
return g;
})
.collect(Collectors.toList())
.map(tgseControl -> {
var g = new GooseControlBlock((TGSEControl)tgseControl);
g.setMetaData(metaData);
return g;
})
.collect(Collectors.toList())
);
}

Expand All @@ -243,25 +243,25 @@ protected List<ControlBlock<?>> getControlBlocks(List<TDataSet> tDataSets, TServ
tControls = this.lookUpControlBlocksByDataSetRef(tDataSet.getName(),TSampledValueControl.class);
controlBlocks.addAll(
tControls.stream()
.map(sampledValueControl -> {
var s = new SMVControlBlock((TSampledValueControl) sampledValueControl);
s.setMetaData(metaData);
return s;
})
.collect(Collectors.toList())
.map(sampledValueControl -> {
var s = new SMVControlBlock((TSampledValueControl) sampledValueControl);
s.setMetaData(metaData);
return s;
})
.collect(Collectors.toList())
);
}

if(serviceType == null || serviceType == TServiceType.REPORT) {
tControls = this.lookUpControlBlocksByDataSetRef(tDataSet.getName(),TReportControl.class);
controlBlocks.addAll(
tControls.stream()
.map(reportControl -> {
var r = new ReportControlBlock((TReportControl) reportControl);
r.setMetaData(metaData);
return r;
})
.collect(Collectors.toList())
.map(reportControl -> {
var r = new ReportControlBlock((TReportControl) reportControl);
r.setMetaData(metaData);
return r;
})
.collect(Collectors.toList())
);
}
}
Expand Down Expand Up @@ -443,11 +443,11 @@ public List<ResumedDataTemplate> getDAI(ResumedDataTemplate rDtt, boolean updata
SclRootAdapter sclRootAdapter = parentAdapter.getParentAdapter().getParentAdapter();
DataTypeTemplateAdapter dttAdapter = sclRootAdapter.getDataTypeTemplateAdapter();
LNodeTypeAdapter lNodeTypeAdapter = dttAdapter.getLNodeTypeAdapterById(lnType)
.orElseThrow(
() -> new ScdException(
String.format("Corrupted SCD : lnType missing for LN : %s%s", getLNClass(),getLNInst())
)
);
.orElseThrow(
() -> new ScdException(
String.format("Corrupted SCD : lnType missing for LN : %s%s", getLNClass(),getLNInst())
)
);
List<ResumedDataTemplate> resumedDTTs = lNodeTypeAdapter.getResumedDTTs(rDtt);

resumedDTTs.forEach(this::overrideAttributesFromDAI);
Expand All @@ -461,23 +461,23 @@ public List<ResumedDataTemplate> getDAI(ResumedDataTemplate rDtt, boolean updata

protected void overrideAttributesFromDAI(final ResumedDataTemplate rDtt) {
findMatch(rDtt.getDoName(), rDtt.getDaName())
.map(iDataAdapter -> (AbstractDAIAdapter<?>) iDataAdapter)
.map(AbstractDAIAdapter::getCurrentElem)
.ifPresent(tdai -> {
rDtt.setDaiValues(tdai.getVal());
if (rDtt.getDaName().getFc() == TFCEnum.SG || rDtt.getDaName().getFc() == TFCEnum.SE) {
boolean isGroup = hasSgGroup(tdai);
if (isGroup) {
rDtt.setValImport((!tdai.isSetValImport() || tdai.isValImport()) && iedHasConfSG());
} else {
rDtt.setValImport(false);
log.warn("Inconsistency in the SCD file - DAI {} with fc={} must have a sGroup attribute",
rDtt.getObjRef(getCurrentIED().getName(), parentAdapter.getInst()), rDtt.getDaName().getFc());
.map(iDataAdapter -> (AbstractDAIAdapter<?>) iDataAdapter)
.map(AbstractDAIAdapter::getCurrentElem)
.ifPresent(tdai -> {
rDtt.setDaiValues(tdai.getVal());
if (rDtt.getDaName().getFc() == TFCEnum.SG || rDtt.getDaName().getFc() == TFCEnum.SE) {
boolean isGroup = hasSgGroup(tdai);
if (isGroup) {
rDtt.setValImport((!tdai.isSetValImport() || tdai.isValImport()) && iedHasConfSG());
} else {
rDtt.setValImport(false);
log.warn("Inconsistency in the SCD file - DAI {} with fc={} must have a sGroup attribute",
rDtt.getObjRef(getCurrentIED().getName(), parentAdapter.getInst()), rDtt.getDaName().getFc());
}
} else if (tdai.isSetValImport()) {
rDtt.setValImport(tdai.isValImport());
}
} else if (tdai.isSetValImport()) {
rDtt.setValImport(tdai.isValImport());
}
});
});
}

private boolean iedHasConfSG() {
Expand Down Expand Up @@ -570,7 +570,7 @@ public void updateDAI(@NonNull ResumedDataTemplate rDtt) throws ScdException {
}
}
if(daiAdapter == null){
daiAdapter = doiOrSdoiAdapter.addDAI(daTypeName.getName(),rDtt.isUpdatable());
daiAdapter = doiOrSdoiAdapter.addDAI(daTypeName.getName(),rDtt.isUpdatable());
}

daiAdapter.update(daTypeName.getDaiValues());
Expand Down Expand Up @@ -609,9 +609,9 @@ public boolean matches(ObjectReference objRef) {
)
);
ResumedDataTemplate filter = ResumedDataTemplate.builder()
.lnInst(getLNInst())
.lnClass(getLNClass())
.lnType(currentElem.getLnType()).build();
.lnInst(getLNInst())
.lnClass(getLNClass())
.lnType(currentElem.getLnType()).build();
List<ResumedDataTemplate> rDtts = lNodeTypeAdapter.getResumedDTTs(filter);

return matchesDataAttributes(dataAttribute) ||
Expand Down Expand Up @@ -663,7 +663,7 @@ public Map<Long, String> getDAIValues(ResumedDataTemplate rDtt) {

Map<Long,String> res = new HashMap<>();
tVals.forEach( tVal -> res.put(
tVal.isSetSGroup() ? tVal.getSGroup() : 0L, tVal.getValue())
tVal.isSetSGroup() ? tVal.getSGroup() : 0L, tVal.getValue())
);

return res;
Expand Down
Loading

0 comments on commit 488cb22

Please sign in to comment.