com.partnersoft.modules.inspection.model
Interface InspectionStore

All Known Implementing Classes:
SqlInspectionStore

public interface InspectionStore

A database or similar storage tool for a single type of Inspections.

Copyright 2008 Partner Software, Inc.

Version:
$Id$
Author:
Paul Reavis

Method Summary
 void buildTables()
          Creates the Admin table and inspection table.
 int checkOutJobs(InspectionStore centralStore, java.lang.String user)
          Checks out only records with assigned_to values == user name or uses where clause returned by preCheckout script.
 int checkOutJobsWithQuery(InspectionStore centralStore, java.lang.String whereClause)
          Checks out only records with assigned_to values == user name.
 void connect()
           
 boolean databaseExists()
          True/false for this store's database's existence.
 void disconnect()
           
 java.lang.String getBlobTableName()
           
 java.lang.String getFieldTableName()
           
 java.lang.String getInspectionTableName()
           
 java.lang.String getInspectionType()
           
 java.lang.String getName()
           
 java.lang.String getPicklistTableName()
           
 java.lang.String getPublishingTableName()
           
 java.lang.String getSyncTableName()
           
 com.partnersoft.data.DateAndTime lastSynchronizationWith(java.lang.String storeName)
           
 void matchDatabaseToSchema(java.lang.String tableName)
          Compare table to stored schema.
 com.partnersoft.io.DataRecordSource query(java.lang.String sql)
          Queries this store using the passed String as an SQL statement
 com.partnersoft.io.DataRecordSource query(java.lang.String sql, int fetchSize)
          Queries this store using the passed String as an SQL statement Uses a streaming result set.
 com.partnersoft.io.DataRecordSource queryBlobs()
          Return record source for all Blobs in this store.
 com.partnersoft.io.DataRecordSource queryBlobs(int fetchSize)
          Return record source for all Blobs in this store.
 com.partnersoft.io.DataRecordSource queryBlobs(java.lang.String whereClause)
          Queries this store using the passed String as an SQL where clause.
 com.partnersoft.io.DataRecordSource queryBlobs(java.lang.String whereClause, int fetchSize)
          Queries this store using the passed String as an SQL where clause.
 com.partnersoft.io.DataRecordSource queryInspections()
          Return record source for all inspections in this store.
 com.partnersoft.io.DataRecordSource queryInspections(int fetchSize)
          Return record source for all inspections in this store.
 com.partnersoft.io.DataRecordSource queryInspections(java.lang.String whereClause)
          Queries this store using the passed String as an SQL where clause.
 com.partnersoft.io.DataRecordSource queryInspections(java.lang.String whereClause, int fetchSize)
          Queries this store using the passed String as an SQL where clause.
 void removeInspection(java.lang.String guid)
           
 Inspection retrieveInspection(java.lang.String guid)
          Return the stored inspection with this guid.
 void storeInspection(Inspection inspection)
          Save passed inspection in this store.
 int synchronize(InspectionStore centralStore)
          Handles uploading changes to the central hub, and erasing the local database.
 com.partnersoft.data.Naming<java.lang.Object> synchronizeWithAllRecords(InspectionStore centralStore)
          Updates all modified records on central store, and downloads all records from central store.
 com.partnersoft.data.Naming<java.lang.Object> synchronizeWithCheckOut(InspectionStore centralStore)
          Updates all modified records on central store, and downloads all records from central store with module_assigned_to.
 void updateInspection(java.lang.String guid, com.partnersoft.data.Naming<java.lang.Object> data)
           
 void updateInspection(java.lang.String guid, java.lang.Object... data)
           
 

Method Detail

getName

java.lang.String getName()

getInspectionType

java.lang.String getInspectionType()

storeInspection

void storeInspection(Inspection inspection)
                     throws java.io.IOException,
                            java.sql.SQLException
Save passed inspection in this store.

Parameters:
inspection -
Throws:
java.io.IOException
java.sql.SQLException

retrieveInspection

Inspection retrieveInspection(java.lang.String guid)
                              throws java.io.IOException,
                                     java.sql.SQLException
Return the stored inspection with this guid.

Parameters:
guid -
Returns:
Throws:
java.io.IOException
java.sql.SQLException

databaseExists

boolean databaseExists()
True/false for this store's database's existence.

Returns:

buildTables

void buildTables()
                 throws java.sql.SQLException
Creates the Admin table and inspection table.

Throws:
java.sql.SQLException

queryInspections

com.partnersoft.io.DataRecordSource queryInspections()
                                                     throws java.sql.SQLException
Return record source for all inspections in this store.

Returns:
Throws:
java.sql.SQLException

queryInspections

com.partnersoft.io.DataRecordSource queryInspections(int fetchSize)
                                                     throws java.sql.SQLException
Return record source for all inspections in this store. Uses a streaming result set to return the Inspections.

Parameters:
fetchSize - - number of records to hold in memory at a time.
Returns:
Throws:
java.sql.SQLException

queryInspections

com.partnersoft.io.DataRecordSource queryInspections(java.lang.String whereClause)
                                                     throws java.sql.SQLException
Queries this store using the passed String as an SQL where clause.

Parameters:
params -
Returns:
Throws:
java.sql.SQLException

queryInspections

com.partnersoft.io.DataRecordSource queryInspections(java.lang.String whereClause,
                                                     int fetchSize)
                                                     throws java.sql.SQLException
Queries this store using the passed String as an SQL where clause. Uses a streaming result set.

Parameters:
whereClause - - Sql where clause to use.
fetchSize - - number of records to hold in memory at a time.
Returns:
Throws:
java.sql.SQLException

query

com.partnersoft.io.DataRecordSource query(java.lang.String sql)
                                          throws java.sql.SQLException
Queries this store using the passed String as an SQL statement

Parameters:
sql - - query SQL to execute
Returns:
- DataRecordSource returned from querying this store.
Throws:
java.sql.SQLException - - When SQL badness occurs.

query

com.partnersoft.io.DataRecordSource query(java.lang.String sql,
                                          int fetchSize)
                                          throws java.sql.SQLException
Queries this store using the passed String as an SQL statement Uses a streaming result set.

Parameters:
sql - - query SQL to execute
fetchSize - - number of records to hold in memory at a time.
Returns:
- DataRecordSource returned from querying this store.
Throws:
java.sql.SQLException - - When SQL badness occurs.

queryBlobs

com.partnersoft.io.DataRecordSource queryBlobs()
                                               throws java.sql.SQLException
Return record source for all Blobs in this store.

Returns:
Throws:
java.sql.SQLException

queryBlobs

com.partnersoft.io.DataRecordSource queryBlobs(int fetchSize)
                                               throws java.sql.SQLException
Return record source for all Blobs in this store. Uses a streaming result set.

Parameters:
fetchSize - - number of records to hold in memory at a time.
Returns:
Throws:
java.sql.SQLException

queryBlobs

com.partnersoft.io.DataRecordSource queryBlobs(java.lang.String whereClause)
                                               throws java.sql.SQLException
Queries this store using the passed String as an SQL where clause.

Parameters:
whereClause - - Sql where clause to use.
Returns:
Throws:
java.sql.SQLException

queryBlobs

com.partnersoft.io.DataRecordSource queryBlobs(java.lang.String whereClause,
                                               int fetchSize)
                                               throws java.sql.SQLException
Queries this store using the passed String as an SQL where clause. Uses a streaming result set.

Parameters:
whereClause - - Sql where clause to use.
fetchSize - - number of records to hold in memory at a time.
Returns:
Throws:
java.sql.SQLException

matchDatabaseToSchema

void matchDatabaseToSchema(java.lang.String tableName)
Compare table to stored schema. Correcting any differences.

Parameters:
tableName -

lastSynchronizationWith

com.partnersoft.data.DateAndTime lastSynchronizationWith(java.lang.String storeName)
                                                         throws java.io.IOException,
                                                                java.sql.SQLException
Throws:
java.io.IOException
java.sql.SQLException

synchronizeWithAllRecords

com.partnersoft.data.Naming<java.lang.Object> synchronizeWithAllRecords(InspectionStore centralStore)
                                                                        throws java.io.IOException,
                                                                               java.sql.SQLException
Updates all modified records on central store, and downloads all records from central store. Returns naming of details.

Parameters:
centralStore - - Store to move updated records to.
Returns:
- The synch details.
Throws:
java.io.IOException
java.sql.SQLException

synchronize

int synchronize(InspectionStore centralStore)
                throws java.io.IOException,
                       java.sql.SQLException
Handles uploading changes to the central hub, and erasing the local database. Returns count of uploaded records for reports.

Expects a connected centralStore.

Parameters:
centralStore -
Returns:
int count of uploaded records.
Throws:
java.io.IOException
java.sql.SQLException

synchronizeWithCheckOut

com.partnersoft.data.Naming<java.lang.Object> synchronizeWithCheckOut(InspectionStore centralStore)
                                                                      throws java.io.IOException,
                                                                             java.sql.SQLException
Updates all modified records on central store, and downloads all records from central store with module_assigned_to. Matching the user name stored in preferences. Returns naming of details.

Parameters:
centralStore - - Store to move updated records to.
Returns:
- The synch details.
Throws:
java.io.IOException
java.sql.SQLException

connect

void connect()
             throws java.sql.SQLException
Throws:
java.sql.SQLException

disconnect

void disconnect()
                throws java.sql.SQLException
Throws:
java.sql.SQLException

checkOutJobsWithQuery

int checkOutJobsWithQuery(InspectionStore centralStore,
                          java.lang.String whereClause)
                          throws java.io.IOException,
                                 java.sql.SQLException
Checks out only records with assigned_to values == user name. Returns number of records downloaded.

Where clause is appended to SQL of format 'Select * from '

Parameters:
centralStore - - hub database.
whereClause - - SQL where clause to execute.
Returns:
Throws:
java.io.IOException
java.sql.SQLException

checkOutJobs

int checkOutJobs(InspectionStore centralStore,
                 java.lang.String user)
                 throws java.io.IOException,
                        java.sql.SQLException
Checks out only records with assigned_to values == user name or uses where clause returned by preCheckout script. Returns number of records downloaded.

Parameters:
centralStore -
user -
Returns:
Throws:
java.io.IOException
java.sql.SQLException

removeInspection

void removeInspection(java.lang.String guid)
                      throws java.io.IOException,
                             java.sql.SQLException
Throws:
java.io.IOException
java.sql.SQLException

updateInspection

void updateInspection(java.lang.String guid,
                      com.partnersoft.data.Naming<java.lang.Object> data)
                      throws java.io.IOException,
                             java.sql.SQLException
Throws:
java.io.IOException
java.sql.SQLException

updateInspection

void updateInspection(java.lang.String guid,
                      java.lang.Object... data)
                      throws java.io.IOException,
                             java.sql.SQLException
Throws:
java.io.IOException
java.sql.SQLException

getInspectionTableName

java.lang.String getInspectionTableName()

getSyncTableName

java.lang.String getSyncTableName()

getBlobTableName

java.lang.String getBlobTableName()

getFieldTableName

java.lang.String getFieldTableName()

getPicklistTableName

java.lang.String getPicklistTableName()

getPublishingTableName

java.lang.String getPublishingTableName()