org.fosstrak.epcis.repository.capture
Interface CaptureOperationsBackend

All Known Implementing Classes:
CaptureOperationsBackendSQL

public interface CaptureOperationsBackend

The CaptureOperationsBackend provides the persistence functionality required by the CaptureOperationsModule. It offers methods to store EPCIS events, vocabularies, or EPCs to the database; and provides a method to retrieve already existing vocabularies from the database. A CaptureOperationsSession object which holds the database connection is required to be passed into each of the methods.

Author:
Marco Steybe

Method Summary
 void dbReset(Connection dbconnection, String dbResetScript)
          Runs the dbreset SQL script.
 Long getVocabularyElement(CaptureOperationsSession session, String vocabularyType, String vocabularyElement)
          Retrieves the ID (primary key) of the vocabulary with the given type that matches the given URI string.
 Long insertAggregationEvent(CaptureOperationsSession session, Timestamp eventTime, Timestamp recordTime, String eventTimeZoneOffset, Long bizStepId, Long dispositionId, Long readPointId, Long bizLocationId, String action, String parentId)
          Inserts a new EPCIS aggregation event into the database.
 Long insertBusinessTransaction(CaptureOperationsSession session, String bizTrans, String bizTransType)
          Inserts the BusinessTransactionType and the BusinessTransactionID into the BusinessTransaction-Table if necessary.
 void insertBusinessTransactionsForEvent(CaptureOperationsSession session, long eventId, String eventType, List<BusinessTransactionType> btts)
           
 void insertEpcsForEvent(CaptureOperationsSession session, long eventId, String eventType, List<String> epcs)
          Inserts the given EPCs into the database and associates them with the EPCIS event with the given type and ID (primary key).
 void insertExtensionFieldsForEvent(CaptureOperationsSession session, long eventId, String eventType, List<EventFieldExtension> exts)
           
 Long insertObjectEvent(CaptureOperationsSession session, Timestamp eventTime, Timestamp recordTime, String eventTimeZoneOffset, Long bizStepId, Long dispositionId, Long readPointId, Long bizLocationId, String action)
          Inserts a new EPCIS object event into the database.
 Long insertQuantityEvent(CaptureOperationsSession session, Timestamp eventTime, Timestamp recordTime, String eventTimeZoneOffset, Long bizStepId, Long dispositionId, Long readPointId, Long bizLocationId, Long epcClassId, Long quantity)
          Inserts a new EPCIS quantity event into the database.
 Long insertTransactionEvent(CaptureOperationsSession session, Timestamp eventTime, Timestamp recordTime, String eventTimeZoneOffset, Long bizStepId, Long dispositionId, Long readPointId, Long bizLocationId, String action, String parentId)
          Inserts a new EPCIS transaction event into the database.
 Long insertVocabularyElement(CaptureOperationsSession session, String vocabularyType, String vocabularyElement)
          Inserts the vocabulary of the given type and the given vocabulary element URI into the database.
 CaptureOperationsSession openSession(DataSource dataSource)
          Opens a new session for the database transaction.
 

Method Detail

dbReset

void dbReset(Connection dbconnection,
             String dbResetScript)
             throws SQLException,
                    IOException
Runs the dbreset SQL script.

Parameters:
dbconnection - The JDBC Connection object.
dbResetScript - The filename of the SQL script to execute.
Throws:
SQLException - If an error with the database occurred.
IOException - If an exception reading from the SQL script occurred.

openSession

CaptureOperationsSession openSession(DataSource dataSource)
                                     throws SQLException
Opens a new session for the database transaction.

Parameters:
dataSource - The DataSource object to retrieve the database connection from.
Returns:
A CaptureOperationsSession instantiated with the database connection retrieved from the given DataSource.
Throws:
SQLException - If an SQL error occurred.

insertObjectEvent

Long insertObjectEvent(CaptureOperationsSession session,
                       Timestamp eventTime,
                       Timestamp recordTime,
                       String eventTimeZoneOffset,
                       Long bizStepId,
                       Long dispositionId,
                       Long readPointId,
                       Long bizLocationId,
                       String action)
                       throws SQLException
Inserts a new EPCIS object event into the database.

Parameters:
session - The database session.
eventTime - The event's 'eventTime' parameter.
recordTime - The event's 'recordTime' parameter.
eventTimeZoneOffset - The event's 'eventTimeZoneOffset' parameter.
bizStepId - The event's 'BusinessStepID' parameter.
dispositionId - The event's 'DispositionID' parameter.
readPointId - The event's 'ReadPointID' parameter.
bizLocationId - The event's 'BusinessLocationID' parameter.
action - The event's 'action' parameter.
Returns:
The database primary key of the inserted EPCIS object event.
Throws:
SQLException - If an SQL exception occurred.

insertTransactionEvent

Long insertTransactionEvent(CaptureOperationsSession session,
                            Timestamp eventTime,
                            Timestamp recordTime,
                            String eventTimeZoneOffset,
                            Long bizStepId,
                            Long dispositionId,
                            Long readPointId,
                            Long bizLocationId,
                            String action,
                            String parentId)
                            throws SQLException
Inserts a new EPCIS transaction event into the database.

Parameters:
session - The database session.
eventTime - The event's 'eventTime' parameter.
recordTime - The event's 'recordTime' parameter.
eventTimeZoneOffset - The event's 'eventTimeZoneOffset' parameter.
bizStepId - The event's 'BusinessStepID' parameter.
dispositionId - The event's 'DispositionID' parameter.
readPointId - The event's 'ReadPointID' parameter.
bizLocationId - The event's 'BusinessLocationID' parameter.
action - The event's 'action' parameter.
parentId - The event's 'ParentID' parameter.
Returns:
The database primary key of the inserted EPCIS transaction event.
Throws:
SQLException - If an SQL exception occurred.

insertAggregationEvent

Long insertAggregationEvent(CaptureOperationsSession session,
                            Timestamp eventTime,
                            Timestamp recordTime,
                            String eventTimeZoneOffset,
                            Long bizStepId,
                            Long dispositionId,
                            Long readPointId,
                            Long bizLocationId,
                            String action,
                            String parentId)
                            throws SQLException
Inserts a new EPCIS aggregation event into the database.

Parameters:
session - The database session.
eventTime - The event's 'eventTime' parameter.
recordTime - The event's 'recordTime' parameter.
eventTimeZoneOffset - The event's 'eventTimeZoneOffset' parameter.
bizStepId - The event's 'BusinessStepID' parameter.
dispositionId - The event's 'DispositionID' parameter.
readPointId - The event's 'ReadPointID' parameter.
bizLocationId - The event's 'BusinessLocationID' parameter.
action - The event's 'action' parameter.
parentId - The event's 'ParentID' parameter.
Returns:
The database primary key of the inserted EPCIS aggregation event.
Throws:
SQLException - If an SQL exception occurred.

insertQuantityEvent

Long insertQuantityEvent(CaptureOperationsSession session,
                         Timestamp eventTime,
                         Timestamp recordTime,
                         String eventTimeZoneOffset,
                         Long bizStepId,
                         Long dispositionId,
                         Long readPointId,
                         Long bizLocationId,
                         Long epcClassId,
                         Long quantity)
                         throws SQLException
Inserts a new EPCIS quantity event into the database.

Parameters:
session - The database session.
eventTime - The event's 'eventTime' parameter.
recordTime - The event's 'recordTime' parameter.
eventTimeZoneOffset - The event's 'eventTimeZoneOffset' parameter.
bizStepId - The event's 'BusinessStepID' parameter.
dispositionId - The event's 'DispositionID' parameter.
readPointId - The event's 'ReadPointID' parameter.
bizLocationId - The event's 'BusinessLocationID' parameter.
epcClassId - The event's 'EpcClassID' parameter.
quantity - The event's 'quantity' parameter.
Returns:
The database primary key of the inserted EPCIS quantity event.
Throws:
SQLException - If an SQL exception occurred.

insertEpcsForEvent

void insertEpcsForEvent(CaptureOperationsSession session,
                        long eventId,
                        String eventType,
                        List<String> epcs)
                        throws SQLException
Inserts the given EPCs into the database and associates them with the EPCIS event with the given type and ID (primary key).

Parameters:
session - The database session.
eventId - The ID (primary key) of the EPCIS event for which the EPCs should be inserted.
eventType - The type of the EPCIS event for which the EPCs should be inserted.
epcs - The List of EPCs to insert.
Throws:
SQLException - If an SQL error occurred.

getVocabularyElement

Long getVocabularyElement(CaptureOperationsSession session,
                          String vocabularyType,
                          String vocabularyElement)
                          throws SQLException
Retrieves the ID (primary key) of the vocabulary with the given type that matches the given URI string. If no vocabulary element with the given URI exists, null will be returned.

Parameters:
session - The database session.
vocabularyType - The type of the vocabulary to retrieve. The type determines from which database table name the primary key will be retrieved.
vocabularyElement - The URI string of the vocabulary element to retrieve.
Returns:
The ID (primary key) of the matching vocabulary element, or null if none was found.
Throws:
SQLException - If an SQL error occurred.

insertVocabularyElement

Long insertVocabularyElement(CaptureOperationsSession session,
                             String vocabularyType,
                             String vocabularyElement)
                             throws SQLException
Inserts the vocabulary of the given type and the given vocabulary element URI into the database.

Parameters:
session - The database session.
vocabularyType - The type of the vocabulary to insert. The type determines to which database table name the vocabulary will be inserted.
vocabularyElement - The URI string of the vocabulary element to insert.
Returns:
The ID (primary key) of the inserted vocabulary element.
Throws:
SQLException - If an SQL error occurred.

insertBusinessTransaction

Long insertBusinessTransaction(CaptureOperationsSession session,
                               String bizTrans,
                               String bizTransType)
                               throws SQLException
Inserts the BusinessTransactionType and the BusinessTransactionID into the BusinessTransaction-Table if necessary.

Parameters:
session - The database session.
bizTrans - The BusinessTransaction to be inserted.
bizTransType - The type of the business transaction to insert.
Returns:
The ID from the BusinessTransaction-table.
Throws:
SQLException - If an SQL problem with the database occurred.

insertBusinessTransactionsForEvent

void insertBusinessTransactionsForEvent(CaptureOperationsSession session,
                                        long eventId,
                                        String eventType,
                                        List<BusinessTransactionType> btts)
                                        throws SQLException
Throws:
SQLException

insertExtensionFieldsForEvent

void insertExtensionFieldsForEvent(CaptureOperationsSession session,
                                   long eventId,
                                   String eventType,
                                   List<EventFieldExtension> exts)
                                   throws SQLException
Throws:
SQLException


Copyright © 2010. All Rights Reserved.