org.openmrs.util.databasechange
Class GenerateUuid

java.lang.Object
  extended by org.openmrs.util.databasechange.GenerateUuid
All Implemented Interfaces:
liquibase.change.custom.CustomTaskChange

public class GenerateUuid
extends java.lang.Object
implements liquibase.change.custom.CustomTaskChange

Uses Java's UUID class to generate UUIDs for all rows in all tables in the tableNames parameter.

This class should only be used if you are not using MySQL, Oracle, MsSql, or some other dbms that has a UUID-like function.

Expects parameter: "tableNames" : whitespace delimited list of table names to add
Expects parameter: "columnName" : name of the column to change. Default: "uuid"
Expects parameter: "idExceptions" : list of id columns that don't follow the standard naming convention. Should be a pipe-separated list of key=value, where key is the name an id column would have by convention, and value is the name it actually has. In this example the id of the field_answer table is 'field_id' rather than 'field_answer_id', etc: "field_answer_id=field_id|role_id=role|privilege_id=privilege"


Constructor Summary
GenerateUuid()
           
 
Method Summary
 void execute(liquibase.database.Database database)
          Does the work of adding UUIDs to all rows.
 java.lang.String getConfirmationMessage()
           
 void setColumnName(java.lang.String columnName)
          This is called by liquibase to set the parameter "columnName" onto this change.
 void setFileOpener(liquibase.FileOpener fileOpener)
           
 void setIdExceptions(java.lang.String idExceptions)
          Way to specify the table id columns that don't follow the table_name.table_name_id pattern
 void setTableNames(java.lang.String tableNames)
          This is called by liquibase to set the parameter "tableNames" onto this change.
 void setUp()
          Get the values of the parameters passed in and set them to the local variables on this class.
 void validate(liquibase.database.Database database)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenerateUuid

public GenerateUuid()
Method Detail

execute

public void execute(liquibase.database.Database database)
             throws liquibase.exception.CustomChangeException,
                    liquibase.exception.UnsupportedChangeException
Does the work of adding UUIDs to all rows.

Specified by:
execute in interface liquibase.change.custom.CustomTaskChange
Throws:
liquibase.exception.CustomChangeException
liquibase.exception.UnsupportedChangeException
See Also:
CustomTaskChange.execute(liquibase.database.Database)

getConfirmationMessage

public java.lang.String getConfirmationMessage()
See Also:
CustomChange.getConfirmationMessage()

setFileOpener

public void setFileOpener(liquibase.FileOpener fileOpener)
See Also:
CustomChange.setFileOpener(liquibase.FileOpener)

setUp

public void setUp()
           throws liquibase.exception.SetupException
Get the values of the parameters passed in and set them to the local variables on this class.

Throws:
liquibase.exception.SetupException
See Also:
CustomChange.setUp()

validate

public void validate(liquibase.database.Database database)
              throws liquibase.exception.InvalidChangeDefinitionException
Throws:
liquibase.exception.InvalidChangeDefinitionException
See Also:
CustomChange.validate(liquibase.database.Database)

setTableNames

public void setTableNames(java.lang.String tableNames)
This is called by liquibase to set the parameter "tableNames" onto this change.

Parameters:
tableNames - the tableNames to set

setColumnName

public void setColumnName(java.lang.String columnName)
This is called by liquibase to set the parameter "columnName" onto this change.

Parameters:
columnName - the columnName to set

setIdExceptions

public void setIdExceptions(java.lang.String idExceptions)
Way to specify the table id columns that don't follow the table_name.table_name_id pattern

Parameters:
idExceptions -

OpenMRS-1.7.x

Generated Apr 27 2012 10:06 PM. NOTE - these libraries are in active development and subject to change