cst.loggingTool.persistenceLayer
Class ProductionLoggingToolQueries

java.lang.Object
  extended by cst.common.persistenceLayer.ProductionServiceDatabaseQueries
      extended by cst.loggingTool.persistenceLayer.ProductionLoggingToolQueries

public class ProductionLoggingToolQueries
extends ProductionServiceDatabaseQueries


 Copyright 2010 Medical Research Council Unit for Lifelong Health and Ageing
 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at
      http://www.apache.org/licenses/LICENSE-2.0
 Unless required by applicable law or agreed to in writing, software 
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.  
 

Version:
1.0
Author:
Kevin Garwood (kgarwood@users.sourceforge.net)

Field Summary
 
Fields inherited from class cst.common.persistenceLayer.ProductionServiceDatabaseQueries
activityChangesTableName, databaseName, log, sessionProperties, sqlDateFormat, subjectTableName, trialSubjectModelFactory, userTableName
 
Constructor Summary
ProductionLoggingToolQueries(SessionProperties sessionProperties, TrialSubjectModelFactory trialSubjectModelFactory, java.lang.String databaseName, java.lang.String subjectTableName, java.lang.String activityChangesTableName)
           
 
Method Summary
 java.util.ArrayList<java.lang.String> applyCoreFieldAndCompletionFilter(java.sql.Connection connection, SubjectAttributeFilterCommand coreFieldFilter, CompletionFilterCommand completionFilter)
           
 java.util.ArrayList<java.lang.String> applyCoreFieldAndDataTypeFilter(java.sql.Connection connection, SubjectAttributeFilterCommand coreFieldFilter, DateFilterCommand dataTypeFilter)
           
 java.util.ArrayList<java.lang.String> applyOnlyCompletionFilter(java.sql.Connection connection, CompletionFilterCommand completionFilter)
           
 java.util.ArrayList<java.lang.String> applyOnlyCoreFieldFilter(java.sql.Connection connection, SubjectAttributeFilterCommand coreFieldFilter)
           
 java.util.ArrayList<java.lang.String> applyOnlyDataTypeFilter(java.sql.Connection connection, DateFilterCommand dataTypeFilter)
           
 java.util.ArrayList<java.lang.String> applyShowAllFilter(java.sql.Connection connection)
           
 void checkTrialSubjectModelExists(java.sql.Connection connection, java.lang.String trialSubjectIdentifier)
           
 java.util.ArrayList<TrialActivityChange> getTrialActivityChangesForSubject(java.sql.Connection connection, java.lang.String trialSubjectIdentifier)
           
 java.util.ArrayList<TrialActivityChange> getTrialActivityChangesForUser(java.sql.Connection connection, java.lang.String userID)
           
 TrialActivityModel getTrialActivityModel(java.sql.Connection connection, java.lang.String trialSubjectIdentifier, java.lang.String trialActivityDataStorageName)
           
 java.util.ArrayList<TrialActivityModel> getTrialActivityModels(java.sql.Connection connection, java.lang.String trialActivityDataStorageName)
           
 TrialSubjectModel getTrialSubjectModel(java.sql.Connection connection, java.lang.String trialSubjectIdentifier)
           
 java.lang.String[] getValuesForCoreField(java.sql.Connection connection, java.lang.String coreFieldDataStorageName)
           
 int importTrialActivityData(java.sql.Connection connection, User user, java.lang.String trialActivityModelDataStorageName, java.util.ArrayList<TrialActivityModel> newTrialActivityModels, java.lang.String dataSourceName)
           
 void updateChangeHistory(java.sql.Connection connection, TrialActivityChange trialActivityChange)
           
 void updateTrialActivities(java.sql.Connection connection, java.lang.String activityDataStorageName, java.util.ArrayList<TrialActivityModel> trialActivityModels)
          updates trial activities.
 void updateTrialActivity(java.sql.Connection connection, TrialActivityModel trialActivityModel)
           
 void validateUser(java.sql.Connection connection, java.lang.String userTableName, User user)
           
 
Methods inherited from class cst.common.persistenceLayer.ProductionServiceDatabaseQueries
checkActivityStepExists, checkTrialActivityDataStorageNameExists, validateCoreFieldDataStorageName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProductionLoggingToolQueries

public ProductionLoggingToolQueries(SessionProperties sessionProperties,
                                    TrialSubjectModelFactory trialSubjectModelFactory,
                                    java.lang.String databaseName,
                                    java.lang.String subjectTableName,
                                    java.lang.String activityChangesTableName)
Method Detail

validateUser

public void validateUser(java.sql.Connection connection,
                         java.lang.String userTableName,
                         User user)
                  throws CSTException
Throws:
CSTException

getValuesForCoreField

public java.lang.String[] getValuesForCoreField(java.sql.Connection connection,
                                                java.lang.String coreFieldDataStorageName)
                                         throws CSTException
Throws:
CSTException

getTrialSubjectModel

public TrialSubjectModel getTrialSubjectModel(java.sql.Connection connection,
                                              java.lang.String trialSubjectIdentifier)
                                       throws CSTException
Throws:
CSTException

getTrialActivityModel

public TrialActivityModel getTrialActivityModel(java.sql.Connection connection,
                                                java.lang.String trialSubjectIdentifier,
                                                java.lang.String trialActivityDataStorageName)
                                         throws CSTException
Throws:
CSTException

importTrialActivityData

public int importTrialActivityData(java.sql.Connection connection,
                                   User user,
                                   java.lang.String trialActivityModelDataStorageName,
                                   java.util.ArrayList<TrialActivityModel> newTrialActivityModels,
                                   java.lang.String dataSourceName)
                            throws CSTException
Throws:
CSTException

updateTrialActivity

public void updateTrialActivity(java.sql.Connection connection,
                                TrialActivityModel trialActivityModel)
                         throws CSTException
Throws:
CSTException

getTrialActivityChangesForSubject

public java.util.ArrayList<TrialActivityChange> getTrialActivityChangesForSubject(java.sql.Connection connection,
                                                                                  java.lang.String trialSubjectIdentifier)
                                                                           throws CSTException
Throws:
CSTException

getTrialActivityChangesForUser

public java.util.ArrayList<TrialActivityChange> getTrialActivityChangesForUser(java.sql.Connection connection,
                                                                               java.lang.String userID)
                                                                        throws CSTException
Throws:
CSTException

updateChangeHistory

public void updateChangeHistory(java.sql.Connection connection,
                                TrialActivityChange trialActivityChange)
                         throws CSTException
Throws:
CSTException

applyShowAllFilter

public java.util.ArrayList<java.lang.String> applyShowAllFilter(java.sql.Connection connection)
                                                         throws CSTException
Throws:
CSTException

applyOnlyCompletionFilter

public java.util.ArrayList<java.lang.String> applyOnlyCompletionFilter(java.sql.Connection connection,
                                                                       CompletionFilterCommand completionFilter)
                                                                throws CSTException
Throws:
CSTException

applyOnlyCoreFieldFilter

public java.util.ArrayList<java.lang.String> applyOnlyCoreFieldFilter(java.sql.Connection connection,
                                                                      SubjectAttributeFilterCommand coreFieldFilter)
                                                               throws CSTException
Throws:
CSTException

applyOnlyDataTypeFilter

public java.util.ArrayList<java.lang.String> applyOnlyDataTypeFilter(java.sql.Connection connection,
                                                                     DateFilterCommand dataTypeFilter)
                                                              throws CSTException
Throws:
CSTException

applyCoreFieldAndDataTypeFilter

public java.util.ArrayList<java.lang.String> applyCoreFieldAndDataTypeFilter(java.sql.Connection connection,
                                                                             SubjectAttributeFilterCommand coreFieldFilter,
                                                                             DateFilterCommand dataTypeFilter)
                                                                      throws CSTException
Throws:
CSTException

applyCoreFieldAndCompletionFilter

public java.util.ArrayList<java.lang.String> applyCoreFieldAndCompletionFilter(java.sql.Connection connection,
                                                                               SubjectAttributeFilterCommand coreFieldFilter,
                                                                               CompletionFilterCommand completionFilter)
                                                                        throws CSTException
Throws:
CSTException

getTrialActivityModels

public java.util.ArrayList<TrialActivityModel> getTrialActivityModels(java.sql.Connection connection,
                                                                      java.lang.String trialActivityDataStorageName)
                                                               throws CSTException
Throws:
CSTException

updateTrialActivities

public void updateTrialActivities(java.sql.Connection connection,
                                  java.lang.String activityDataStorageName,
                                  java.util.ArrayList<TrialActivityModel> trialActivityModels)
                           throws java.sql.SQLException
updates trial activities. Note that it only updates fields in the database where the corresponding fields in the trialActivityModels is not null.

Parameters:
connection -
activityDataStorageName -
trialActivityModels -
Throws:
java.sql.SQLException

checkTrialSubjectModelExists

public void checkTrialSubjectModelExists(java.sql.Connection connection,
                                         java.lang.String trialSubjectIdentifier)
                                  throws CSTException
Throws:
CSTException