Class PrivateUtils
java.lang.Object
org.lfenergy.compas.sct.commons.util.PrivateUtils
A representation of the
PrivateService
.
The following features are supported:
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
checkSTDCorrespondanceWithLNodeCompasICDHeader
(Map<String, PrivateLinkedToStds> mapICDSystemVersionUuidAndSTDFile) Checks SCD and STD compatibilities by checking if there is at least one ICD_SYSTEM_VERSION_UUID in Substation/../LNode/Private COMPAS-ICDHeader of SCL not present in IED/Private COMPAS-ICDHeader of STDstatic boolean
comparePrivateCompasICDHeaders
(TPrivate iedPrivate, TPrivate scdPrivate) Compares if two Private:COMPAS-ICDHeader have all attributes equal except IEDNane, BayLabel and IEDinstancestatic void
copyCompasICDHeaderFromLNodePrivateIntoSTDPrivate
(TPrivate stdPrivate, TCompasICDHeader compasICDHeader) Copy Private COMPAS_ICDHEADER from LNode of SCD into Private COMPAS_ICDHEADER from IED of STDstatic Map<String,
PrivateLinkedToStds> Sorts in map of ICD_SYSTEM_VERSION_UUID and related Private coupled with all corresponding STD for all given STDstatic TPrivate
createPrivate
(List<TCompasTopo> compasTopos) Create a single Private of type COMPAS-Topo containing all given TCompasTopostatic TPrivate
createPrivate
(TCompasBay compasBay) Create Private of given type as parameterstatic TPrivate
createPrivate
(TCompasFunction compasFunction) Create Private of given type as parameterstatic TPrivate
createPrivate
(TCompasICDHeader compasICDHeader) Create Private of given type as parameterstatic TPrivate
createPrivate
(TCompasSclFileType compasSclFileType) Create Private of given type as parameterstatic TPrivate
createPrivate
(TCompasSystemVersion compasSystemVersion) Create Private of given type as parameterstatic Optional<TCompasICDHeader>
extractCompasICDHeader
(TPrivate tPrivate) Gets Private CompasICDHeader from Privatestatic <T> Optional<T>
extractCompasPrivate
(TBaseElement baseElement, Class<T> compasClass) Extract a single compas element of class compasClass nested in private elements of a given baseElement.static <T> Stream<T>
extractCompasPrivates
(TBaseElement baseElement, Class<T> compasClass) Extract compas elements of class compasClass nested in private elements of the given baseElement.static <T> Stream<T>
getPrivateStream
(List<TPrivate> privates, Class<T> compasClass) static void
removePrivates
(TBaseElement baseElement, @NonNull PrivateEnum privateEnum) Removes all privates of type privateEnum from baseElementstatic String
Creates formatted message including data's of Private for ExceptionstreamIcdHeaders
(SCL scd) Creates stream of IcdHeader for all Privates COMPAS-ICDHeader in /Substation of SCL
-
Constructor Details
-
PrivateUtils
public PrivateUtils()
-
-
Method Details
-
extractCompasPrivates
public static <T> Stream<T> extractCompasPrivates(TBaseElement baseElement, Class<T> compasClass) throws ScdException Extract compas elements of class compasClass nested in private elements of the given baseElement.- Type Parameters:
T
- Inference parameter stands for class compasClass- Parameters:
baseElement
- element where to look for privatescompasClass
- class of privates to extract- Returns:
- list of compas objects nested in the privates.
- Throws:
ScdException
- throws when inconsistency between types
-
getPrivateStream
-
extractCompasPrivate
public static <T> Optional<T> extractCompasPrivate(TBaseElement baseElement, Class<T> compasClass) throws ScdException Extract a single compas element of class compasClass nested in private elements of a given baseElement. Throws an exception when there are more than 1 compas element of given compasClass nested inside privates of the baseElement.- Type Parameters:
T
- Inference parameter stands for class compasClass- Parameters:
baseElement
- element where to look for privatescompasClass
- class of privates to extract- Returns:
- list of compas objects nested in the privates.
- Throws:
ScdException
- throws when inconsistency between types, or when more than 1 compas element is found
-
extractCompasICDHeader
public static Optional<TCompasICDHeader> extractCompasICDHeader(TPrivate tPrivate) throws ScdException Gets Private CompasICDHeader from Private- Parameters:
tPrivate
- Private contenting object to get as CompasICDHeader- Returns:
- content of th Private as optional of TCompasICDHeader object
- Throws:
ScdException
- throws when inconsistency between types
-
removePrivates
public static void removePrivates(TBaseElement baseElement, @NonNull @NonNull PrivateEnum privateEnum) Removes all privates of type privateEnum from baseElement- Parameters:
baseElement
- baseElement containing privatesprivateEnum
- enum type of private to remove
-
createPrivate
Create Private of given type as parameter- Parameters:
compasBay
- type of Private to create- Returns:
- created Private
-
createPrivate
Create Private of given type as parameter- Parameters:
compasFunction
- type of Private to create- Returns:
- created Private
-
createPrivate
Create Private of given type as parameter- Parameters:
compasICDHeader
- type of Private to create- Returns:
- created Private
-
createPrivate
Create Private of given type as parameter- Parameters:
compasSclFileType
- type of Private to create- Returns:
- created Private
-
createPrivate
Create Private of given type as parameter- Parameters:
compasSystemVersion
- type of Private to create- Returns:
- created Private
-
createPrivate
Create a single Private of type COMPAS-Topo containing all given TCompasTopo- Parameters:
compasTopos
- list of TCompasTopo- Returns:
- created Private
-
createMapICDSystemVersionUuidAndSTDFile
public static Map<String,PrivateLinkedToStds> createMapICDSystemVersionUuidAndSTDFile(List<SCL> stds) Sorts in map of ICD_SYSTEM_VERSION_UUID and related Private coupled with all corresponding STD for all given STD- Parameters:
stds
- list of STD to short- Returns:
- map of ICD_SYSTEM_VERSION_UUID attribute in IED/Private:COMPAS-ICDHeader and related Private coupled with all corresponding STD
-
checkSTDCorrespondanceWithLNodeCompasICDHeader
public static void checkSTDCorrespondanceWithLNodeCompasICDHeader(Map<String, PrivateLinkedToStds> mapICDSystemVersionUuidAndSTDFile) throws ScdExceptionChecks SCD and STD compatibilities by checking if there is at least one ICD_SYSTEM_VERSION_UUID in Substation/../LNode/Private COMPAS-ICDHeader of SCL not present in IED/Private COMPAS-ICDHeader of STD- Parameters:
mapICDSystemVersionUuidAndSTDFile
- map of ICD_SYSTEM_VERSION_UUID and list of corresponding STD- Throws:
ScdException
- throws when there are several STD files corresponding to ICD_SYSTEM_VERSION_UUID from Substation/../LNode/Private COMPAS-ICDHeader of SCL
-
stdCheckFormatExceptionMessage
Creates formatted message including data's of Private for Exception- Parameters:
key
- Private causing exception- Returns:
- formatted message
- Throws:
ScdException
- throws when parameter not present in Private
-
streamIcdHeaders
Creates stream of IcdHeader for all Privates COMPAS-ICDHeader in /Substation of SCL- Parameters:
scd
- SCL file in which Private should be found- Returns:
- stream of COMPAS-ICDHeader Private
-
comparePrivateCompasICDHeaders
public static boolean comparePrivateCompasICDHeaders(TPrivate iedPrivate, TPrivate scdPrivate) throws ScdException Compares if two Private:COMPAS-ICDHeader have all attributes equal except IEDNane, BayLabel and IEDinstance- Parameters:
iedPrivate
- Private of IED from STD to comparescdPrivate
- Private of LNode fro SCD to compare- Returns:
- Boolean value of check result
- Throws:
ScdException
- throws when Private is not COMPAS_ICDHEADER one
-
copyCompasICDHeaderFromLNodePrivateIntoSTDPrivate
public static void copyCompasICDHeaderFromLNodePrivateIntoSTDPrivate(TPrivate stdPrivate, TCompasICDHeader compasICDHeader) throws ScdException Copy Private COMPAS_ICDHEADER from LNode of SCD into Private COMPAS_ICDHEADER from IED of STD- Parameters:
stdPrivate
- Private of IED from STD in which to copy new datacompasICDHeader
- Private of IED from STD from which new data are taken- Throws:
ScdException
- throws when Private is not COMPAS_ICDHEADER one
-