cst.common.persistenceLayer
Class DemonstrationDB

java.lang.Object
  extended by cst.common.persistenceLayer.DemonstrationDB

public class DemonstrationDB
extends java.lang.Object

acts as an in-memory database and attempts to simulate peristent storage through the use cloning operations to support original and modified copies of records.


 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
protected  java.util.HashMap<java.lang.String,TrialSubjectModel> trialSubjectModelFromIdentifier
           
 
Constructor Summary
DemonstrationDB(SessionProperties sessionProperties)
           
DemonstrationDB(SessionProperties sessionProperties, int numberOfBlankRecords)
           
 
Method Summary
 void addTrialSubjectModel(TrialSubjectModel trialSubjectModel)
          add a trial subject model record.
 void clearChanges()
           
 void clearDatabase(User adminUser)
           
 void createDatabase(User adminUser)
           
 boolean databaseExists()
           
 void deleteDatabase(User adminUser)
           
 TrialSubjectModel getClonedTrialSubjectModel(java.lang.String subjectIdentifier)
           
 java.util.ArrayList<TrialSubjectModel> getClonedTrialSubjectModels()
           
 TrialSubjectModel getOriginalTrialSubjectModel(java.lang.String subjectIdentifier)
           
 TrialActivityChangeManager getTrialActivityChangesManager()
           
 java.util.HashMap<java.lang.String,TrialSubjectModel> getTrialSubjectModelFromIdentifierMap()
           
 boolean isValidActivityName(java.lang.String activityName)
           
 boolean isValidActivityStepName(java.lang.String activityName, java.lang.String activityStepName)
           
 boolean isValidCoreFieldName(java.lang.String coreFieldName)
           
 void populateDatabase()
           
 void replaceSubjectModel(TrialSubjectModel trialSubjectModel)
           
 boolean subjectModelExists(java.lang.String subjectIdentifier)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

trialSubjectModelFromIdentifier

protected java.util.HashMap<java.lang.String,TrialSubjectModel> trialSubjectModelFromIdentifier
Constructor Detail

DemonstrationDB

public DemonstrationDB(SessionProperties sessionProperties,
                       int numberOfBlankRecords)

DemonstrationDB

public DemonstrationDB(SessionProperties sessionProperties)
Method Detail

getTrialActivityChangesManager

public TrialActivityChangeManager getTrialActivityChangesManager()

getClonedTrialSubjectModel

public TrialSubjectModel getClonedTrialSubjectModel(java.lang.String subjectIdentifier)

getOriginalTrialSubjectModel

public TrialSubjectModel getOriginalTrialSubjectModel(java.lang.String subjectIdentifier)

subjectModelExists

public boolean subjectModelExists(java.lang.String subjectIdentifier)

isValidCoreFieldName

public boolean isValidCoreFieldName(java.lang.String coreFieldName)

isValidActivityName

public boolean isValidActivityName(java.lang.String activityName)

isValidActivityStepName

public boolean isValidActivityStepName(java.lang.String activityName,
                                       java.lang.String activityStepName)

getClonedTrialSubjectModels

public java.util.ArrayList<TrialSubjectModel> getClonedTrialSubjectModels()

getTrialSubjectModelFromIdentifierMap

public java.util.HashMap<java.lang.String,TrialSubjectModel> getTrialSubjectModelFromIdentifierMap()

addTrialSubjectModel

public void addTrialSubjectModel(TrialSubjectModel trialSubjectModel)
add a trial subject model record. If it already exists, replace it.

Parameters:
trialSubjectModel -

replaceSubjectModel

public void replaceSubjectModel(TrialSubjectModel trialSubjectModel)

createDatabase

public void createDatabase(User adminUser)
                    throws CSTException
Throws:
CSTException

clearDatabase

public void clearDatabase(User adminUser)
                   throws CSTException
Throws:
CSTException

clearChanges

public void clearChanges()
                  throws CSTException
Throws:
CSTException

deleteDatabase

public void deleteDatabase(User adminUser)
                    throws CSTException
Throws:
CSTException

databaseExists

public boolean databaseExists()
                       throws CSTException
Throws:
CSTException

populateDatabase

public void populateDatabase()