Package net.sf.jasperreports.json.data
Class JsonQLDataSource
java.lang.Object
net.sf.jasperreports.engine.data.JRAbstractTextDataSource
net.sf.jasperreports.json.data.JsonQLDataSource
- All Implemented Interfaces:
HierarchicalDataSource<JsonQLDataSource>
,JsonData<JsonQLDataSource>
,RandomAccessDataSource
,JRDataSource
,JRRewindableDataSource
public class JsonQLDataSource
extends JRAbstractTextDataSource
implements JsonData<JsonQLDataSource>, RandomAccessDataSource
- Author:
- Narcis Marcu (narcism@users.sourceforge.net)
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
static final String
static final String
Property specifying the JSONQL expression for the dataset field.Fields inherited from class net.sf.jasperreports.engine.data.JRAbstractTextDataSource
EXCEPTION_MESSAGE_KEY_CANNOT_CONVERT_FIELD_TYPE, EXCEPTION_MESSAGE_KEY_CANNOT_MODIFY_PROPERTIES_AFTER_START, EXCEPTION_MESSAGE_KEY_NODE_NOT_AVAILABLE, EXCEPTION_MESSAGE_KEY_NULL_DOCUMENT, EXCEPTION_MESSAGE_KEY_NULL_SELECT_EXPRESSION, EXCEPTION_MESSAGE_KEY_UNKNOWN_COLUMN_NAME, EXCEPTION_MESSAGE_KEY_UNKNOWN_NUMBER_TYPE
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
JsonQLDataSource
(com.fasterxml.jackson.databind.JsonNode jacksonJsonTree, String selectExpression) JsonQLDataSource
(File file) JsonQLDataSource
(File file, String selectExpression) JsonQLDataSource
(InputStream jsonInputStream) JsonQLDataSource
(InputStream jsonInputStream, String selectExpression) JsonQLDataSource
(JasperReportsContext jasperReportsContext, String jsonSource, String selectExpression) protected
JsonQLDataSource
(JRJsonNode root, String selectExpression) JsonQLDataSource
(RepositoryContext repositoryContext, String jsonSource, String selectExpression) -
Method Summary
Modifier and TypeMethodDescriptionint
protected Object
getConvertedValue
(JRJsonNode node, JRField jrField) protected String
getFieldExpression
(JRField field) getFieldValue
(JRField jrField) Gets the field value for the current position.void
Moves back to the first element in the data source.void
moveToRecord
(int index) boolean
next()
Tries to position the cursor on the next element in the data source.int
subDataSource
(String selectExpression) Methods inherited from class net.sf.jasperreports.engine.data.JRAbstractTextDataSource
convertNumber, convertStringValue, getConvertBean, getDatePattern, getLocale, getNumberPattern, getTextAttributes, getTimeZone, setDatePattern, setLocale, setLocale, setNumberPattern, setTextAttributes, setTextAttributes, setTimeZone, setTimeZone
-
Field Details
-
EXCEPTION_MESSAGE_KEY_NO_DATA
- See Also:
-
EXCEPTION_MESSAGE_KEY_JSON_FIELD_VALUE_NOT_RETRIEVED
- See Also:
-
PROPERTY_FIELD_EXPRESSION
Property specifying the JSONQL expression for the dataset field.- See Also:
-
-
Constructor Details
-
JsonQLDataSource
- Throws:
JRException
-
JsonQLDataSource
- Throws:
JRException
-
JsonQLDataSource
- Throws:
JRException
-
JsonQLDataSource
- Throws:
JRException
-
JsonQLDataSource
public JsonQLDataSource(JasperReportsContext jasperReportsContext, String jsonSource, String selectExpression) throws JRException - Throws:
JRException
-
JsonQLDataSource
public JsonQLDataSource(RepositoryContext repositoryContext, String jsonSource, String selectExpression) throws JRException - Throws:
JRException
-
JsonQLDataSource
protected JsonQLDataSource(com.fasterxml.jackson.databind.JsonNode jacksonJsonTree, String selectExpression) throws JRException - Throws:
JRException
-
JsonQLDataSource
- Throws:
JRException
-
-
Method Details
-
moveFirst
Description copied from interface:JRRewindableDataSource
Moves back to the first element in the data source.- Specified by:
moveFirst
in interfaceJRRewindableDataSource
- Throws:
JRException
-
next
Description copied from interface:JRDataSource
Tries to position the cursor on the next element in the data source.- Specified by:
next
in interfaceJRDataSource
- Returns:
- true if there is a next record, false otherwise
- Throws:
JRException
- if any error occurs while trying to move to the next element
-
recordCount
public int recordCount()- Specified by:
recordCount
in interfaceRandomAccessDataSource
-
currentIndex
public int currentIndex()- Specified by:
currentIndex
in interfaceRandomAccessDataSource
-
moveToRecord
- Specified by:
moveToRecord
in interfaceRandomAccessDataSource
- Throws:
NoRecordAtIndexException
-
getFieldValue
Description copied from interface:JRDataSource
Gets the field value for the current position.- Specified by:
getFieldValue
in interfaceJRDataSource
- Returns:
- an object containing the field value. The object type must be the field object type.
- Throws:
JRException
-
subDataSource
- Specified by:
subDataSource
in interfaceHierarchicalDataSource<JsonQLDataSource>
- Throws:
JRException
-
subDataSource
- Specified by:
subDataSource
in interfaceHierarchicalDataSource<JsonQLDataSource>
- Throws:
JRException
-
getConvertedValue
- Throws:
JRException
-
getFieldExpression
-