ru.mfd.api
Class Table

java.lang.Object
  extended by ru.mfd.api.Table

public class Table
extends java.lang.Object

User: MMarkelov Date: 12.10.12 Time: 16:32


Constructor Summary
Table(SrvrSession srvrSession, java.lang.String tableName, TableListener tableListener)
          Initializes a new instance of table representation.
 
Method Summary
 int addUpdateFilter(int parentFilterId, Filter.ELogicalOperation operation, int fieldId, Filter.ECondition condition, java.lang.String value)
          Adds filter to this table to process online data.
 int addUpdateFilter(int parentFilterId, Filter.ELogicalOperation operation, java.lang.String fieldAcronym, Filter.ECondition condition, java.lang.String value)
          Adds filter to this table to process online data.
 void addUpdateFilterView(int... fieldIds)
          Makes server to send only given fields in online data.
 void addUpdateFilterView(java.lang.String... fieldAcronyms)
          Makes server to send only given fields in online data.
 void clear()
          Clears this table.
 void clearUpdateFilterView()
          Removes all online data fields filters.
 Filter createFilter(int fieldId, Filter.ECondition condition, java.lang.String value)
          Creates a Filter with the given field number for this Table
 Filter createFilter(java.lang.String fieldAcronym, Filter.ECondition condition, java.lang.String value)
          Creates a Filter with the given field name for this Table
 Row createRow()
          Creates new data row structure.
 void delete(java.lang.Long recid)
          Deletes row in table by I_RID.
 void deleteUpdateFilter(int filterId)
          Removes online data filter with given filterId from table filters set.
 long getData(java.util.List<java.lang.Integer> fieldIds, java.util.List<Filter> filters)
          Sends command to retrieve data.
 long getSlice(java.util.List<java.lang.Integer> fieldIds, java.util.List<Filter> filters)
          Sends command to retrieve last data by each ticker.
 void insert(Row row)
          Inserts new row to this table.
 void modify(Row row)
          Updates row of this table.
 void setOnlineUpdates(boolean onlineUpdates)
          Subscribes or unsubscribes table from online data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Table

public Table(SrvrSession srvrSession,
             java.lang.String tableName,
             TableListener tableListener)
      throws ClientException
Initializes a new instance of table representation. Remember that SrvrSession keeps only WeakReference to this Table. Client application should take care of keeping strong reference to the instance of this class.

Parameters:
srvrSession - server session
tableName - name of table to initialize
tableListener - table events listener
Throws:
ClientException - if catalog or table not found
Method Detail

getData

public long getData(java.util.List<java.lang.Integer> fieldIds,
                    java.util.List<Filter> filters)
             throws ClientException
Sends command to retrieve data.

Parameters:
fieldIds - list of fields to receive if value is null server sends all fields of this table
filters - list of filters to be applied if value is null no filters applied
Returns:
Session unique reference. Client app can use it to identify response.
Throws:
ClientException - if SrvrSession not connected to server

getSlice

public long getSlice(java.util.List<java.lang.Integer> fieldIds,
                     java.util.List<Filter> filters)
              throws ClientException
Sends command to retrieve last data by each ticker. Allowed for tables with certain types only (i.e. Quotes, AllTrades).

Parameters:
fieldIds - list of fields to receive if value is null server sends all fields of this table
filters - list of filters to be applied if value is null no filters applied
Returns:
Session unique reference. Client app can use it to identify response.
Throws:
ClientException - if SrvrSession not connected to server

setOnlineUpdates

public void setOnlineUpdates(boolean onlineUpdates)
                      throws ClientException
Subscribes or unsubscribes table from online data.

Parameters:
onlineUpdates - enable online updates flag
Throws:
ClientException - if SrvrSession not connected to server

addUpdateFilter

public int addUpdateFilter(int parentFilterId,
                           Filter.ELogicalOperation operation,
                           int fieldId,
                           Filter.ECondition condition,
                           java.lang.String value)
                    throws ClientException
Adds filter to this table to process online data. Supports logical operations Filter.ELogicalOperation.AND and Filter.ELogicalOperation.OR.

There are only two ways to use filters:

  1. all filters attached to Filter.ROOT_NODE using Filter.ELogicalOperation.AND condition
  2. some filters attached to Filter.ROOT_NODE using Filter.ELogicalOperation.OR condition and all the other filters attached to these root filters using Filter.ELogicalOperation.AND condition

Parameters:
parentFilterId - parent filter id. if there is no parent filter use Filter.ROOT_NODE instead.
operation - logical operation type is either Filter.ELogicalOperation.AND or Filter.ELogicalOperation.OR.
fieldId - catalog field number. fieldId value is 0-based. e.g., 0 for the first field.
condition - filter condition based on Filter.ECondition enum.
value - the value data to be filtered by.
Returns:
Added filter id.
Throws:
ClientException - if SrvrSession not connected to server
ClientRuntimeException - if field not found in this table

addUpdateFilter

public int addUpdateFilter(int parentFilterId,
                           Filter.ELogicalOperation operation,
                           java.lang.String fieldAcronym,
                           Filter.ECondition condition,
                           java.lang.String value)
                    throws ClientException
Adds filter to this table to process online data. Supports logical operations Filter.ELogicalOperation.AND and Filter.ELogicalOperation.OR.

There are only two ways to use filters:

  1. all filters attached to Filter.ROOT_NODE using Filter.ELogicalOperation.AND condition
  2. some filters attached to Filter.ROOT_NODE using Filter.ELogicalOperation.OR condition and all the other filters attached to these root filters using Filter.ELogicalOperation.AND condition

Parameters:
parentFilterId - parent filter id. if there is no parent filter use Filter.ROOT_NODE instead.
operation - logical operation type is either Filter.ELogicalOperation.AND or Filter.ELogicalOperation.OR.
fieldAcronym - catalog field acronym.
condition - filter condition based on Filter.ECondition enum.
value - the value data to be filtered by.
Returns:
Added filter id.
Throws:
ClientException - if SrvrSession not connected to server
ClientRuntimeException - if field not found in this table

deleteUpdateFilter

public void deleteUpdateFilter(int filterId)
                        throws ClientException
Removes online data filter with given filterId from table filters set.

Parameters:
filterId - id filter to be removed by.
Throws:
ClientException - if SrvrSession not connected to server

addUpdateFilterView

public void addUpdateFilterView(int... fieldIds)
                         throws ClientException
Makes server to send only given fields in online data. Quotes tables not supported.

Parameters:
fieldIds - catalog field numbers. fieldIds values is 0-based. e.g., 0 for the first field. if the argument is null or empty, it has the same effect as calling clearUpdateFilterView method.
Throws:
ClientException - if SrvrSession not connected to server
ClientRuntimeException - if field not found in this table

addUpdateFilterView

public void addUpdateFilterView(java.lang.String... fieldAcronyms)
                         throws ClientException
Makes server to send only given fields in online data. Quotes tables not supported.

Parameters:
fieldAcronyms - catalog field acronyms. if the argument is null or empty, it has the same effect as calling clearUpdateFilterView method.
Throws:
ClientException - if SrvrSession not connected to server
ClientRuntimeException - if field not found in this table

clearUpdateFilterView

public void clearUpdateFilterView()
                           throws ClientException
Removes all online data fields filters.

Throws:
ClientException - if SrvrSession not connected to server

createFilter

public Filter createFilter(int fieldId,
                           Filter.ECondition condition,
                           java.lang.String value)
Creates a Filter with the given field number for this Table

Parameters:
fieldId - catalog field number. fieldId value is 0-based. e.g., 0 for the first field.
condition - filter condition based on Filter.ECondition enum.
value - the value data to be filtered by.
Returns:
Created filter.
Throws:
ClientRuntimeException - if field not found in this table

createFilter

public Filter createFilter(java.lang.String fieldAcronym,
                           Filter.ECondition condition,
                           java.lang.String value)
Creates a Filter with the given field name for this Table

Parameters:
fieldAcronym - catalog field acronym.
condition - filter condition based on Filter.ECondition enum.
value - the value data to be filtered by.
Returns:
Created filter.
Throws:
ClientRuntimeException - if field not found in this table

createRow

public Row createRow()
Creates new data row structure.

Returns:
newly created Row

insert

public void insert(Row row)
            throws ClientException
Inserts new row to this table.

Parameters:
row - new Row to insert.
Throws:
ClientException - if SrvrSession not connected to server

modify

public void modify(Row row)
            throws ClientException
Updates row of this table.

Parameters:
row - Row to be updated. Client application should always fill I_RID key field, and I_CLIENT_NAME client code field if this table is addressed. In CLIENTS table there is only I_CLIENT_NAME field.
Throws:
ClientException - if SrvrSession not connected to server or I_RID field not found

delete

public void delete(java.lang.Long recid)
            throws ClientException
Deletes row in table by I_RID.

Parameters:
recid - key field.
Throws:
ClientException - if SrvrSession not connected to server

clear

public void clear()
           throws ClientException
Clears this table.

Throws:
ClientException - if SrvrSession not connected to server


Copyright 2015 IFH-InfoCentre, Ltd.