public class JsonDataSource extends JRAbstractTextDataSource implements JsonData
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
EXCEPTION_MESSAGE_KEY_INVALID_ATTRIBUTE_SELECTION |
static java.lang.String |
EXCEPTION_MESSAGE_KEY_INVALID_EXPRESSION |
static java.lang.String |
EXCEPTION_MESSAGE_KEY_JSON_FIELD_VALUE_NOT_RETRIEVED |
static java.lang.String |
EXCEPTION_MESSAGE_KEY_NO_DATA |
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
Modifier | Constructor and Description |
---|---|
|
JsonDataSource(java.io.File file) |
|
JsonDataSource(java.io.InputStream stream) |
|
JsonDataSource(java.io.InputStream jsonStream,
java.lang.String selectExpression) |
|
JsonDataSource(JasperReportsContext jasperReportsContext,
java.lang.String location,
java.lang.String selectExpression)
Creates a data source instance that reads JSON data from a given location
|
protected |
JsonDataSource(JsonNode jsonTree,
java.lang.String selectExpression) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Deprecated.
no longer required
|
java.lang.Object |
getFieldValue(JRField jrField)
Gets the field value for the current position.
|
protected JsonNode |
getJsonData(JsonNode rootNode,
java.lang.String jsonExpression)
Extracts the JSON nodes based on the query expression
|
protected JsonNode |
goDownPath(JsonNode rootNode,
java.lang.String simplePath)
Extracts the JSON nodes under the simple path
|
protected JsonNode |
goDownPathWithAttribute(JsonNode rootNode,
java.lang.String pathWithAttributeExpression)
Extracts the JSON nodes that match the attribute expression
|
protected boolean |
isValidExpression(JsonNode operand,
java.lang.String attributeExpression)
Validates an attribute expression on a JsonNode
|
void |
moveFirst()
Moves back to the first element in the data source.
|
boolean |
next()
Tries to position the cursor on the next element in the data source.
|
JsonDataSource |
subDataSource()
Creates a sub data source using the current node as the base for its input stream.
|
JsonDataSource |
subDataSource(java.lang.String selectExpression)
Creates a sub data source using the current node as the base for its input stream.
|
convertNumber, convertStringValue, getConvertBean, getDatePattern, getFormattedDate, getFormattedNumber, getLocale, getNumberPattern, getTextAttributes, getTimeZone, setDatePattern, setLocale, setLocale, setNumberPattern, setTextAttributes, setTextAttributes, setTimeZone, setTimeZone
public static final java.lang.String EXCEPTION_MESSAGE_KEY_JSON_FIELD_VALUE_NOT_RETRIEVED
public static final java.lang.String EXCEPTION_MESSAGE_KEY_INVALID_ATTRIBUTE_SELECTION
public static final java.lang.String EXCEPTION_MESSAGE_KEY_INVALID_EXPRESSION
public static final java.lang.String EXCEPTION_MESSAGE_KEY_NO_DATA
public JsonDataSource(java.io.InputStream stream) throws JRException
JRException
public JsonDataSource(java.io.InputStream jsonStream, java.lang.String selectExpression) throws JRException
JRException
protected JsonDataSource(JsonNode jsonTree, java.lang.String selectExpression) throws JRException
JRException
public JsonDataSource(java.io.File file) throws java.io.FileNotFoundException, JRException
java.io.FileNotFoundException
JRException
public JsonDataSource(JasperReportsContext jasperReportsContext, java.lang.String location, java.lang.String selectExpression) throws JRException
jasperReportsContext
- the JasperReportsContextlocation
- a String representing JSON data sourceselectExpression
- a String representing the select expressionJRException
public void moveFirst() throws JRException
JRRewindableDataSource
moveFirst
in interface JRRewindableDataSource
JRException
public boolean next()
JRDataSource
next
in interface JRDataSource
public java.lang.Object getFieldValue(JRField jrField) throws JRException
JRDataSource
getFieldValue
in interface JRDataSource
JRException
protected JsonNode getJsonData(JsonNode rootNode, java.lang.String jsonExpression) throws JRException
rootNode
- jsonExpression
- JRException
protected JsonNode goDownPathWithAttribute(JsonNode rootNode, java.lang.String pathWithAttributeExpression) throws JRException
rootNode
- pathWithAttributeExpression
- : e.g. Orders(CustomerId == HILAA)JRException
protected JsonNode goDownPath(JsonNode rootNode, java.lang.String simplePath)
rootNode
- simplePath
- - a simple field name, with no selection by attributeprotected boolean isValidExpression(JsonNode operand, java.lang.String attributeExpression) throws JRException
operand
- attributeExpression
- JRException
public JsonDataSource subDataSource() throws JRException
subDataSource
in interface JsonData
JRException
public JsonDataSource subDataSource(java.lang.String selectExpression) throws JRException
subDataSource
in interface JsonData
selectExpression
- JRException
@Deprecated public void close()
© 2001-2014 TIBCO Software Inc. www.jaspersoft.com