Skip to content

Commit

Permalink
[#88] : refactoring SclService
Browse files Browse the repository at this point in the history
Signed-off-by: Aliou DIAITE <aliou.diaite@rte-france.com>
  • Loading branch information
AliouDIAITE committed May 31, 2022
1 parent 8939ace commit cf59cfc
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -404,22 +404,20 @@ private static void updateBay(@NonNull VoltageLevelAdapter scdVoltageLevelAdapte
public static SclRootAdapter importSTDElementsInSCD(@NonNull SclRootAdapter scdRootAdapter, Set<SCL> stds,
Map<Pair<String, String>, List<String>> comMap) throws ScdException {


// List all Private and remove duplicated one with same iedName
Map<String, TPrivate> mapIEDNameAndPrivate = createMapIEDNameAndPrivate(scdRootAdapter);

//Check SCD and STD compatibilities
Map<String, Pair<TPrivate, List<SCL>>> mapICDSystemVersionUuidAndSTDFile = createMapICDSystemVersionUuidAndSTDFile(stds);
for (Map.Entry<String, Pair<TPrivate, List<SCL>>> entry : mapICDSystemVersionUuidAndSTDFile.entrySet()) {
if (entry.getValue().getRight().size() != 1) {
TPrivate key = entry.getValue().getLeft();
for (Pair<TPrivate, List<SCL>> pairOfPrivateAndSTDs : mapICDSystemVersionUuidAndSTDFile.values()) {
if (pairOfPrivateAndSTDs.getRight().size() != 1) {
TPrivate key = pairOfPrivateAndSTDs.getLeft();
throw new ScdException("There are several STD files corresponding to " +
CommonConstants.HEADER_ID + " = " + getCompasICDHeader(key).map(TCompasICDHeader::getHeaderId).orElse(null) +
CommonConstants.HEADER_VERSION + " = " + getCompasICDHeader(key).map(TCompasICDHeader::getHeaderVersion).orElse(null) +
CommonConstants.HEADER_REVISION + " = " + getCompasICDHeader(key).map(TCompasICDHeader::getHeaderRevision).orElse(null) +
"and " + CommonConstants.ICD_SYSTEM_VERSION_UUID + " = " + getCompasICDHeader(key).map(TCompasICDHeader::getICDSystemVersionUUID).orElse(null));
}
}

// List all Private and remove duplicated one with same iedName
Map<String, TPrivate> mapIEDNameAndPrivate = createMapIEDNameAndPrivate(scdRootAdapter);
//For each Private.ICDSystemVersionUUID and Private.iedName find STD File
for (Map.Entry<String, TPrivate> entry : mapIEDNameAndPrivate.entrySet()) {
String iedName = entry.getKey();
Expand Down

0 comments on commit cf59cfc

Please sign in to comment.