Class CsvRawGridSource
- All Implemented Interfaces:
DataSource
,RawGridSource
RawGridElements
as well as the RawGridElements
container from .csv files.
This source is not buffered which means each call on a getter method always tries to read all data is necessary to return the requested objects in a hierarchical cascading way.
If performance is an issue, it is recommended to read the data cascading starting with reading nodes and then using the getters with arguments to avoid reading the same data multiple times.
The resulting sets are always unique on object and UUID base (with distinct UUIDs).
- Since:
- 03.04.20
-
Field Summary
Fields inherited from class edu.ie3.datamodel.io.source.csv.CsvDataSource
connector, csvSep, FIELDS_TO_VALUES_MAP, log, NODE, NODE_A, NODE_B, OPERATOR, TYPE
-
Constructor Summary
ConstructorDescriptionCsvRawGridSource
(String csvSep, String gridFolderPath, FileNamingStrategy fileNamingStrategy, TypeSource typeSource) -
Method Summary
Modifier and TypeMethodDescriptionReturns a unique set ofTransformer2WInput
instances.get2WTransformers
(Set<NodeInput> nodes, Set<Transformer2WTypeInput> transformer2WTypes, Set<OperatorInput> operators) Returns a set ofTransformer2WInput
instances.Returns a unique set ofTransformer3WInput
instances.get3WTransformers
(Set<NodeInput> nodes, Set<Transformer3WTypeInput> transformer3WTypeInputs, Set<OperatorInput> operators) Returns a set ofTransformer3WInput
instances.Should return either a consistent instance ofRawGridElements
wrapped inOptional
or an emptyOptional
.getLines()
Returns a unique set ofLineInput
instances.getLines
(Set<NodeInput> nodes, Set<LineTypeInput> lineTypeInputs, Set<OperatorInput> operators) Returns a set ofLineInput
instances.Returns a unique set ofMeasurementUnitInput
instances.getMeasurementUnits
(Set<NodeInput> nodes, Set<OperatorInput> operators) Returns a set ofMeasurementUnitInput
instances.getNodes()
Returns a unique set ofNodeInput
instances.getNodes
(Set<OperatorInput> operators) Returns a set ofNodeInput
instances.Returns a unique set ofSwitchInput
instances.getSwitches
(Set<NodeInput> nodes, Set<OperatorInput> operators) Returns a set ofSwitchInput
instances.Methods inherited from class edu.ie3.datamodel.io.source.csv.CsvDataSource
assetInputEntityDataStream, assetInputEntityDataStream, buildStreamWithFieldsToAttributesMap, buildStreamWithFieldsToAttributesMap, csvRowFieldValueMapping, distinctRowsWithLog, findFirstEntityByUuid, getAssetType, isPresentCollectIfNot, logSkippingWarning, nodeAssetEntityStream, nodeAssetInputEntityDataStream, parseCsvRow, printInvalidElementInformation, saveMapGet, simpleEntityDataStream
-
Constructor Details
-
CsvRawGridSource
public CsvRawGridSource(String csvSep, String gridFolderPath, FileNamingStrategy fileNamingStrategy, TypeSource typeSource)
-
-
Method Details
-
getGridData
Should return either a consistent instance ofRawGridElements
wrapped inOptional
or an emptyOptional
. The decision to useOptional
instead of returning theRawGridElements
instance directly is motivated by the fact, that aRawGridElements
is a container instance that depends on several other entities. Without being complete, it is useless for further processing.Hence, whenever at least one entity
RawGridElements
depends on cannot be provided,Optional.empty()
should be returned and extensive logging should provide enough information to debug the error and fix the persistent data that has been failed to processed.Furthermore, it is expected, that the specific implementation of this method ensures not only the completeness of the resulting
RawGridElements
instance, but also its validity e.g. in the sense that not duplicate UUIDs exist within all entities contained in the returning instance.- Specified by:
getGridData
in interfaceRawGridSource
- Returns:
- either a valid, complete
RawGridElements
optional orOptional.empty()
-
getNodes
Returns a unique set ofNodeInput
instances.This set has to be unique in the sense of object uniqueness but also in the sense of
UUID
uniqueness of the providedNodeInput
which has to be checked manually, asNodeInput.equals(Object)
is NOT restricted on the uuid ofNodeInput
.- Specified by:
getNodes
in interfaceRawGridSource
- Returns:
- a set of object and uuid unique
NodeInput
entities
-
getNodes
Returns a set ofNodeInput
instances. This set has to be unique in the sense of object uniqueness but also in the sense ofUUID
uniqueness of the providedNodeInput
which has to be checked manually, asNodeInput.equals(Object)
is NOT restricted on the uuid ofNodeInput
.In contrast to
RawGridSource.getNodes()
this interface provides the ability to pass in an already existing set ofOperatorInput
entities, theNodeInput
instances depend on. Doing so, already loaded nodes can be recycled to improve performance and prevent unnecessary loading operations.If something fails during the creation process it's up to the concrete implementation of an empty set or a set with all entities that has been able to be build is returned.
If the set with
OperatorInput
is not exhaustive, the corresponding operator is set toOperatorInput.NO_OPERATOR_ASSIGNED
- Specified by:
getNodes
in interfaceRawGridSource
- Parameters:
operators
- a set of object and uuid uniqueOperatorInput
that should be used for the returning instances- Returns:
- a set of object and uuid unique
NodeInput
entities
-
getLines
Returns a unique set ofLineInput
instances.This set has to be unique in the sense of object uniqueness but also in the sense of
UUID
uniqueness of the providedLineInput
which has to be checked manually, asLineInput.equals(Object)
is NOT restricted on the uuid ofLineInput
.- Specified by:
getLines
in interfaceRawGridSource
- Returns:
- a set of object and uuid unique
LineInput
entities
-
getLines
public Set<LineInput> getLines(Set<NodeInput> nodes, Set<LineTypeInput> lineTypeInputs, Set<OperatorInput> operators) Returns a set ofLineInput
instances. This set has to be unique in the sense of object uniqueness but also in the sense ofUUID
uniqueness of the providedLineInput
which has to be checked manually, asLineInput.equals(Object)
is NOT restricted on the uuid ofLineInput
.In contrast to
RawGridSource.getNodes()
this interface provides the ability to pass in an already existing set ofNodeInput
,LineTypeInput
andOperatorInput
entities, theLineInput
instances depend on. Doing so, already loaded nodes, line types and operators can be recycled to improve performance and prevent unnecessary loading operations.If something fails during the creation process it's up to the concrete implementation of an empty set or a set with all entities that has been able to be build is returned.
If one of the sets of
NodeInput
orLineTypeInput
entities is not exhaustive for all availableLineInput
entities (e.g. aNodeInput
orLineTypeInput
entity is missing) or if an error during the building process occurs, the entity that misses something will be skipped (which can be seen as a filtering functionality) but all entities that are able to be built will be returned anyway and the elements that couldn't have been built are logged.If the set with
OperatorInput
is not exhaustive, the corresponding operator is set toOperatorInput.NO_OPERATOR_ASSIGNED
- Specified by:
getLines
in interfaceRawGridSource
- Parameters:
nodes
- a set of object and uuid uniqueNodeInput
entitieslineTypeInputs
- a set of object and uuid uniqueLineTypeInput
entitiesoperators
- a set of object and uuid uniqueOperatorInput
that should be used for the returning instances- Returns:
- a set of object and uuid unique
LineInput
entities
-
get2WTransformers
Returns a unique set ofTransformer2WInput
instances.This set has to be unique in the sense of object uniqueness but also in the sense of
UUID
uniqueness of the providedTransformer2WInput
which has to be checked manually, asTransformer2WInput.equals(Object)
is NOT restricted on the uuid ofTransformer2WInput
.- Specified by:
get2WTransformers
in interfaceRawGridSource
- Returns:
- a set of object and uuid unique
Transformer2WInput
entities
-
get2WTransformers
public Set<Transformer2WInput> get2WTransformers(Set<NodeInput> nodes, Set<Transformer2WTypeInput> transformer2WTypes, Set<OperatorInput> operators) Returns a set ofTransformer2WInput
instances. This set has to be unique in the sense of object uniqueness but also in the sense ofUUID
uniqueness of the providedTransformer2WInput
which has to be checked manually, asTransformer2WInput.equals(Object)
is NOT restricted on the uuid ofTransformer2WInput
.In contrast to
RawGridSource.getNodes()
this interface provides the ability to pass in an already existing set ofNodeInput
,Transformer2WTypeInput
andOperatorInput
entities, theTransformer2WInput
instances depend on. Doing so, already loaded nodes, line types and operators can be recycled to improve performance and prevent unnecessary loading operations.If something fails during the creation process it's up to the concrete implementation of an empty set or a set with all entities that has been able to be build is returned.
If one of the sets of
NodeInput
orTransformer2WTypeInput
entities is not exhaustive for all availableTransformer2WInput
entities (e.g. aNodeInput
orTransformer2WTypeInput
entity is missing) or if an error during the building process occurs, the entity that misses something will be skipped (which can be seen as a filtering functionality) but all entities that are able to be built will be returned anyway and the elements that couldn't have been built are logged.If the set with
OperatorInput
is not exhaustive, the corresponding operator is set toOperatorInput.NO_OPERATOR_ASSIGNED
- Specified by:
get2WTransformers
in interfaceRawGridSource
- Parameters:
nodes
- a set of object and uuid uniqueNodeInput
entitiestransformer2WTypes
- a set of object and uuid uniqueTransformer2WTypeInput
entitiesoperators
- a set of object and uuid uniqueOperatorInput
that should be used for the returning instances- Returns:
- a set of object and uuid unique
Transformer2WInput
entities
-
get3WTransformers
Returns a unique set ofTransformer3WInput
instances.This set has to be unique in the sense of object uniqueness but also in the sense of
UUID
uniqueness of the providedTransformer3WInput
which has to be checked manually, asTransformer3WInput.equals(Object)
is NOT restricted on the uuid ofTransformer3WInput
.- Specified by:
get3WTransformers
in interfaceRawGridSource
- Returns:
- a set of object and uuid unique
Transformer3WInput
entities
-
get3WTransformers
public Set<Transformer3WInput> get3WTransformers(Set<NodeInput> nodes, Set<Transformer3WTypeInput> transformer3WTypeInputs, Set<OperatorInput> operators) Returns a set ofTransformer3WInput
instances. This set has to be unique in the sense of object uniqueness but also in the sense ofUUID
uniqueness of the providedTransformer3WInput
which has to be checked manually, asTransformer3WInput.equals(Object)
is NOT restricted on the uuid ofTransformer3WInput
.In contrast to
RawGridSource.getNodes()
this interface provides the ability to pass in an already existing set ofNodeInput
,Transformer3WTypeInput
andOperatorInput
entities, theTransformer3WInput
instances depend on. Doing so, already loaded nodes, line types and operators can be recycled to improve performance and prevent unnecessary loading operations.If something fails during the creation process it's up to the concrete implementation of an empty set or a set with all entities that has been able to be build is returned.
If one of the sets of
NodeInput
orTransformer3WTypeInput
entities is not exhaustive for all availableTransformer3WInput
entities (e.g. aNodeInput
orTransformer3WTypeInput
entity is missing) or if an error during the building process occurs, the entity that misses something will be skipped (which can be seen as a filtering functionality) but all entities that are able to be built will be returned anyway and the elements that couldn't have been built are logged.If the set with
OperatorInput
is not exhaustive, the corresponding operator is set toOperatorInput.NO_OPERATOR_ASSIGNED
- Specified by:
get3WTransformers
in interfaceRawGridSource
- Parameters:
nodes
- a set of object and uuid uniqueNodeInput
entitiestransformer3WTypeInputs
- a set of object and uuid uniqueTransformer3WTypeInput
entitiesoperators
- a set of object and uuid uniqueOperatorInput
that should be used for the returning instances- Returns:
- a set of object and uuid unique
Transformer3WInput
entities
-
getSwitches
Returns a unique set ofSwitchInput
instances.This set has to be unique in the sense of object uniqueness but also in the sense of
UUID
uniqueness of the providedSwitchInput
which has to be checked manually, asSwitchInput.equals(Object)
is NOT restricted on the uuid ofSwitchInput
.- Specified by:
getSwitches
in interfaceRawGridSource
- Returns:
- a set of object and uuid unique
SwitchInput
entities
-
getSwitches
Returns a set ofSwitchInput
instances. This set has to be unique in the sense of object uniqueness but also in the sense ofUUID
uniqueness of the providedSwitchInput
which has to be checked manually, asSwitchInput.equals(Object)
is NOT restricted on the uuid ofSwitchInput
.In contrast to
RawGridSource.getNodes()
this interface provides the ability to pass in an already existing set ofNodeInput
andOperatorInput
entities, theSwitchInput
instances depend on. Doing so, already loaded nodes, line types and operators can be recycled to improve performance and prevent unnecessary loading operations.If something fails during the creation process it's up to the concrete implementation of an empty set or a set with all entities that has been able to be build is returned.
If one of the sets of
NodeInput
entities is not exhaustive for all availableSwitchInput
entities (e.g. aNodeInput
entity is missing) or if an error during the building process occurs, the entity that misses something will be skipped (which can be seen as a filtering functionality) but all entities that are able to be built will be returned anyway and the elements that couldn't have been built are logged.If the set with
OperatorInput
is not exhaustive, the corresponding operator is set toOperatorInput.NO_OPERATOR_ASSIGNED
- Specified by:
getSwitches
in interfaceRawGridSource
- Parameters:
nodes
- a set of object and uuid uniqueNodeInput
entitiesoperators
- a set of object and uuid uniqueOperatorInput
that should be used for the returning instances- Returns:
- a set of object and uuid unique
SwitchInput
entities
-
getMeasurementUnits
Returns a unique set ofMeasurementUnitInput
instances.This set has to be unique in the sense of object uniqueness but also in the sense of
UUID
uniqueness of the providedMeasurementUnitInput
which has to be checked manually, asMeasurementUnitInput.equals(Object)
is NOT restricted on the uuid ofMeasurementUnitInput
.- Specified by:
getMeasurementUnits
in interfaceRawGridSource
- Returns:
- a set of object and uuid unique
MeasurementUnitInput
entities
-
getMeasurementUnits
public Set<MeasurementUnitInput> getMeasurementUnits(Set<NodeInput> nodes, Set<OperatorInput> operators) Returns a set ofMeasurementUnitInput
instances. This set has to be unique in the sense of object uniqueness but also in the sense ofUUID
uniqueness of the providedMeasurementUnitInput
which has to be checked manually, asMeasurementUnitInput.equals(Object)
is NOT restricted on the uuid ofMeasurementUnitInput
.In contrast to
RawGridSource.getNodes()
this interface provides the ability to pass in an already existing set ofNodeInput
andOperatorInput
entities, theMeasurementUnitInput
instances depend on. Doing so, already loaded nodes, line types and operators can be recycled to improve performance and prevent unnecessary loading operations.If something fails during the creation process it's up to the concrete implementation of an empty set or a set with all entities that has been able to be build is returned.
If one of the sets of
NodeInput
entities is not exhaustive for all availableMeasurementUnitInput
entities (e.g. aNodeInput
entity is missing) or if an error during the building process occurs, the entity that misses something will be skipped (which can be seen as a filtering functionality) but all entities that are able to be built will be returned anyway and the elements that couldn't have been built are logged.If the set with
OperatorInput
is not exhaustive, the corresponding operator is set toOperatorInput.NO_OPERATOR_ASSIGNED
- Specified by:
getMeasurementUnits
in interfaceRawGridSource
- Parameters:
nodes
- a set of object and uuid uniqueNodeInput
entitiesoperators
- a set of object and uuid uniqueOperatorInput
that should be used for the returning instances- Returns:
- a set of object and uuid unique
MeasurementUnitInput
entities
-