macaw.persistenceLayer
Class ChangeEventGenerator

java.lang.Object
  extended by macaw.persistenceLayer.ChangeEventGenerator

public class ChangeEventGenerator
extends java.lang.Object

A convenience class that generates collections of change event descriptions that are used by both the InMemory and SQL-based implementations of MacawCurationAPI. Early in development, implementations of the main API began to share common blocks of code, particularly for processing change events associated with "add", "delete", "associate" and "dissociate" operations. To record changes made in "update" operations, a different procedure was followed. Old and revised versions of a record were passed to the static method detectFieldChanges(...) that is supported in most of the macaw.model.* classes.


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)

Constructor Summary
ChangeEventGenerator()
           
 
Method Summary
static java.util.ArrayList<MacawChangeEvent> addOntologyTermChange(User user, OntologyTerm ontologyTerm)
          produce change events for operations which involve adding ontology terms to the database
static java.util.ArrayList<MacawChangeEvent> addSupportingDocumentChange(User user, SupportingDocument supportingDocument)
          produce change events for operations which involve adding support documents to the database
static java.util.ArrayList<MacawChangeEvent> addUserChange(User admin, User user)
          creates change event when a new user is added
static java.util.ArrayList<MacawChangeEvent> addValueLabelsChange(User user, Variable variable, java.util.ArrayList<ValueLabel> valueLabels)
          produce change events for operations which involve adding value labels to the database
static java.util.ArrayList<MacawChangeEvent> addVariableChange(User user, Variable variable)
          produce change events for operations which involve adding raw or derived variables to the database
static java.util.ArrayList<MacawChangeEvent> associateSourceVariablesChanges(User user, DerivedVariable derivedVariable, java.util.ArrayList<Variable> sourceVariablesToAdd)
          produce change events for operations which involve associating source variables with a derived variable
static java.util.ArrayList<MacawChangeEvent> associateSupportingDocumentChanges(User user, Variable variable, java.util.ArrayList<SupportingDocument> supportingDocumentsToAdd)
          produce change events for operations which involve associating supporting documents with a derived variable
static java.util.ArrayList<MacawChangeEvent> deleteOntologyTermsChange(User user, java.util.ArrayList<OntologyTerm> ontologyTerms)
          produce change events for operations which involve deleting ontology terms from the database
static java.util.ArrayList<MacawChangeEvent> deleteRawVariablesChanges(User user, java.util.ArrayList<RawVariable> rawVariables)
           
static java.util.ArrayList<MacawChangeEvent> deleteSupportingDocumentsChange(User user, java.util.ArrayList<SupportingDocument> supportingDocumentsToDelete)
          produce change events for operations which involve deleting support documents from the database
static java.util.ArrayList<MacawChangeEvent> deleteUsersChanges(User admin, java.util.ArrayList<User> usersToDelete)
          creates a collection of change events for users which are deleted
static java.util.ArrayList<MacawChangeEvent> deleteValueLabelsChange(User user, Variable variable, java.util.ArrayList<ValueLabel> valueLabels)
          produce change events for operations which involve deleting value labels from the database
static MacawChangeEvent deleteVariableChanges(User user, Variable variable)
          produce change events for operations which involve deleting raw or derived variables from the database
static java.util.ArrayList<MacawChangeEvent> disassociateSourceVariablesChanges(User user, DerivedVariable derivedVariable, java.util.ArrayList<Variable> sourceVariablesToDelete)
          produce change events for operations which involve disassociating source variables with a derived variable
static java.util.ArrayList<MacawChangeEvent> disassociateSupportingDocumentsChanges(User user, Variable variable, java.util.ArrayList<SupportingDocument> supportingDocumentsToDelete)
          produce change events for operations which involve disassociating supporting documents with a derived variable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChangeEventGenerator

public ChangeEventGenerator()
Method Detail

addSupportingDocumentChange

public static java.util.ArrayList<MacawChangeEvent> addSupportingDocumentChange(User user,
                                                                                SupportingDocument supportingDocument)
produce change events for operations which involve adding support documents to the database


deleteSupportingDocumentsChange

public static java.util.ArrayList<MacawChangeEvent> deleteSupportingDocumentsChange(User user,
                                                                                    java.util.ArrayList<SupportingDocument> supportingDocumentsToDelete)
produce change events for operations which involve deleting support documents from the database


addValueLabelsChange

public static java.util.ArrayList<MacawChangeEvent> addValueLabelsChange(User user,
                                                                         Variable variable,
                                                                         java.util.ArrayList<ValueLabel> valueLabels)
produce change events for operations which involve adding value labels to the database


deleteValueLabelsChange

public static java.util.ArrayList<MacawChangeEvent> deleteValueLabelsChange(User user,
                                                                            Variable variable,
                                                                            java.util.ArrayList<ValueLabel> valueLabels)
produce change events for operations which involve deleting value labels from the database


addOntologyTermChange

public static java.util.ArrayList<MacawChangeEvent> addOntologyTermChange(User user,
                                                                          OntologyTerm ontologyTerm)
produce change events for operations which involve adding ontology terms to the database


deleteOntologyTermsChange

public static java.util.ArrayList<MacawChangeEvent> deleteOntologyTermsChange(User user,
                                                                              java.util.ArrayList<OntologyTerm> ontologyTerms)
produce change events for operations which involve deleting ontology terms from the database


deleteVariableChanges

public static MacawChangeEvent deleteVariableChanges(User user,
                                                     Variable variable)
produce change events for operations which involve deleting raw or derived variables from the database


deleteRawVariablesChanges

public static java.util.ArrayList<MacawChangeEvent> deleteRawVariablesChanges(User user,
                                                                              java.util.ArrayList<RawVariable> rawVariables)

addVariableChange

public static java.util.ArrayList<MacawChangeEvent> addVariableChange(User user,
                                                                      Variable variable)
produce change events for operations which involve adding raw or derived variables to the database


associateSourceVariablesChanges

public static java.util.ArrayList<MacawChangeEvent> associateSourceVariablesChanges(User user,
                                                                                    DerivedVariable derivedVariable,
                                                                                    java.util.ArrayList<Variable> sourceVariablesToAdd)
produce change events for operations which involve associating source variables with a derived variable


disassociateSourceVariablesChanges

public static java.util.ArrayList<MacawChangeEvent> disassociateSourceVariablesChanges(User user,
                                                                                       DerivedVariable derivedVariable,
                                                                                       java.util.ArrayList<Variable> sourceVariablesToDelete)
produce change events for operations which involve disassociating source variables with a derived variable


associateSupportingDocumentChanges

public static java.util.ArrayList<MacawChangeEvent> associateSupportingDocumentChanges(User user,
                                                                                       Variable variable,
                                                                                       java.util.ArrayList<SupportingDocument> supportingDocumentsToAdd)
                                                                                throws MacawException
produce change events for operations which involve associating supporting documents with a derived variable

Throws:
MacawException

disassociateSupportingDocumentsChanges

public static java.util.ArrayList<MacawChangeEvent> disassociateSupportingDocumentsChanges(User user,
                                                                                           Variable variable,
                                                                                           java.util.ArrayList<SupportingDocument> supportingDocumentsToDelete)
produce change events for operations which involve disassociating supporting documents with a derived variable


addUserChange

public static java.util.ArrayList<MacawChangeEvent> addUserChange(User admin,
                                                                  User user)
                                                           throws MacawException
creates change event when a new user is added

Parameters:
admin -
user -
Throws:
MacawException

deleteUsersChanges

public static java.util.ArrayList<MacawChangeEvent> deleteUsersChanges(User admin,
                                                                       java.util.ArrayList<User> usersToDelete)
                                                                throws MacawException
creates a collection of change events for users which are deleted

Parameters:
admin -
usersToDelete -
Throws:
MacawException