Class CsvGraphicSource
- All Implemented Interfaces:
DataSource,GraphicSource
GraphicSource interface to read NodeGraphicInput and LineGraphicInput entities from .csv files- Since:
- 08.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
ConstructorsConstructorDescriptionCsvGraphicSource(String csvSep, String folderPath, FileNamingStrategy fileNamingStrategy, TypeSource typeSource, RawGridSource rawGridSource) -
Method Summary
Modifier and TypeMethodDescriptionShould return either a consistent instance ofGraphicElementswrapped inOptionalor an emptyOptional.Returns a set ofLineGraphicInputinstances.getLineGraphicInput(Set<LineInput> lines) Returns a set ofLineGraphicInputinstances.Returns a set ofNodeGraphicInputinstances.getNodeGraphicInput(Set<NodeInput> nodes) Returns a set ofNodeGraphicInputinstances.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
-
CsvGraphicSource
public CsvGraphicSource(String csvSep, String folderPath, FileNamingStrategy fileNamingStrategy, TypeSource typeSource, RawGridSource rawGridSource)
-
-
Method Details
-
getGraphicElements
Should return either a consistent instance ofGraphicElementswrapped inOptionalor an emptyOptional. The decision to useOptionalinstead of returning theGraphicElementsinstance directly is motivated by the fact, that aGraphicElementsis a container instance that depends on several other entities. Without being complete, it is useless for further processing. Hence, whenever at least one entityGraphicElementsdepends 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
GraphicElementsinstance, but also its validity e.g. in the sense that not duplicate UUIDs exist within all entities contained in the returning instance.- Specified by:
getGraphicElementsin interfaceGraphicSource- Returns:
- either a valid, complete
GraphicElementsoptional orOptional.empty()
-
getNodeGraphicInput
Returns a set ofNodeGraphicInputinstances. This set has to be unique in the sense of object uniqueness but also in the sense ofUUIDuniqueness of the providedNodeGraphicInputwhich has to be checked manually, asNodeGraphicInput.equals(Object)is NOT restricted on the uuid ofNodeGraphicInput.- Specified by:
getNodeGraphicInputin interfaceGraphicSource- Returns:
- a set of object and uuid unique
NodeGraphicInputentities
-
getNodeGraphicInput
Returns a set ofNodeGraphicInputinstances. This set has to be unique in the sense of object uniqueness but also in the sense ofUUIDuniqueness of the providedNodeGraphicInputwhich has to be checked manually, asNodeGraphicInput.equals(Object)is NOT restricted on the uuid ofNodeGraphicInput.In contrast to
GraphicSource.getNodeGraphicInput()this interface provides the ability to pass in an already existing set ofNodeInputentities, theNodeGraphicInputinstances 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 of
NodeInputentities is not exhaustive for all availableNodeGraphicInputentities or if an error during the building process occurs, all entities that has been able to be built are returned and the not-built ones are ignored (= filtered out).- Specified by:
getNodeGraphicInputin interfaceGraphicSource- Parameters:
nodes- a set of object and uuid unique nodes that should be used for the returning instances- Returns:
- a set of object and uuid unique
NodeGraphicInputentities
-
getLineGraphicInput
Returns a set ofLineGraphicInputinstances. This set has to be unique in the sense of object uniqueness but also in the sense ofUUIDuniqueness of the providedLineGraphicInputwhich has to be checked manually, asLineGraphicInput.equals(Object)is NOT restricted on the uuid ofLineGraphicInput.- Specified by:
getLineGraphicInputin interfaceGraphicSource- Returns:
- a set of object and uuid unique
LineGraphicInputentities
-
getLineGraphicInput
Returns a set ofLineGraphicInputinstances. This set has to be unique in the sense of object uniqueness but also in the sense ofUUIDuniqueness of the providedLineGraphicInputwhich has to be checked manually, asLineGraphicInput.equals(Object)is NOT restricted on the uuid ofLineGraphicInput.In contrast to
GraphicSource.getLineGraphicInput()this interface provides the ability to pass in an already existing set ofLineInputentities, theLineGraphicInputinstances 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 of
LineInputentities is not exhaustive for all availableLineGraphicInputentities or if an error during the building process occurs, all entities that has been able to be built are returned and the not-built ones are ignored (= filtered out).- Specified by:
getLineGraphicInputin interfaceGraphicSource- Parameters:
lines- a set of object and uuid unique lines that should be used for the returning instances- Returns:
- a set of object and uuid unique
LineGraphicInputentities
-