macaw.businessLayer
Class Variable

java.lang.Object
  extended by macaw.businessLayer.Variable
All Implemented Interfaces:
java.lang.Cloneable, Displayable
Direct Known Subclasses:
DerivedVariable, RawVariable

public abstract class Variable
extends java.lang.Object
implements java.lang.Cloneable, Displayable

A concept related to the NSHD study.


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.lang.String codeBookNumber
           
protected  java.lang.String columnEnd
           
protected  java.lang.String columnStart
           
protected  java.lang.String form
           
protected  java.lang.String notes
           
protected  java.lang.String questionNumber
           
 
Constructor Summary
Variable()
           
 
Method Summary
 void addOntologyTerm(OntologyTerm ontologyTerm)
           
 void addOntologyTerms(java.util.ArrayList<OntologyTerm> ontologyTermsToAdd)
           
 void addSupportingDocument(SupportingDocument supportingDocument)
           
 void addSupportingDocuments(java.util.ArrayList<SupportingDocument> supportingDocumentsToAdd)
           
 void addValueLabel(ValueLabel valueLabel)
           
abstract  java.lang.Object clone()
           
protected  void cloneAttributes(Variable cloneVariable)
           
 boolean containsOntologyTerm(OntologyTerm targetOntologyTerm)
           
 boolean containsSupportingDocument(SupportingDocument targetSupportingDocument)
           
 VariableSummary createVariableSummary()
          produces a variable summary suitable for showing in a collection of search results.
static MacawChangeEvent detectChangesInAlternativeVariable(User user, Variable originalVariable, Variable revisedAlternativeVariable)
           
static java.util.ArrayList<MacawChangeEvent> detectFieldChanges(User user, Variable originalVariable, Variable revisedVariable)
           
 java.lang.String getAlias()
           
 Variable getAlternativeVariable()
           
 java.lang.String getAvailability()
           
 java.lang.String getCategory()
           
 java.lang.String getCleaningDescription()
          free text description of how the variable data were cleaned.
 java.lang.String getCleaningStatus()
           
 java.lang.String getCodeBookNumber()
           
 java.lang.String getColumnEnd()
          ending column in library file for this variable
 java.lang.String getColumnStart()
          starting column in library file for this variable
 java.lang.String getDisplayItemIdentifier()
           
 java.lang.String getDisplayName()
           
 java.lang.String getFilePath()
           
 java.lang.String getForm()
          questionnaire form containing the question whose response is stored in the variable
 int getIdentifier()
          an integer which uniquely identifies an instance in the database.
 java.lang.String getLabel()
          a one-line description of the variable
 java.lang.String getName()
          variable name, as specified using the NSHD variable naming convention
 java.lang.String getNotes()
           
 java.util.ArrayList<OntologyTerm> getOntologyTerms()
           
 java.lang.String getQuestionNumber()
          question number from the questionnaire for this variable
 java.util.ArrayList<SupportingDocument> getSupportingDocuments()
           
 java.util.ArrayList<ValueLabel> getValueLabels()
           
 java.lang.String getYear()
          sweep in which the variable was collected
 boolean isCleaned()
          flag for whether the variable has been cleaned in some way
 boolean isCoded()
          flag for whether the variable has been coded electronically (or not)
 boolean isNewRecord()
           
 void removeOntologyTerm(OntologyTerm copyOfOntologyTermToDelete)
           
 void removeOntologyTerms(java.util.ArrayList<OntologyTerm> ontologyTermsToDelete)
           
 void removeSupportingDocument(SupportingDocument supportingDocument)
           
 void removeSupportingDocuments(java.util.ArrayList<SupportingDocument> supportingDocumentsToDelete)
           
 void removeValueLabel(ValueLabel valueLabel)
           
 void setAlias(java.lang.String alias)
           
 void setAlternativeVariable(Variable alterativeVariable)
           
 void setAvailability(java.lang.String availability)
           
 void setCategory(java.lang.String category)
           
 void setCleaned(boolean isCleaned)
           
 void setCleaningDescription(java.lang.String cleaningDescription)
           
 void setCleaningStatus(java.lang.String cleaningStatus)
           
 void setCodeBookNumber(java.lang.String codeBookNumber)
          reference to the physical code book entry
 void setCoded(boolean isCoded)
           
 void setColumnEnd(java.lang.String columnEnd)
           
 void setColumnStart(java.lang.String columnStart)
           
 void setFilePath(java.lang.String filePath)
           
 void setForm(java.lang.String form)
           
 void setIdentifier(int identifier)
           
 void setIsNewRecord(boolean isNewRecord)
           
 void setLabel(java.lang.String label)
           
 void setName(java.lang.String name)
           
 void setNotes(java.lang.String notes)
           
 void setOntologyTerms(java.util.ArrayList<OntologyTerm> ontologyTerms)
           
 void setQuestionNumber(java.lang.String questionNumber)
           
 void setSupportingDocuments(java.util.ArrayList<SupportingDocument> supportingDocuments)
           
 void setValueLabels(java.util.ArrayList<ValueLabel> valueLabels)
           
 void setYear(java.lang.String year)
           
 void updateOntologyTerm(OntologyTerm revisedOntologyTerm)
           
protected static java.util.ArrayList<java.lang.String> validateFields(Variable variable)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

form

protected java.lang.String form

questionNumber

protected java.lang.String questionNumber

codeBookNumber

protected java.lang.String codeBookNumber

columnStart

protected java.lang.String columnStart

columnEnd

protected java.lang.String columnEnd

notes

protected java.lang.String notes
Constructor Detail

Variable

public Variable()
Method Detail

createVariableSummary

public VariableSummary createVariableSummary()
produces a variable summary suitable for showing in a collection of search results.


getIdentifier

public int getIdentifier()
an integer which uniquely identifies an instance in the database. All primary key values in the database use a single auto-incremented auto-generated value.

Returns:
the identifier

setIdentifier

public void setIdentifier(int identifier)
Parameters:
identifier - the identifier to set

getName

public java.lang.String getName()
variable name, as specified using the NSHD variable naming convention

Returns:
the name

setName

public void setName(java.lang.String name)
Parameters:
name - the name to set

getLabel

public java.lang.String getLabel()
a one-line description of the variable

Returns:
the label

setLabel

public void setLabel(java.lang.String label)
Parameters:
label - the label to set

getYear

public java.lang.String getYear()
sweep in which the variable was collected

Returns:
the year

setYear

public void setYear(java.lang.String year)
Parameters:
year - the year to set

getCategory

public java.lang.String getCategory()
Returns:
the category

setCategory

public void setCategory(java.lang.String category)
Parameters:
category - the category to set

isCleaned

public boolean isCleaned()
flag for whether the variable has been cleaned in some way

Returns:
the isCleaned

setCleaned

public void setCleaned(boolean isCleaned)
Parameters:
isCleaned - the isCleaned to set

getCleaningStatus

public java.lang.String getCleaningStatus()
Returns:
the cleaningStatus

setCleaningStatus

public void setCleaningStatus(java.lang.String cleaningStatus)
Parameters:
cleaningStatus - the cleaningStatus to set

getCleaningDescription

public java.lang.String getCleaningDescription()
free text description of how the variable data were cleaned.

Returns:
the cleaningDescription

setCleaningDescription

public void setCleaningDescription(java.lang.String cleaningDescription)
Parameters:
cleaningDescription - the cleaningDescription to set

getValueLabels

public java.util.ArrayList<ValueLabel> getValueLabels()

setValueLabels

public void setValueLabels(java.util.ArrayList<ValueLabel> valueLabels)

addValueLabel

public void addValueLabel(ValueLabel valueLabel)

removeValueLabel

public void removeValueLabel(ValueLabel valueLabel)

getSupportingDocuments

public java.util.ArrayList<SupportingDocument> getSupportingDocuments()

containsSupportingDocument

public boolean containsSupportingDocument(SupportingDocument targetSupportingDocument)

setSupportingDocuments

public void setSupportingDocuments(java.util.ArrayList<SupportingDocument> supportingDocuments)

addSupportingDocuments

public void addSupportingDocuments(java.util.ArrayList<SupportingDocument> supportingDocumentsToAdd)

addSupportingDocument

public void addSupportingDocument(SupportingDocument supportingDocument)

removeSupportingDocument

public void removeSupportingDocument(SupportingDocument supportingDocument)

removeSupportingDocuments

public void removeSupportingDocuments(java.util.ArrayList<SupportingDocument> supportingDocumentsToDelete)

getOntologyTerms

public java.util.ArrayList<OntologyTerm> getOntologyTerms()

containsOntologyTerm

public boolean containsOntologyTerm(OntologyTerm targetOntologyTerm)

setOntologyTerms

public void setOntologyTerms(java.util.ArrayList<OntologyTerm> ontologyTerms)

addOntologyTerms

public void addOntologyTerms(java.util.ArrayList<OntologyTerm> ontologyTermsToAdd)

addOntologyTerm

public void addOntologyTerm(OntologyTerm ontologyTerm)

removeOntologyTerm

public void removeOntologyTerm(OntologyTerm copyOfOntologyTermToDelete)

removeOntologyTerms

public void removeOntologyTerms(java.util.ArrayList<OntologyTerm> ontologyTermsToDelete)

updateOntologyTerm

public void updateOntologyTerm(OntologyTerm revisedOntologyTerm)

getAvailability

public java.lang.String getAvailability()
Returns:
the availability

setAvailability

public void setAvailability(java.lang.String availability)
Parameters:
availability - the availability to set

getCodeBookNumber

public java.lang.String getCodeBookNumber()
Returns:
the codeBookNumber

setCodeBookNumber

public void setCodeBookNumber(java.lang.String codeBookNumber)
reference to the physical code book entry

Parameters:
codeBookNumber - the codeBookNumber to set

getColumnStart

public java.lang.String getColumnStart()
starting column in library file for this variable

Returns:
the columnStart

setColumnStart

public void setColumnStart(java.lang.String columnStart)
Parameters:
columnStart - the columnStart to set

getColumnEnd

public java.lang.String getColumnEnd()
ending column in library file for this variable

Returns:
the columnEnd

setColumnEnd

public void setColumnEnd(java.lang.String columnEnd)
Parameters:
columnEnd - the columnEnd to set

getAlias

public java.lang.String getAlias()
Returns:
the alias

setAlias

public void setAlias(java.lang.String alias)
Parameters:
alias - the alias to set

getFilePath

public java.lang.String getFilePath()
Returns:
the file Name

setFilePath

public void setFilePath(java.lang.String filePath)
Parameters:
filePath - the dataLibraryFileName to set

isCoded

public boolean isCoded()
flag for whether the variable has been coded electronically (or not)

Returns:
the isCoded

setCoded

public void setCoded(boolean isCoded)
Parameters:
isCoded - the isCoded to set

isNewRecord

public boolean isNewRecord()

setIsNewRecord

public void setIsNewRecord(boolean isNewRecord)

getForm

public java.lang.String getForm()
questionnaire form containing the question whose response is stored in the variable

Returns:
the form

setForm

public void setForm(java.lang.String form)
Parameters:
form - the form to set

getQuestionNumber

public java.lang.String getQuestionNumber()
question number from the questionnaire for this variable

Returns:
the questionNumber

setQuestionNumber

public void setQuestionNumber(java.lang.String questionNumber)
Parameters:
questionNumber - the questionNumber to set

getNotes

public java.lang.String getNotes()

setNotes

public void setNotes(java.lang.String notes)

getAlternativeVariable

public Variable getAlternativeVariable()

setAlternativeVariable

public void setAlternativeVariable(Variable alterativeVariable)

validateFields

protected static java.util.ArrayList<java.lang.String> validateFields(Variable variable)

detectFieldChanges

public static java.util.ArrayList<MacawChangeEvent> detectFieldChanges(User user,
                                                                       Variable originalVariable,
                                                                       Variable revisedVariable)

detectChangesInAlternativeVariable

public static MacawChangeEvent detectChangesInAlternativeVariable(User user,
                                                                  Variable originalVariable,
                                                                  Variable revisedAlternativeVariable)

getDisplayName

public java.lang.String getDisplayName()
Specified by:
getDisplayName in interface Displayable

getDisplayItemIdentifier

public java.lang.String getDisplayItemIdentifier()
Specified by:
getDisplayItemIdentifier in interface Displayable

clone

public abstract java.lang.Object clone()
Overrides:
clone in class java.lang.Object

cloneAttributes

protected void cloneAttributes(Variable cloneVariable)