macaw.persistenceLayer.demo
Class DemonstrationRetrievalService

java.lang.Object
  extended by macaw.persistenceLayer.demo.DemonstrationCurationService
      extended by macaw.persistenceLayer.demo.DemonstrationRetrievalService
All Implemented Interfaces:
MacawCurationAPI, MacawRetrievalAPI

public class DemonstrationRetrievalService
extends DemonstrationCurationService
implements MacawRetrievalAPI

Implements the MacawRetrievalAPI interface as a service which retrieves all of its data from in-memory objects rather than from a database. This class allows Macaw to run in a demonstration mode off a pen drive without requiring the client machine to have MySQL installed. DemonstrationRetrievalService delegates the implementations of MacawRetrievalAPI methods to manager classes whose names are prefixed with "InMemory" (eg: InMemoryVariableManager). The main duties of this class are

  1. validate users before the methods are allowed to proceed
  2. log any exceptions that are thrown.

For security reasons, exceptions are caught rather than thrown to the calling class.


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 macaw.persistenceLayer.demo.DemonstrationCurationService
admin, changeEventManager, listChoiceManager, log, ontologyTermFilter, ontologyTermManager, securityValidationService, supportingDocumentFilter, supportingDocumentsManager, userManager, valueLabelManager, variableFilter, variableManager
 
Constructor Summary
DemonstrationRetrievalService(SessionProperties sessionProperties)
           
DemonstrationRetrievalService(SessionProperties sessionProperties, boolean automatedTestingMode)
           
 
Method Summary
 AliasFilePath getAliasFilePath(User user, java.lang.String cardNumber)
          given the name of a logical location for data, returns an AliasFilePath object that can also describe the physical location.
 java.util.ArrayList<AliasFilePath> getAliasFilePaths(User user)
          Methods for data libraries
 java.util.ArrayList<AliasFilePath> getAliasFilePathsMatchingName(User user, java.lang.String regularExpression)
          Searches for all alias file paths whose logical location names contain a phrase.
 java.util.ArrayList<AvailabilityState> getAvailabilityStates(User user)
          Methods for managing availability states
 java.util.ArrayList<Category> getCategories(User user)
           
 java.util.ArrayList<Category> getCategoriesForVariable(User user, java.lang.String variableName)
           
 java.util.ArrayList<CleaningState> getCleaningStates(User user)
          Methods for managing cleaning states
 java.util.ArrayList<OntologyTerm> getOntologyTerms(User user, java.lang.String variableName)
          return the ontology terms for a given variable
 java.util.ArrayList<SupportingDocument> getSupportingDocuments(User user, java.lang.String variableName)
          returns the supporting documents for a given variable
 java.util.ArrayList<User> getUnverifiedUsers(User admin)
           
 User getUserFromEmail(User user, java.lang.String email)
           
 User getUserFromID(User user, java.lang.String userID)
           
 java.util.ArrayList<User> getUsers(User user)
           
 java.util.ArrayList<ValueLabel> getValueLabels(User user, java.lang.String variableName)
          returns the value labels associated with a given variable
 Variable getVariable(User user, java.lang.String variableName)
          returns a variable record given a variable name
 java.lang.String[] getVariableNames(User user)
          returns an alphabetically sorted list of all the variable names in the data repository
 java.util.ArrayList<VariableSummary> getVariableSummariesForCategory(User user, java.lang.String categoryName)
          returns summary records of variables that are associated with a given category.
 
Methods inherited from class macaw.persistenceLayer.demo.DemonstrationCurationService
addAliasFilePath, addAvailabilityState, addCategory, addChangeEvents, addCleaningState, addDerivedVariable, addOntologyTerm, addRawVariable, addSupportingDocument, addUser, addValueLabels, associateOntologyTermsWithVariable, associateSourceVariables, associateSupportingDocumentsWithVariable, checkValidAdministrator, checkValidUser, clear, clearAllChanges, deleteAliasFilePaths, deleteAvailabilityStates, deleteCategories, deleteCleaningStates, deleteDerivedVariables, deleteOntologyTerms, deleteRawVariables, deleteSupportingDocuments, deleteUsers, deleteValueLabels, disassociateOntologyTermsFromVariable, disassociateSourceVariables, disassociateSupportingDocumentsFromVariable, filterOntologyTerms, filterSupportingDocuments, filterVariableSummaries, getAliasFilePathIdentifier, getAllChanges, getAllOntologyTerms, getAllSupportingDocuments, getAlternativeVariable, getAvailabilityStateIdentifier, getCategoryIdentifier, getChangeHistoryByUser, getChangeHistoryForListChoices, getChangeHistoryForSupportingDocument, getChangeHistoryForValueLabels, getChangeHistoryForVariable, getCleaningStateIdentifier, getCompleteVariableData, getDerivedVariableIdentifier, getFilePathFromAlias, getOntologyTermIdentifier, getOntologyTerms, getOriginalVariable, getRawVariableIdentifier, getSourceVariables, getStudyYears, getSummaryDataForAllVariables, getSupportingDocumentIdentifier, getSupportingDocuments, getUserIdentifier, getValueLabelIdentifier, getValueLabels, setAlternativeVariable, updateAliasFilePath, updateAvailabilityState, updateCategory, updateCleaningState, updateDerivedVariable, updateOntologyTerm, updateRawVariable, updateSupportingDocument, updateUser, updateValueLabels
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DemonstrationRetrievalService

public DemonstrationRetrievalService(SessionProperties sessionProperties)
                              throws MacawException
Throws:
MacawException

DemonstrationRetrievalService

public DemonstrationRetrievalService(SessionProperties sessionProperties,
                                     boolean automatedTestingMode)
                              throws MacawException
Throws:
MacawException
Method Detail

getUserFromID

public User getUserFromID(User user,
                          java.lang.String userID)
Specified by:
getUserFromID in interface MacawRetrievalAPI

getUnverifiedUsers

public java.util.ArrayList<User> getUnverifiedUsers(User admin)
Specified by:
getUnverifiedUsers in interface MacawRetrievalAPI

getUserFromEmail

public User getUserFromEmail(User user,
                             java.lang.String email)
Specified by:
getUserFromEmail in interface MacawRetrievalAPI

getAliasFilePath

public AliasFilePath getAliasFilePath(User user,
                                      java.lang.String cardNumber)
Description copied from interface: MacawRetrievalAPI
given the name of a logical location for data, returns an AliasFilePath object that can also describe the physical location.

Specified by:
getAliasFilePath in interface MacawRetrievalAPI
Parameters:
user - - registered user who is using the retrieval service

getAliasFilePathsMatchingName

public java.util.ArrayList<AliasFilePath> getAliasFilePathsMatchingName(User user,
                                                                        java.lang.String regularExpression)
Description copied from interface: MacawRetrievalAPI
Searches for all alias file paths whose logical location names contain a phrase. Note that this search filter does not support regular expression symbols.

Specified by:
getAliasFilePathsMatchingName in interface MacawRetrievalAPI
Parameters:
user - - registered user who is using the retrieval service
regularExpression - - a search phrase that represents part of the name for a logical location in an alias file path.

getCategoriesForVariable

public java.util.ArrayList<Category> getCategoriesForVariable(User user,
                                                              java.lang.String variableName)
Specified by:
getCategoriesForVariable in interface MacawRetrievalAPI

getVariableSummariesForCategory

public java.util.ArrayList<VariableSummary> getVariableSummariesForCategory(User user,
                                                                            java.lang.String categoryName)
Description copied from interface: MacawRetrievalAPI
returns summary records of variables that are associated with a given category.

Specified by:
getVariableSummariesForCategory in interface MacawRetrievalAPI

getVariableNames

public java.lang.String[] getVariableNames(User user)
Description copied from interface: MacawRetrievalAPI
returns an alphabetically sorted list of all the variable names in the data repository

Specified by:
getVariableNames in interface MacawRetrievalAPI

getValueLabels

public java.util.ArrayList<ValueLabel> getValueLabels(User user,
                                                      java.lang.String variableName)
Description copied from interface: MacawRetrievalAPI
returns the value labels associated with a given variable

Specified by:
getValueLabels in interface MacawRetrievalAPI
Parameters:
user - registered user who is using the retrieval service
variableName - the name of a variable

getOntologyTerms

public java.util.ArrayList<OntologyTerm> getOntologyTerms(User user,
                                                          java.lang.String variableName)
Description copied from interface: MacawRetrievalAPI
return the ontology terms for a given variable

Specified by:
getOntologyTerms in interface MacawRetrievalAPI

getSupportingDocuments

public java.util.ArrayList<SupportingDocument> getSupportingDocuments(User user,
                                                                      java.lang.String variableName)
Description copied from interface: MacawRetrievalAPI
returns the supporting documents for a given variable

Specified by:
getSupportingDocuments in interface MacawRetrievalAPI

getAliasFilePaths

public java.util.ArrayList<AliasFilePath> getAliasFilePaths(User user)
Description copied from class: DemonstrationCurationService
Methods for data libraries

Specified by:
getAliasFilePaths in interface MacawCurationAPI
Specified by:
getAliasFilePaths in interface MacawRetrievalAPI
Overrides:
getAliasFilePaths in class DemonstrationCurationService
Parameters:
user - - registered user who is using the retrieval service

getCategories

public java.util.ArrayList<Category> getCategories(User user)
Specified by:
getCategories in interface MacawCurationAPI
Specified by:
getCategories in interface MacawRetrievalAPI
Overrides:
getCategories in class DemonstrationCurationService
Returns:
a collection of categories used to classify NSHD variables. eg: "General Health" and "Education".

getCleaningStates

public java.util.ArrayList<CleaningState> getCleaningStates(User user)
Description copied from class: DemonstrationCurationService
Methods for managing cleaning states

Specified by:
getCleaningStates in interface MacawCurationAPI
Specified by:
getCleaningStates in interface MacawRetrievalAPI
Overrides:
getCleaningStates in class DemonstrationCurationService

getAvailabilityStates

public java.util.ArrayList<AvailabilityState> getAvailabilityStates(User user)
Description copied from class: DemonstrationCurationService
Methods for managing availability states

Specified by:
getAvailabilityStates in interface MacawCurationAPI
Specified by:
getAvailabilityStates in interface MacawRetrievalAPI
Overrides:
getAvailabilityStates in class DemonstrationCurationService

getVariable

public Variable getVariable(User user,
                            java.lang.String variableName)
Description copied from interface: MacawRetrievalAPI
returns a variable record given a variable name

Specified by:
getVariable in interface MacawCurationAPI
Specified by:
getVariable in interface MacawRetrievalAPI
Overrides:
getVariable in class DemonstrationCurationService

getUsers

public java.util.ArrayList<User> getUsers(User user)
Specified by:
getUsers in interface MacawCurationAPI
Specified by:
getUsers in interface MacawRetrievalAPI
Overrides:
getUsers in class DemonstrationCurationService