-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(#341): Création Lnode, DOI et Private domain
Signed-off-by: gleizesDor <115622893+gleizesDor@users.noreply.github.com>
- Loading branch information
1 parent
f5e7098
commit d822129
Showing
80 changed files
with
2,413 additions
and
734 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
sct-commons/src/main/java/org/lfenergy/compas/sct/commons/DataSetService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// SPDX-FileCopyrightText: 2022 2023 RTE FRANCE | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package org.lfenergy.compas.sct.commons; | ||
|
||
import org.lfenergy.compas.scl2007b4.model.LN0; | ||
import org.lfenergy.compas.scl2007b4.model.TAnyLN; | ||
import org.lfenergy.compas.scl2007b4.model.TDataSet; | ||
import org.lfenergy.compas.scl2007b4.model.TLN; | ||
import org.lfenergy.compas.sct.commons.api.DataSetReader; | ||
|
||
import java.util.Optional; | ||
import java.util.function.Predicate; | ||
import java.util.stream.Stream; | ||
|
||
public class DataSetService implements DataSetReader { | ||
|
||
public Stream<TDataSet> getDataSets(TAnyLN tAnyLN) { | ||
return switch (tAnyLN) { | ||
case LN0 ln0 -> ln0.isSetDataSet() ? ln0.getDataSet().stream() : Stream.empty(); | ||
case TLN tln -> tln.isSetDataSet() ? tln.getDataSet().stream() : Stream.empty(); | ||
default -> throw new IllegalStateException("Unexpected value: " + tAnyLN); | ||
}; | ||
} | ||
|
||
public Stream<TDataSet> getFilteredDataSets(TAnyLN tAnyLN, Predicate<TDataSet> dataSetPredicate) { | ||
return getDataSets(tAnyLN).filter(dataSetPredicate); | ||
} | ||
|
||
public Optional<TDataSet> findDataSet(TAnyLN tAnyLN, Predicate<TDataSet> dataSetPredicate) { | ||
return getFilteredDataSets(tAnyLN, dataSetPredicate).findFirst(); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
sct-commons/src/main/java/org/lfenergy/compas/sct/commons/DoService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// SPDX-FileCopyrightText: 2022 RTE FRANCE | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package org.lfenergy.compas.sct.commons; | ||
|
||
import org.lfenergy.compas.scl2007b4.model.TDO; | ||
import org.lfenergy.compas.scl2007b4.model.TLNodeType; | ||
import org.lfenergy.compas.sct.commons.api.DoReader; | ||
|
||
import java.util.Optional; | ||
import java.util.function.Predicate; | ||
import java.util.stream.Stream; | ||
|
||
public class DoService implements DoReader { | ||
|
||
public Stream<TDO> getDos(TLNodeType tlNodeType) { | ||
return tlNodeType.getDO().stream(); | ||
} | ||
|
||
public Stream<TDO> getFilteredDos(TLNodeType tlNodeType, Predicate<TDO> tdoPredicate) { | ||
return getDos(tlNodeType).filter(tdoPredicate); | ||
} | ||
|
||
public Optional<TDO> findDo(TLNodeType tlNodeType, Predicate<TDO> tdoPredicate) { | ||
return getFilteredDos(tlNodeType, tdoPredicate).findFirst(); | ||
} | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
sct-commons/src/main/java/org/lfenergy/compas/sct/commons/DoTypeService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// SPDX-FileCopyrightText: 2022 RTE FRANCE | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package org.lfenergy.compas.sct.commons; | ||
|
||
import org.lfenergy.compas.scl2007b4.model.TDataTypeTemplates; | ||
import org.lfenergy.compas.scl2007b4.model.TDOType; | ||
import org.lfenergy.compas.sct.commons.api.DoTypeReader; | ||
|
||
import java.util.Optional; | ||
import java.util.function.Predicate; | ||
import java.util.stream.Stream; | ||
|
||
public class DoTypeService implements DoTypeReader { | ||
|
||
public Stream<TDOType> getDoTypes(TDataTypeTemplates tDataTypeTemplates) { | ||
return tDataTypeTemplates.getDOType().stream(); | ||
} | ||
|
||
public Stream<TDOType> getFilteredDoTypes(TDataTypeTemplates tDataTypeTemplates, Predicate<TDOType> tdoTypePredicate) { | ||
return getDoTypes(tDataTypeTemplates).filter(tdoTypePredicate); | ||
} | ||
|
||
public Optional<TDOType> findDoType(TDataTypeTemplates tDataTypeTemplates, Predicate<TDOType> tdoTypePredicate) { | ||
return getFilteredDoTypes(tDataTypeTemplates, tdoTypePredicate).findFirst(); | ||
} | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
sct-commons/src/main/java/org/lfenergy/compas/sct/commons/ExtRefReaderService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// SPDX-FileCopyrightText: 2022 2023 RTE FRANCE | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package org.lfenergy.compas.sct.commons; | ||
|
||
import org.lfenergy.compas.scl2007b4.model.LN0; | ||
import org.lfenergy.compas.scl2007b4.model.TAnyLN; | ||
import org.lfenergy.compas.scl2007b4.model.TExtRef; | ||
import org.lfenergy.compas.scl2007b4.model.TLN; | ||
import org.lfenergy.compas.sct.commons.api.ExtRefReader; | ||
|
||
import java.util.stream.Stream; | ||
|
||
public class ExtRefReaderService implements ExtRefReader { | ||
|
||
public Stream<TExtRef> getExtRefs(TAnyLN tAnyLN) { | ||
return switch (tAnyLN) { | ||
case LN0 ln0 -> ln0.isSetInputs() ? ln0.getInputs().getExtRef().stream() : Stream.empty(); | ||
case TLN tln -> tln.isSetInputs() ? tln.getInputs().getExtRef().stream() : Stream.empty(); | ||
default -> throw new IllegalStateException("Unexpected value: " + tAnyLN); | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
sct-commons/src/main/java/org/lfenergy/compas/sct/commons/IedService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// SPDX-FileCopyrightText: 2022 RTE FRANCE | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package org.lfenergy.compas.sct.commons; | ||
|
||
import org.lfenergy.compas.scl2007b4.model.SCL; | ||
import org.lfenergy.compas.scl2007b4.model.TIED; | ||
import org.lfenergy.compas.sct.commons.api.IedReader; | ||
|
||
import java.util.Optional; | ||
import java.util.function.Predicate; | ||
import java.util.stream.Stream; | ||
|
||
public class IedService implements IedReader { | ||
|
||
public Stream<TIED> getFilteredIeds(SCL scd, Predicate<TIED> iedPredicate) { | ||
return scd.getIED().stream().filter(iedPredicate); | ||
} | ||
|
||
public Optional<TIED> findIed(SCL scd, Predicate<TIED> iedPredicate) { | ||
return getFilteredIeds(scd, iedPredicate).findFirst(); | ||
} | ||
} |
64 changes: 64 additions & 0 deletions
64
sct-commons/src/main/java/org/lfenergy/compas/sct/commons/LdeviceService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// SPDX-FileCopyrightText: 2022 RTE FRANCE | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package org.lfenergy.compas.sct.commons; | ||
|
||
import org.lfenergy.compas.scl2007b4.model.*; | ||
import org.lfenergy.compas.sct.commons.api.LdeviceReader; | ||
import org.lfenergy.compas.sct.commons.util.LdeviceStatus; | ||
|
||
import java.util.Collection; | ||
import java.util.Objects; | ||
import java.util.Optional; | ||
import java.util.function.Predicate; | ||
import java.util.stream.Stream; | ||
|
||
import static org.lfenergy.compas.sct.commons.util.CommonConstants.MOD_DO_NAME; | ||
import static org.lfenergy.compas.sct.commons.util.CommonConstants.STVAL_DA_NAME; | ||
|
||
public class LdeviceService implements LdeviceReader { | ||
|
||
public Stream<TLDevice> getLdevices(TIED tied) { | ||
if (!tied.isSetAccessPoint()) { | ||
return Stream.empty(); | ||
} | ||
return tied.getAccessPoint() | ||
.stream() | ||
.map(TAccessPoint::getServer) | ||
.filter(Objects::nonNull) | ||
.filter(TServer::isSetLDevice) | ||
.flatMap(tServer -> tServer.getLDevice().stream()); | ||
} | ||
|
||
public Stream<TLDevice> getActiveLdevices(TIED tied) { | ||
return getLdevices(tied) | ||
.filter(ldevice -> getLdeviceStatus(ldevice).map(LdeviceStatus.ON::equals).orElse(false)); | ||
} | ||
|
||
public Stream<TLDevice> getFilteredLdevices(TIED tied, Predicate<TLDevice> ldevicePredicate) { | ||
return getLdevices(tied).filter(ldevicePredicate); | ||
} | ||
|
||
public Optional<TLDevice> findLdevice(TIED tied, Predicate<TLDevice> ldevicePredicate) { | ||
return getFilteredLdevices(tied, ldevicePredicate).findFirst(); | ||
} | ||
|
||
public Optional<LdeviceStatus> getLdeviceStatus(TLDevice tlDevice) { | ||
return tlDevice.getLN0() | ||
.getDOI() | ||
.stream() | ||
.filter(tdoi -> MOD_DO_NAME.equals(tdoi.getName())) | ||
.findFirst() | ||
.flatMap(tdoi -> tdoi.getSDIOrDAI() | ||
.stream() | ||
.filter(dai -> dai.getClass().equals(TDAI.class)) | ||
.map(TDAI.class::cast) | ||
.filter(tdai -> STVAL_DA_NAME.equals(tdai.getName())) | ||
.map(TDAI::getVal) | ||
.flatMap(Collection::stream) | ||
.findFirst() | ||
.map(TVal::getValue)) | ||
.map(LdeviceStatus::fromValue); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
sct-commons/src/main/java/org/lfenergy/compas/sct/commons/LnService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// SPDX-FileCopyrightText: 2022 RTE FRANCE | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package org.lfenergy.compas.sct.commons; | ||
|
||
import org.lfenergy.compas.scl2007b4.model.*; | ||
import org.lfenergy.compas.sct.commons.api.LnReader; | ||
|
||
import java.util.stream.Stream; | ||
|
||
public class LnService implements LnReader { | ||
|
||
public Stream<TAnyLN> getAnylns(TLDevice tlDevice) { | ||
return Stream.concat(Stream.of(tlDevice.getLN0()), tlDevice.getLN().stream()); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
sct-commons/src/main/java/org/lfenergy/compas/sct/commons/LnodeTypeService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// SPDX-FileCopyrightText: 2022 RTE FRANCE | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package org.lfenergy.compas.sct.commons; | ||
|
||
import org.lfenergy.compas.scl2007b4.model.TDataTypeTemplates; | ||
import org.lfenergy.compas.scl2007b4.model.TLNodeType; | ||
import org.lfenergy.compas.sct.commons.api.LnodeTypeReader; | ||
|
||
import java.util.Optional; | ||
import java.util.function.Predicate; | ||
import java.util.stream.Stream; | ||
|
||
public class LnodeTypeService implements LnodeTypeReader { | ||
|
||
public Stream<TLNodeType> getLnodeTypes(TDataTypeTemplates tDataTypeTemplates) { | ||
return tDataTypeTemplates.getLNodeType().stream(); | ||
} | ||
|
||
public Stream<TLNodeType> getFilteredLnodeTypes(TDataTypeTemplates tDataTypeTemplates, Predicate<TLNodeType> tlNodeTypePredicate) { | ||
return getLnodeTypes(tDataTypeTemplates).filter(tlNodeTypePredicate); | ||
} | ||
|
||
public Optional<TLNodeType> findLnodeType(TDataTypeTemplates tDataTypeTemplates, Predicate<TLNodeType> tlNodeTypePredicate) { | ||
return getFilteredLnodeTypes(tDataTypeTemplates, tlNodeTypePredicate).findFirst(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.