com.dhtmlx.connector
Class DataProcessor

java.lang.Object
  extended by com.dhtmlx.connector.DataProcessor
Direct Known Subclasses:
GridDataProcessor, SchedulerDataProcessor, TreeDataProcessor

public class DataProcessor
extends java.lang.Object

The Class DataProcessor. Handles "update" part of logic. This class can be used as a base for component specific data processors.


Field Summary
protected  BaseFactory cfactory
          The class factory.
protected  DataConfig config
          The config.
protected  BaseConnector connector
          The master connector.
protected  DataRequest request
          The request.
 
Constructor Summary
DataProcessor(BaseConnector connector, DataConfig config, DataRequest request, BaseFactory cfactory)
          Instantiates a new data processor.
 
Method Summary
private  void check_exts(DataAction action, OperationType mode)
          Checks if there an external event or SQL code was defined for current action
protected  java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,java.lang.String>> get_post_values(java.lang.String[] ids)
          Sort incoming data, creates a hash of data for each record in incoming request
private  void inner_process(DataAction action)
          Inner processing routine, called for each record in incoming request
protected  java.lang.String name_data(java.lang.String name)
          Convert incoming parameter name to name of DB field
private  java.lang.String output_as_xml(java.util.ArrayList<DataAction> result)
          Convert state to xml string
 java.lang.String process()
          Process incoming request Detects the list of the operation in incoming request Process operations one by one
protected  OperationType status_to_mode(java.lang.String status)
          Convert incoming client side status, to DB operation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

connector

protected BaseConnector connector
The master connector.


config

protected DataConfig config
The config.


request

protected DataRequest request
The request.


cfactory

protected BaseFactory cfactory
The class factory.

Constructor Detail

DataProcessor

public DataProcessor(BaseConnector connector,
                     DataConfig config,
                     DataRequest request,
                     BaseFactory cfactory)
Instantiates a new data processor.

Parameters:
connector - the connector
config - the config
request - the request
cfactory - the class factory
Method Detail

name_data

protected java.lang.String name_data(java.lang.String name)
Convert incoming parameter name to name of DB field

Parameters:
name - the parameter name
Returns:
the DB field name

get_post_values

protected java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,java.lang.String>> get_post_values(java.lang.String[] ids)
Sort incoming data, creates a hash of data for each record in incoming request

Parameters:
ids - the array of record ids, data for which need to be allocated
Returns:
the id to record hash

process

public java.lang.String process()
                         throws ConnectorOperationException,
                                ConnectorConfigException
Process incoming request Detects the list of the operation in incoming request Process operations one by one

Returns:
the xml string, representing result of operation
Throws:
ConnectorOperationException - the connector operation exception
ConnectorConfigException - the connector config exception

status_to_mode

protected OperationType status_to_mode(java.lang.String status)
                                throws ConnectorOperationException
Convert incoming client side status, to DB operation

Parameters:
status - the status from incoming request
Returns:
the operation type
Throws:
ConnectorOperationException - the connector operation exception

output_as_xml

private java.lang.String output_as_xml(java.util.ArrayList<DataAction> result)
Convert state to xml string

Parameters:
result - the list of data actions , created during processing
Returns:
the xml string

inner_process

private void inner_process(DataAction action)
                    throws ConnectorConfigException,
                           ConnectorOperationException
Inner processing routine, called for each record in incoming request

Parameters:
action - the data action which need to be processed
Throws:
ConnectorConfigException - the connector config exception
ConnectorOperationException - the connector operation exception

check_exts

private void check_exts(DataAction action,
                        OperationType mode)
                 throws ConnectorConfigException,
                        ConnectorOperationException
Checks if there an external event or SQL code was defined for current action

Parameters:
action - the action
mode - the operation type
Throws:
ConnectorConfigException - the connector config exception
ConnectorOperationException - the connector operation exception