com.scooterframework.orm.sqldataexpress.service
Class SqlServiceImpl

java.lang.Object
  extended by com.scooterframework.orm.sqldataexpress.service.SqlServiceImpl
All Implemented Interfaces:
SqlService, SqlServiceGeneric, SqlServiceSpecific, SqlServiceTransactionManager

public class SqlServiceImpl
extends java.lang.Object
implements SqlService

SqlServiceImpl class implements SqlService interface.


Constructor Summary
SqlServiceImpl()
           
 
Method Summary
 void beginTransaction()
          Begin a transaction of default transaction type.
 void beginTransaction(java.lang.String type)
          Begin a transaction of a specific type.
 void commitTransaction()
          Commit a transaction.
 int delete(java.util.Map<java.lang.String,java.lang.Object> inputs, java.lang.String processorType, java.lang.String processorName)
          Delete data from database.
 java.util.Collection<OmniDTO> execute(java.util.Collection<InputInfo> inputInfoList)
          execute a collection of InputInfo objects in one transaction
 OmniDTO execute(java.util.Collection<InputParameter> inputParameters, java.lang.String processorType, java.lang.String processorName)
          execute
 OmniDTO execute(java.util.Collection<InputParameter> inputParameters, java.lang.String processorType, java.lang.String processorName, java.util.Map<java.lang.String,java.lang.String> outputFilters)
          execute of InputInfo with output filter
 OmniDTO execute(java.util.Map<java.lang.String,java.lang.Object> inputs, java.lang.String processorType, java.lang.String processorName)
          execute without output filter
 OmniDTO execute(java.util.Map<java.lang.String,java.lang.Object> inputs, java.lang.String processorType, java.lang.String processorName, java.util.Map<java.lang.String,java.lang.String> outputFilters)
          execute with output filter
 void insert(java.util.Map<java.lang.String,java.lang.Object> inputs, java.lang.String processorType, java.lang.String processorName)
          Insert data to database.
 void releaseResources()
          Release all resources hold by this transaction.
 OmniDTO retrieveMasterDetails(InputInfo inputInfo)
          execute a collection of InputInfo objects in one transaction
 TableData retrieveRow(java.util.Map<java.lang.String,java.lang.Object> inputs, java.lang.String processorType, java.lang.String processorName)
          Retrieve a single row data from database.
 TableData retrieveRows(java.util.Map<java.lang.String,java.lang.Object> inputs, java.lang.String processorType, java.lang.String processorName)
          Retrieve a list of rows from database.
 TableData retrieveRows(java.util.Map<java.lang.String,java.lang.Object> inputs, java.lang.String processorType, java.lang.String processorName, int limitOrFixed)
           Retrieve a list of rows from database with a certain limit range.
 TableData retrieveRows(java.util.Map<java.lang.String,java.lang.Object> inputs, java.lang.String processorType, java.lang.String processorName, int limitOrFixed, int offset)
           Retrieve a list of rows from database with a certain limit range.
 void rollbackTransaction()
          Rollback a transaction.
 int update(java.util.Map<java.lang.String,java.lang.Object> inputs, java.lang.String processorType, java.lang.String processorName)
          Update data in database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SqlServiceImpl

public SqlServiceImpl()
Method Detail

beginTransaction

public void beginTransaction()
                      throws TransactionException
Begin a transaction of default transaction type. The default transaction type is JDBC if it is not defined in property file.

Specified by:
beginTransaction in interface SqlServiceTransactionManager
Throws:
TransactionException

beginTransaction

public void beginTransaction(java.lang.String type)
                      throws TransactionException
Begin a transaction of a specific type.

Specified by:
beginTransaction in interface SqlServiceTransactionManager
Throws:
TransactionException

commitTransaction

public void commitTransaction()
                       throws TransactionException
Commit a transaction.

Specified by:
commitTransaction in interface SqlServiceTransactionManager
Throws:
TransactionException

rollbackTransaction

public void rollbackTransaction()
                         throws TransactionException
Rollback a transaction.

Specified by:
rollbackTransaction in interface SqlServiceTransactionManager
Throws:
TransactionException

releaseResources

public void releaseResources()
                      throws TransactionException
Release all resources hold by this transaction.

Specified by:
releaseResources in interface SqlServiceTransactionManager
Throws:
TransactionException

execute

public OmniDTO execute(java.util.Map<java.lang.String,java.lang.Object> inputs,
                       java.lang.String processorType,
                       java.lang.String processorName)
                throws BaseSQLException
execute without output filter

Specified by:
execute in interface SqlServiceGeneric
Throws:
BaseSQLException

execute

public OmniDTO execute(java.util.Map<java.lang.String,java.lang.Object> inputs,
                       java.lang.String processorType,
                       java.lang.String processorName,
                       java.util.Map<java.lang.String,java.lang.String> outputFilters)
                throws BaseSQLException
execute with output filter

Specified by:
execute in interface SqlServiceGeneric
Throws:
BaseSQLException

execute

public java.util.Collection<OmniDTO> execute(java.util.Collection<InputInfo> inputInfoList)
                                      throws BaseSQLException
execute a collection of InputInfo objects in one transaction

Specified by:
execute in interface SqlServiceGeneric
Throws:
BaseSQLException

retrieveMasterDetails

public OmniDTO retrieveMasterDetails(InputInfo inputInfo)
                              throws BaseSQLException
execute a collection of InputInfo objects in one transaction

Specified by:
retrieveMasterDetails in interface SqlServiceGeneric
Throws:
BaseSQLException

execute

public OmniDTO execute(java.util.Collection<InputParameter> inputParameters,
                       java.lang.String processorType,
                       java.lang.String processorName)
                throws BaseSQLException
execute

Specified by:
execute in interface SqlServiceGeneric
Throws:
BaseSQLException

execute

public OmniDTO execute(java.util.Collection<InputParameter> inputParameters,
                       java.lang.String processorType,
                       java.lang.String processorName,
                       java.util.Map<java.lang.String,java.lang.String> outputFilters)
                throws BaseSQLException
execute of InputInfo with output filter

Specified by:
execute in interface SqlServiceGeneric
Throws:
BaseSQLException

retrieveRow

public TableData retrieveRow(java.util.Map<java.lang.String,java.lang.Object> inputs,
                             java.lang.String processorType,
                             java.lang.String processorName)
                      throws BaseSQLException
Retrieve a single row data from database. If more than one records is returned, an UnexpectedDataException will be thrown.

Specified by:
retrieveRow in interface SqlServiceSpecific
Parameters:
inputs - Map of input data
processorType - A named SQL or direct SQL or stored procedure
processorName - SQL name or SQL itself or stored procedure name
Returns:
TableData The row data
Throws:
BaseSQLException

retrieveRows

public TableData retrieveRows(java.util.Map<java.lang.String,java.lang.Object> inputs,
                              java.lang.String processorType,
                              java.lang.String processorName)
                       throws BaseSQLException
Retrieve a list of rows from database.

Specified by:
retrieveRows in interface SqlServiceSpecific
Parameters:
inputs - Map of input data
processorType - A named SQL or direct SQL or stored procedure
processorName - SQL name or SQL itself or stored procedure name
Returns:
TableData The list of row data
Throws:
BaseSQLException

retrieveRows

public TableData retrieveRows(java.util.Map<java.lang.String,java.lang.Object> inputs,
                              java.lang.String processorType,
                              java.lang.String processorName,
                              int limitOrFixed)
                       throws BaseSQLException

Retrieve a list of rows from database with a certain limit range. If the number of returned records is more than the preset limit range, an UnexpectedDataException will be thrown.

If DataProcessor.input_key_records_fixed key has value "true" in inputs, absolute fixed number of records is required. An UnexpectedDataException will be thrown if the number of retrieved records is not equal to limitOrFixed.

If the limitOrFixed = -1, all records are retrieved.

Specified by:
retrieveRows in interface SqlServiceSpecific
Parameters:
inputs - Map of input data
processorType - A named SQL or direct SQL or stored procedure
processorName - SQL name or SQL itself or stored procedure name
limitOrFixed - Number of desired (limit) or fixed records to retrieve
Returns:
TableData The row data
Throws:
BaseSQLException

retrieveRows

public TableData retrieveRows(java.util.Map<java.lang.String,java.lang.Object> inputs,
                              java.lang.String processorType,
                              java.lang.String processorName,
                              int limitOrFixed,
                              int offset)
                       throws BaseSQLException

Retrieve a list of rows from database with a certain limit range. If the number of returned records is more than the preset limit range, an UnexpectedDataException will be thrown.

If DataProcessor.input_key_records_fixed key has value "true" in inputs, absolute fixed number of records is required. An UnexpectedDataException will be thrown if the number of retrieved records is not equal to limitOrFixed.

If the limitOrFixed = -1, all records are retrieved. offset defaults to 0.

Specified by:
retrieveRows in interface SqlServiceSpecific
Parameters:
inputs - Map of input data
processorType - A named SQL or direct SQL or stored procedure
processorName - SQL name or SQL itself or stored procedure name
limitOrFixed - Number of desired (limit) or fixed records to retrieve
offset - int for offset
Returns:
TableData The row data
Throws:
BaseSQLException

insert

public void insert(java.util.Map<java.lang.String,java.lang.Object> inputs,
                   java.lang.String processorType,
                   java.lang.String processorName)
            throws BaseSQLException
Insert data to database.

Specified by:
insert in interface SqlServiceSpecific
Parameters:
inputs - Map of input data
processorType - A named SQL or direct SQL or stored procedure
processorName - SQL name or SQL itself or stored procedure name
Throws:
BaseSQLException

delete

public int delete(java.util.Map<java.lang.String,java.lang.Object> inputs,
                  java.lang.String processorType,
                  java.lang.String processorName)
           throws BaseSQLException
Delete data from database.

Specified by:
delete in interface SqlServiceSpecific
Parameters:
inputs - Map of input data
processorType - A named SQL or direct SQL or stored procedure
processorName - SQL name or SQL itself or stored procedure name
Returns:
int number of rows deleted
Throws:
BaseSQLException

update

public int update(java.util.Map<java.lang.String,java.lang.Object> inputs,
                  java.lang.String processorType,
                  java.lang.String processorName)
           throws BaseSQLException
Update data in database.

Specified by:
update in interface SqlServiceSpecific
Parameters:
inputs - Map of input data
processorType - A named SQL or direct SQL or stored procedure
processorName - SQL name or SQL itself or stored procedure name
Returns:
int number of rows updated
Throws:
BaseSQLException