@ThingworxExtensionApiClass(since={6,6}, canInstantiate=true) public class InfoTable extends java.lang.Object implements java.lang.Cloneable, IDiffableObject
DataShapeDefinition
that describes the
names, base types, and additional information about each field within the table.
Data within an InfoTable is contained in rows. Each row can have one or more fields, described by the table's DataShapeDefinition.
ValueCollection
s
are used to represent the rows within the table.
InfoTables are often serialized to JSON and this class contains helper functions, such as toJSON and fromJSON to simplify that process.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ROWS_ELEMENT_NAME |
Constructor and Description |
---|
InfoTable()
Constructs a new InfoTable |
InfoTable(DataShapeDefinition fields)
|
Modifier and Type | Method and Description |
---|---|
int |
addField(FieldDefinition field)
|
void |
AddField(org.json.JSONObject jsonObject)
Adds a field to this InfoTable given a field definition as a
|
void |
AddRow(org.json.JSONObject jsonObject)
Adds a row to this InfoTable given the values as a
|
int |
addRow(ValueCollection row)
|
int |
addRowBeginning(ValueCollection row)
|
int |
addRowsFrom(InfoTable table,
java.lang.Boolean clone)
Adds the rows from an InfoTable to this InfoTable given: the InfoTable to be copied from and a Boolean indicating whether the copied values should be references or cloned values. |
InfoTable |
clone() |
InfoTable |
cloneStructure() |
ValueCollection |
currentRow()
|
int |
delete(IFilter filter) |
int |
delete(ValueCollection values)
Creates an based on the given
and deletes all rows falling within the parameters of that filter |
InfoTable |
deleteRowsToNewTable(IFilter filters) |
void |
filter(ValueCollection values)
|
void |
filterRows(IFilter filters) |
InfoTable |
filterRowsToNewTable(IFilter filters) |
InfoTable |
FilterToNewTable(org.json.JSONObject jsonObject)
Finds rows in this InfoTable with values that match the values given as a and returns them as a new
InfoTable |
ValueCollection |
find(IFilter filter)
|
ValueCollection |
find(ValueCollection values)
Finds and returns a row from this InfoTable that matches the values of all fields given as a ( ) |
ValueCollection |
find(ValueCollection values,
java.lang.String[] columns)
Finds and returns a row in this InfoTable given the fields to search as a String Array and the values to match as a ( ) |
int |
findIndex(ValueCollection values)
Finds and returns the index of a row from this InfoTable that matches the values of all fields given as a ( ) |
static InfoTable |
fromJSON(org.json.JSONObject jsonObject)
Deprecated.
|
static InfoTable |
fromJSONWithoutDefaults(org.json.JSONObject jsonObject)
Deprecated.
|
DataShapeDefinition |
getDataShape()
|
FieldDefinition |
getField(java.lang.String name)
Returns a from this InfoTable's , given the name of the
field as a String |
int |
getFieldCount()
Returns the number of fields in this InfoTable's DataShape as an int |
ValueCollection |
getFirstRow()
|
InfoTableRowIndex |
getIndex() |
ValueCollection |
getLastRow()
|
java.lang.Integer |
getLength()
Returns the number of rows in this InfoTable as an Integer |
DataShapeDefinition |
getPublicDataShape()
|
java.lang.Object |
getReturnValue()
Returns the first value of the first field in the first row of this InfoTable |
ValueCollection |
getRow(int index)
|
java.lang.Integer |
getRowCount()
Returns the number of rows in this InfoTable as an Integer |
ValueCollectionList |
getRows()
|
IPrimitiveType |
getRowValue(java.lang.String name)
Returns a value as an from the first row of this InfoTable, given
a field name as a String |
java.lang.Boolean |
hasField(java.lang.String name)
Verifies a field exists in this InfoTable's DataShape given the field name as a String |
void |
indexOn(java.util.ArrayList<java.lang.String> fieldNames,
boolean isUnique) |
void |
indexOn(java.lang.String fieldName,
boolean isUnique) |
boolean |
isEmpty()
Returns a boolean indicating whether this InfoTable has a size of zero |
boolean |
isType(BaseTypes type) |
void |
moveToFirst()
Moves to the first row of this InfoTable. |
ValueCollection |
nextRow()
|
void |
quickSort(java.lang.String fieldName) |
void |
quickSort(java.lang.String fieldName,
java.lang.Boolean isAscending) |
void |
removeAllRows()
|
void |
RemoveField(java.lang.String field)
Removes a field from this InfoTable given the field name as a String |
void |
removeRow(int row)
|
void |
reverse() |
void |
reverseRowJsons() |
void |
setDataShape(DataShapeDefinition fields)
|
void |
setRow(int index,
ValueCollection row)
Sets a single row in this InfoTable given a as a row and the index of the row to be replaced |
void |
setRows(ValueCollectionList rows)
Sets the rows in this InfoTable given a No deserialisation needed here as we are replacing
all the data from the table and replacing it with new data |
void |
sortRows(ISort sorters) |
InfoTable |
sortRowsToNewTable(ISort sorters) |
org.json.JSONObject |
toJSON()
Deprecated.
no replacement
|
void |
topN(int maxItems) |
InfoTable |
topNToNewTable(int maxItems) |
InfoTable |
updateRowsToNewTable(IFilter filters,
ValueCollection values) |
public static final java.lang.String ROWS_ELEMENT_NAME
@ThingworxExtensionApiMethod(since={6,6}) public InfoTable()
@ThingworxExtensionApiMethod(since={6,6}) public InfoTable(DataShapeDefinition fields)
fields
- DataShapeDefinition containing the fields you would like in your InfoTable@ThingworxExtensionApiMethod(since={6,6}) public DataShapeDefinition getDataShape()
@ThingworxExtensionApiMethod(since={6,6}) public void setDataShape(DataShapeDefinition fields)
fields
- DataShapeDefinition containing the fields you would like in your InfoTable@ThingworxExtensionApiMethod(since={6,6}) public DataShapeDefinition getPublicDataShape()
@ThingworxExtensionApiMethod(since={6,6}) public int getFieldCount()
@ThingworxExtensionApiMethod(since={6,6}) public ValueCollectionList getRows()
@ThingworxExtensionApiMethod(since={6,6}) public void setRows(ValueCollectionList rows)
ValueCollectionList
No deserialisation needed here as we are replacing
all the data from the table and replacing it with new datarows
- ValueCollectionList containing the rows you want to add to this InfoTable@ThingworxExtensionApiMethod(since={6,6}) public void setRow(int index, ValueCollection row)
ValueCollection
as a row and the index of the row to be replacedindex
- int of the row to be replacedrow
- ValueCollection containing the new row@ThingworxExtensionApiMethod(since={6,6}) public boolean isEmpty()
@ThingworxExtensionApiMethod(since={6,6}) public int addField(FieldDefinition field)
field
- FieldDefinition containing the field to be added to the InfoTable's DataShape@ThingworxExtensionApiMethod(since={6,6}) public int addRow(ValueCollection row)
row
- ValueCollection containing the values for the row@ThingworxExtensionApiMethod(since={6,6}) public int addRowBeginning(ValueCollection row)
row
- ValueCollection containing the values for the row@ThingworxExtensionApiMethod(since={6,6}) public int addRowsFrom(InfoTable table, java.lang.Boolean clone)
table
- InfoTable containing the rows to be added to this InfoTableclone
- Boolean True: if the values in the row should be copies. False: if the values in the row should be
references.@ThingworxExtensionApiMethod(since={6,6}) public void AddField(org.json.JSONObject jsonObject) throws java.lang.Exception
JSONObject
jsonObject
- The field definition of the new field as a JSONObjectjava.lang.Exception
- If an error occurs@ThingworxExtensionApiMethod(since={6,6}) public void AddRow(org.json.JSONObject jsonObject) throws java.lang.Exception
JSONObject
jsonObject
- The values of the row as a JSONObjectjava.lang.Exception
- If an error occurs@ThingworxExtensionApiMethod(since={6,6}) public void removeRow(int row) throws java.lang.Exception
row
- int Index of the ValueCollection to be removed from the ValueCollectionListjava.lang.Exception
- If an error occurs@ThingworxExtensionApiMethod(since={6,6}) public void removeAllRows()
@ThingworxExtensionApiMethod(since={6,6}) public void RemoveField(java.lang.String field) throws java.lang.Exception
field
- The name of the field to be removedjava.lang.Exception
- If an error occurs@ThingworxExtensionApiMethod(since={6,6}) public InfoTable FilterToNewTable(org.json.JSONObject jsonObject) throws java.lang.Exception
JSONObject
and returns them as a new
InfoTablejsonObject
- The values to be matched as a JSONObjectjava.lang.Exception
- If an error occurs@ThingworxExtensionApiMethod(since={6,6}) public java.lang.Integer getRowCount()
@ThingworxExtensionApiMethod(since={6,6}) public java.lang.Integer getLength()
@ThingworxExtensionApiMethod(since={6,6}) public java.lang.Boolean hasField(java.lang.String name)
name
- String containing the name of the field to verify@ThingworxExtensionApiMethod(since={6,6}) public FieldDefinition getField(java.lang.String name)
FieldDefinition
from this InfoTable's DataShapeDefinition
, given the name of the
field as a Stringname
- String containing the name of the field@ThingworxExtensionApiMethod(since={6,6}) public ValueCollection currentRow()
@ThingworxExtensionApiMethod(since={6,6}) public ValueCollection nextRow()
@ThingworxExtensionApiMethod(since={6,6}) public InfoTableRowIndex getIndex()
@ThingworxExtensionApiMethod(since={6,6}) public void indexOn(java.lang.String fieldName, boolean isUnique) throws java.lang.Exception
java.lang.Exception
- If an error occurs@ThingworxExtensionApiMethod(since={6,6}) public void indexOn(java.util.ArrayList<java.lang.String> fieldNames, boolean isUnique) throws java.lang.Exception
java.lang.Exception
- If an error occurs@ThingworxExtensionApiMethod(since={6,6}) public ValueCollection getRow(int index)
index
- Location of the row (ValueCollection) in the ValueCollectionList@ThingworxExtensionApiMethod(since={6,6}) public ValueCollection getLastRow()
@ThingworxExtensionApiMethod(since={6,6}) public IPrimitiveType getRowValue(java.lang.String name)
IPrimitiveType
from the first row of this InfoTable, given
a field name as a Stringname
- The name of the field containing the wanted value@ThingworxExtensionApiMethod(since={6,6}) public java.lang.Object getReturnValue()
@ThingworxExtensionApiMethod(since={6,6}) public ValueCollection getFirstRow()
@ThingworxExtensionApiMethod(since={6,6}) public void moveToFirst()
ValueCollectionList
to 0
if there are rows present and -1 if there are not@ThingworxExtensionApiMethod(since={6,6}) public ValueCollection find(ValueCollection values)
ValueCollection
)values
- ValueCollection containing the values that match all fields in the row@ThingworxExtensionApiMethod(since={6,6}) public ValueCollection find(ValueCollection values, java.lang.String[] columns)
ValueCollection
)values
- ValueCollection of the values to matchcolumns
- String Array containing the fields to be searched@ThingworxExtensionApiMethod(since={6,6}) public ValueCollection find(IFilter filter)
filter
- IFilter containing the parameters of the search@ThingworxExtensionApiMethod(since={6,6}) public int findIndex(ValueCollection values)
ValueCollection
)values
- ValueCollection containing the values that match all fields in the row@ThingworxExtensionApiMethod(since={6,6}) public void filter(ValueCollection values)
values
- ValueCollection containing the values to filter by@ThingworxExtensionApiMethod(since={6,6}) public int delete(ValueCollection values)
AndFilterCollection
based on the given
ValueCollection
and deletes all rows falling within the parameters of that filtervalues
- ValueCollection containing the values used to generate the filter@ThingworxExtensionApiMethod(since={6,6}) public int delete(IFilter filter)
@ThingworxExtensionApiMethod(since={6,6}) public void filterRows(IFilter filters)
@ThingworxExtensionApiMethod(since={6,6}) public void quickSort(java.lang.String fieldName, java.lang.Boolean isAscending) throws java.lang.Exception
java.lang.Exception
- If an error occurs@ThingworxExtensionApiMethod(since={6,6}) public void quickSort(java.lang.String fieldName) throws java.lang.Exception
java.lang.Exception
- If an error occurs@ThingworxExtensionApiMethod(since={6,6}) public void sortRows(ISort sorters)
@ThingworxExtensionApiMethod(since={6,6}) public void topN(int maxItems)
@ThingworxExtensionApiMethod(since={6,6}) public InfoTable clone()
clone
in class java.lang.Object
@ThingworxExtensionApiMethod(since={6,6}) public InfoTable cloneStructure()
@ThingworxExtensionApiMethod(since={6,6}) public InfoTable filterRowsToNewTable(IFilter filters)
@ThingworxExtensionApiMethod(since={6,6}) public InfoTable deleteRowsToNewTable(IFilter filters)
@ThingworxExtensionApiMethod(since={6,6}) public InfoTable updateRowsToNewTable(IFilter filters, ValueCollection values)
@ThingworxExtensionApiMethod(since={6,6}) public InfoTable sortRowsToNewTable(ISort sorters)
@ThingworxExtensionApiMethod(since={6,6}) public InfoTable topNToNewTable(int maxItems)
@ThingworxExtensionApiMethod(since={6,6}) public void reverse()
@ThingworxExtensionApiMethod(since={6,6}) public void reverseRowJsons()
@ThingworxExtensionApiMethod(since={6,6}) public boolean isType(BaseTypes type)
@Deprecated @ThingworxExtensionApiMethod(since={6,6}, deprecatedSince={8,4}) public static InfoTable fromJSON(org.json.JSONObject jsonObject) throws java.lang.Exception
java.lang.Exception
- If an error occurs@Deprecated @ThingworxExtensionApiMethod(since={8,3}, deprecatedSince={8,4}) public static InfoTable fromJSONWithoutDefaults(org.json.JSONObject jsonObject) throws java.lang.Exception
java.lang.Exception
- If an error occurs@Deprecated @ThingworxExtensionApiMethod(since={6,6}, deprecatedSince={8,4}) public org.json.JSONObject toJSON() throws java.lang.Exception
java.lang.Exception
- if an error occurs