Class JsonDataLoader
java.lang.Object
io.jmix.reports.yarg.loaders.impl.AbstractDataLoader
io.jmix.reports.yarg.loaders.impl.JsonDataLoader
- All Implemented Interfaces:
ReportDataLoader
- Direct Known Subclasses:
JmixJsonDataLoader
Loads data from json string
Uses JsonPath to access necessary parts of json object
Example:
JSON:
{ "store": {
"book": [
{ "category": "reference",
"author": "Nigel Rees",
"title": "Sayings of the Century",
"price": 8.95
},
{ "category": "fiction",
"author": "Evelyn Waugh",
"title": "Sword of Honour",
"price": 12.99,
"isbn": "0-553-21311-3"
}
],
"bicycle": {
"color": "red",
"price": 19.95
}
}
}
Query string:
parameter=param1 $.store.book[*]
We get json string from parameter param1 and select all "book" objects from the "store" object
-
Field Summary
Fields inherited from class io.jmix.reports.yarg.loaders.impl.AbstractDataLoader
fieldsConverter, parametersConverter
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
addParentBandDataToParameters
(BandData parentBand, Map<String, Object> currentParams) protected void
addParentBandDataToParametersRecursively
(BandData parentBand, Map<String, Object> currentParams) copyParameters
(Map<String, Object> parametersToCopy) extractScriptResult
(String jsonData, String jsonPathScript, ReportQuery reportQuery) protected String
getParameterName
(Matcher matcher) This method MUST return list of mutable maps.loadDataFromScript
(ReportQuery reportQuery, Map<String, Object> currentParams, Matcher matcher, Object parameterValue) protected void
Methods inherited from class io.jmix.reports.yarg.loaders.impl.AbstractDataLoader
convertOutputValue, convertParameter, getFieldsConverter, getParametersConverter, setFieldsConverter, setParametersConverter
-
Field Details
-
parameterPattern
-
-
Constructor Details
-
JsonDataLoader
public JsonDataLoader()
-
-
Method Details
-
loadData
public List<Map<String,Object>> loadData(ReportQuery reportQuery, BandData parentBand, Map<String, Object> reportParams) Description copied from interface:ReportDataLoader
This method MUST return list of mutable maps. We need mutability to put there some values implicitly. -
loadDataFromScript
-
extractScriptResult
-
parseScriptResult
-
getParameterName
-
createMap
-
copyParameters
-
addParentBandDataToParametersRecursively
-
addParentBandDataToParameters
- Overrides:
addParentBandDataToParameters
in classAbstractDataLoader
-