Package net.sf.jasperreports.engine.data
Class JsonQLDataSource
- java.lang.Object
-
- net.sf.jasperreports.engine.data.JRAbstractTextDataSource
-
- net.sf.jasperreports.engine.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
Fields Modifier and Type Field Description static StringEXCEPTION_MESSAGE_KEY_JSON_FIELD_VALUE_NOT_RETRIEVEDstatic StringEXCEPTION_MESSAGE_KEY_NO_DATAstatic StringPROPERTY_FIELD_EXPRESSIONProperty 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
Constructors Modifier Constructor Description protectedJsonQLDataSource(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)protectedJsonQLDataSource(JRJsonNode root, String selectExpression)JsonQLDataSource(RepositoryContext repositoryContext, String jsonSource, String selectExpression)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcurrentIndex()protected ObjectgetConvertedValue(JRJsonNode node, JRField jrField)protected StringgetFieldExpression(JRField field)ObjectgetFieldValue(JRField jrField)Gets the field value for the current position.voidmoveFirst()Moves back to the first element in the data source.voidmoveToRecord(int index)booleannext()Tries to position the cursor on the next element in the data source.intrecordCount()JsonQLDataSourcesubDataSource()JsonQLDataSourcesubDataSource(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 Detail
-
EXCEPTION_MESSAGE_KEY_NO_DATA
public static final String EXCEPTION_MESSAGE_KEY_NO_DATA
- See Also:
- Constant Field Values
-
EXCEPTION_MESSAGE_KEY_JSON_FIELD_VALUE_NOT_RETRIEVED
public static final String EXCEPTION_MESSAGE_KEY_JSON_FIELD_VALUE_NOT_RETRIEVED
- See Also:
- Constant Field Values
-
PROPERTY_FIELD_EXPRESSION
public static final String PROPERTY_FIELD_EXPRESSION
Property specifying the JSONQL expression for the dataset field.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JsonQLDataSource
public JsonQLDataSource(File file, String selectExpression) throws JRException
- Throws:
JRException
-
JsonQLDataSource
public JsonQLDataSource(File file) throws JRException
- Throws:
JRException
-
JsonQLDataSource
public JsonQLDataSource(InputStream jsonInputStream, String selectExpression) throws JRException
- Throws:
JRException
-
JsonQLDataSource
public JsonQLDataSource(InputStream jsonInputStream) throws JRException
- 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
protected JsonQLDataSource(JRJsonNode root, String selectExpression) throws JRException
- Throws:
JRException
-
-
Method Detail
-
moveFirst
public void moveFirst() throws JRExceptionDescription copied from interface:JRRewindableDataSourceMoves back to the first element in the data source.- Specified by:
moveFirstin interfaceJRRewindableDataSource- Throws:
JRException
-
next
public boolean next() throws JRExceptionDescription copied from interface:JRDataSourceTries to position the cursor on the next element in the data source.- Specified by:
nextin 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:
recordCountin interfaceRandomAccessDataSource
-
currentIndex
public int currentIndex()
- Specified by:
currentIndexin interfaceRandomAccessDataSource
-
moveToRecord
public void moveToRecord(int index) throws NoRecordAtIndexException- Specified by:
moveToRecordin interfaceRandomAccessDataSource- Throws:
NoRecordAtIndexException
-
getFieldValue
public Object getFieldValue(JRField jrField) throws JRException
Description copied from interface:JRDataSourceGets the field value for the current position.- Specified by:
getFieldValuein interfaceJRDataSource- Returns:
- an object containing the field value. The object type must be the field object type.
- Throws:
JRException
-
subDataSource
public JsonQLDataSource subDataSource() throws JRException
- Specified by:
subDataSourcein interfaceHierarchicalDataSource<JsonQLDataSource>- Throws:
JRException
-
subDataSource
public JsonQLDataSource subDataSource(String selectExpression) throws JRException
- Specified by:
subDataSourcein interfaceHierarchicalDataSource<JsonQLDataSource>- Throws:
JRException
-
getConvertedValue
protected Object getConvertedValue(JRJsonNode node, JRField jrField) throws JRException
- Throws:
JRException
-
-