macaw.persistenceLayer.demo
Class InMemoryVariableManager

java.lang.Object
  extended by macaw.persistenceLayer.demo.InMemoryCurationConceptManager
      extended by macaw.persistenceLayer.demo.InMemoryVariableManager

public class InMemoryVariableManager
extends InMemoryCurationConceptManager

manages instances of Variable in memory. It also supports adding and deleting associations between a Variable and:

In the Macaw data entry forms, users add or remove associations through list management buttons. Other variable associations are less obvious. Each variable is also associated with:

In the Macaw forms, these items are shown to users in a drop down list. Items in this list can be edited through separate data entry forms (see CategoryStateEditor,CleaningStateEditor, AvailabilityStateEditor, AliasFilePath.


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.InMemoryCurationConceptManager
log
 
Constructor Summary
InMemoryVariableManager(InMemoryChangeEventManager changeEventManager, InMemoryListChoiceManager listChoiceManager, InMemoryOntologyTermManager ontologyTermManager, InMemorySupportingDocumentsManager supportingDocumentsManager)
           
 
Method Summary
 void addDerivedVariable(User user, DerivedVariable derivedVariable)
           
 void addRawVariable(User user, RawVariable rawVariable)
           
 void addVariable(User user, Variable variable)
           
 void associateOntologyTerms(User user, Variable variable, java.util.ArrayList<OntologyTerm> ontologyTermsToAssociate)
           
 void associateSourceVariables(User user, DerivedVariable derivedVariable, java.util.ArrayList<Variable> sourceVariablesToAdd)
           
 void associateSupportingDocuments(User user, Variable variable, java.util.ArrayList<SupportingDocument> supportingDocumentsToAdd)
           
 void checkVariableExists(Variable variable)
           
 void clear()
           
 void deleteDerivedVariables(User user, java.util.ArrayList<DerivedVariable> derivedVariablesToDelete)
           
 void deleteOntologyTermReferences(java.util.ArrayList<OntologyTerm> targetOntologyTerms)
           
 void deleteRawVariables(User user, java.util.ArrayList<RawVariable> rawVariablesToDelete)
           
 void disassociateOntologyTerms(User user, Variable variable, java.util.ArrayList<OntologyTerm> ontologyTermsToDisassociate)
           
 void disassociateSourceVariables(User user, DerivedVariable derivedVariable, java.util.ArrayList<Variable> sourceVariablesToDelete)
           
 void disassociateSupportingDocuments(User user, Variable variable, java.util.ArrayList<SupportingDocument> supportingDocumentsToDelete)
           
 Variable getAlternativeVariable(Variable targetVariable)
           
 java.util.ArrayList<OntologyTerm> getAssociatedOntologyTerms(User user, Variable variable)
          public Variable getVariable(User user, String variableName) throws MacawException { if (variableName == null) { return null; } for (Variable variable : variables) { if (variable.getName().equals(variableName) == true) { return variable; } } return null; }
 java.util.ArrayList<Category> getCategoriesForVariable(User user, java.lang.String variableName)
           
 Variable getCompleteVariableData(User user, VariableSummary variableSummary)
           
 int getDerivedVariableIdentifier(User user, DerivedVariable derivedVariable)
           
 Variable getOriginalVariable(Variable variable)
           
 java.util.ArrayList<Variable> getOriginalVariables(User user)
           
 int getRawVariableIdentifier(User user, RawVariable rawVariable)
           
 java.util.ArrayList<Variable> getSourceVariables(User user, DerivedVariable derivedVariable)
           
 java.lang.String[] getStudyYears(User user)
           
 java.util.ArrayList<VariableSummary> getSummaryDataForAllVariables(User user)
           
 java.util.ArrayList<SupportingDocument> getSupportingDocuments(User user, Variable variable)
           
 java.util.ArrayList<ValueLabel> getValueLabels(User user, Variable variable)
           
 Variable getVariable(User user, java.lang.String variableName)
           
 java.lang.String[] getVariableNames(User user)
           
 java.util.ArrayList<Variable> getVariables(User user)
           
 java.util.ArrayList<VariableSummary> getVariableSummariesForCategory(User user, java.lang.String categoryName)
           
 void setAlternativeVariable(User user, Variable targetVariable, Variable updatedAlternativeVariable)
           
 void updateDerivedVariable(User user, DerivedVariable revisedDerivedVariable)
           
 void updateOntologyTermReferences(OntologyTerm targetOntologyTerm)
           
 void updateRawVariable(User user, RawVariable revisedRawVariable)
           
 
Methods inherited from class macaw.persistenceLayer.demo.InMemoryCurationConceptManager
registerChangeEvent, registerChangeEvents, setLog
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InMemoryVariableManager

public InMemoryVariableManager(InMemoryChangeEventManager changeEventManager,
                               InMemoryListChoiceManager listChoiceManager,
                               InMemoryOntologyTermManager ontologyTermManager,
                               InMemorySupportingDocumentsManager supportingDocumentsManager)
Method Detail

getOriginalVariables

public java.util.ArrayList<Variable> getOriginalVariables(User user)
                                                   throws MacawException
Throws:
MacawException

getVariables

public java.util.ArrayList<Variable> getVariables(User user)
                                           throws MacawException
Throws:
MacawException

addRawVariable

public void addRawVariable(User user,
                           RawVariable rawVariable)
                    throws MacawException
Throws:
MacawException

addDerivedVariable

public void addDerivedVariable(User user,
                               DerivedVariable derivedVariable)
                        throws MacawException
Throws:
MacawException

addVariable

public void addVariable(User user,
                        Variable variable)
                 throws MacawException
Throws:
MacawException

updateRawVariable

public void updateRawVariable(User user,
                              RawVariable revisedRawVariable)
                       throws MacawException
Throws:
MacawException

deleteRawVariables

public void deleteRawVariables(User user,
                               java.util.ArrayList<RawVariable> rawVariablesToDelete)
                        throws MacawException
Throws:
MacawException

updateDerivedVariable

public void updateDerivedVariable(User user,
                                  DerivedVariable revisedDerivedVariable)
                           throws MacawException
Throws:
MacawException

deleteDerivedVariables

public void deleteDerivedVariables(User user,
                                   java.util.ArrayList<DerivedVariable> derivedVariablesToDelete)
                            throws MacawException
Throws:
MacawException

getSummaryDataForAllVariables

public java.util.ArrayList<VariableSummary> getSummaryDataForAllVariables(User user)
                                                                   throws MacawException
Throws:
MacawException

getCompleteVariableData

public Variable getCompleteVariableData(User user,
                                        VariableSummary variableSummary)
                                 throws MacawException
Throws:
MacawException

getAssociatedOntologyTerms

public java.util.ArrayList<OntologyTerm> getAssociatedOntologyTerms(User user,
                                                                    Variable variable)
                                                             throws MacawException
public Variable getVariable(User user, String variableName) throws MacawException { if (variableName == null) { return null; } for (Variable variable : variables) { if (variable.getName().equals(variableName) == true) { return variable; } } return null; }

Throws:
MacawException

associateOntologyTerms

public void associateOntologyTerms(User user,
                                   Variable variable,
                                   java.util.ArrayList<OntologyTerm> ontologyTermsToAssociate)
                            throws MacawException
Throws:
MacawException

disassociateOntologyTerms

public void disassociateOntologyTerms(User user,
                                      Variable variable,
                                      java.util.ArrayList<OntologyTerm> ontologyTermsToDisassociate)
                               throws MacawException
Throws:
MacawException

getSourceVariables

public java.util.ArrayList<Variable> getSourceVariables(User user,
                                                        DerivedVariable derivedVariable)
                                                 throws MacawException
Throws:
MacawException

associateSourceVariables

public void associateSourceVariables(User user,
                                     DerivedVariable derivedVariable,
                                     java.util.ArrayList<Variable> sourceVariablesToAdd)
                              throws MacawException
Throws:
MacawException

disassociateSourceVariables

public void disassociateSourceVariables(User user,
                                        DerivedVariable derivedVariable,
                                        java.util.ArrayList<Variable> sourceVariablesToDelete)
                                 throws MacawException
Throws:
MacawException

getOriginalVariable

public Variable getOriginalVariable(Variable variable)

getVariable

public Variable getVariable(User user,
                            java.lang.String variableName)
                     throws MacawException
Throws:
MacawException

getVariableSummariesForCategory

public java.util.ArrayList<VariableSummary> getVariableSummariesForCategory(User user,
                                                                            java.lang.String categoryName)
                                                                     throws MacawException
Throws:
MacawException

getStudyYears

public java.lang.String[] getStudyYears(User user)
                                 throws MacawException
Throws:
MacawException

getVariableNames

public java.lang.String[] getVariableNames(User user)
                                    throws MacawException
Throws:
MacawException

getCategoriesForVariable

public java.util.ArrayList<Category> getCategoriesForVariable(User user,
                                                              java.lang.String variableName)
                                                       throws MacawException
Throws:
MacawException

getSupportingDocuments

public java.util.ArrayList<SupportingDocument> getSupportingDocuments(User user,
                                                                      Variable variable)
                                                               throws MacawException
Throws:
MacawException

associateSupportingDocuments

public void associateSupportingDocuments(User user,
                                         Variable variable,
                                         java.util.ArrayList<SupportingDocument> supportingDocumentsToAdd)
                                  throws MacawException
Throws:
MacawException

disassociateSupportingDocuments

public void disassociateSupportingDocuments(User user,
                                            Variable variable,
                                            java.util.ArrayList<SupportingDocument> supportingDocumentsToDelete)
                                     throws MacawException
Throws:
MacawException

getValueLabels

public java.util.ArrayList<ValueLabel> getValueLabels(User user,
                                                      Variable variable)
                                               throws MacawException
Throws:
MacawException

updateOntologyTermReferences

public void updateOntologyTermReferences(OntologyTerm targetOntologyTerm)

deleteOntologyTermReferences

public void deleteOntologyTermReferences(java.util.ArrayList<OntologyTerm> targetOntologyTerms)

getRawVariableIdentifier

public int getRawVariableIdentifier(User user,
                                    RawVariable rawVariable)
                             throws MacawException
Throws:
MacawException

getDerivedVariableIdentifier

public int getDerivedVariableIdentifier(User user,
                                        DerivedVariable derivedVariable)
                                 throws MacawException
Throws:
MacawException

clear

public void clear()

getAlternativeVariable

public Variable getAlternativeVariable(Variable targetVariable)
                                throws MacawException
Throws:
MacawException

setAlternativeVariable

public void setAlternativeVariable(User user,
                                   Variable targetVariable,
                                   Variable updatedAlternativeVariable)
                            throws MacawException
Throws:
MacawException

checkVariableExists

public void checkVariableExists(Variable variable)
                         throws MacawException
Throws:
MacawException