com.ptc.windchill.upgrade.directives.mig
Class CopyDataBetweenColumns

java.lang.Object
  extended bycom.ptc.windchill.upgrade.directives.mig.CopyDataBetweenColumns
All Implemented Interfaces:
UpdateDirective

public class CopyDataBetweenColumns
extends Object
implements UpdateDirective

Performs the renaming of a column in the database.

Format

    >CopyDataBetweenColumns tableName="..." fromColumnName="..." toColumnName="..."/<
 
Component Description Required Parameterizable
@tableName The table to apply the column rename on. yes yes, all macros
@fromColumnName The name of the column that is being changed. no yes, all macros
@toColumnName The name to change the column name to. yes no


Field Summary
private static String FROM_COLUMN_NAME_ATTRIBUTE_NAME
           
private  String fromColumnName_
           
private static String RESOURCE
           
private static String TABLE_NAME_ATTRIBUTE_NAME
           
private  ParameterizedString tableName_
           
private static String TO_COLUMN_NAME_ATTRIBUTE_NAME
           
private  String toColumnName_
           
 
Constructor Summary
CopyDataBetweenColumns()
          Create an instance.
 
Method Summary
 void asDomOn(Element element)
          Writes the directive as a DOM element according to the class documentation above.
 void execute(DirectiveServices directive_services)
          Parameterizes the table name and executes the column renaming
private  String getDirectiveName()
           
 String getFromColumnName()
          The name of the column from which the data is being copied.
 String getTableName()
          The name of the table to perform the copy on.
 String getToColumnName()
          The name of the column to copy the data into.
 void initializeFromDom(Element element)
          Reads the DOM element into this directive according to the class documentation above.
 void setFromColumnName(String from_column_name)
          Sets the name of the column from which the data is being copied.
 void setTableName(String table_name)
          Sets the SQL statement.
 void setToColumnName(String to_column_name)
          Sets the name of the column to copy the data into.
private  void validateProperties(String table_name)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESOURCE

private static final String RESOURCE

TABLE_NAME_ATTRIBUTE_NAME

private static final String TABLE_NAME_ATTRIBUTE_NAME
See Also:
Constant Field Values

FROM_COLUMN_NAME_ATTRIBUTE_NAME

private static final String FROM_COLUMN_NAME_ATTRIBUTE_NAME
See Also:
Constant Field Values

TO_COLUMN_NAME_ATTRIBUTE_NAME

private static final String TO_COLUMN_NAME_ATTRIBUTE_NAME
See Also:
Constant Field Values

tableName_

private ParameterizedString tableName_

fromColumnName_

private String fromColumnName_

toColumnName_

private String toColumnName_
Constructor Detail

CopyDataBetweenColumns

public CopyDataBetweenColumns()
Create an instance.

Method Detail

setTableName

public void setTableName(String table_name)
                  throws ParseException
Sets the SQL statement. The statement can be parameterized to class info. If this is done, the directive needs to be placed inside a directive that provides parameterization information such as ForEachConcreteImplementorOf.

Throws:
ParseException - if the SQL contains a parameterization as allowed in ParameterizedStrings, but it is syntactically incorrect or utilizes a macro incorrectly
See Also:
ForEachConcreteImplementorOf

setFromColumnName

public void setFromColumnName(String from_column_name)
Sets the name of the column from which the data is being copied.


setToColumnName

public void setToColumnName(String to_column_name)
Sets the name of the column to copy the data into.


getTableName

public String getTableName()
The name of the table to perform the copy on.

Returns:
may return a parameterized string. Will never be null.

getFromColumnName

public String getFromColumnName()
The name of the column from which the data is being copied.

Returns:
Will never be null.

getToColumnName

public String getToColumnName()
The name of the column to copy the data into.

Returns:
Will never be null.

asDomOn

public void asDomOn(Element element)
Writes the directive as a DOM element according to the class documentation above.

Specified by:
asDomOn in interface UpdateDirective

initializeFromDom

public void initializeFromDom(Element element)
                       throws DirectiveIOException
Reads the DOM element into this directive according to the class documentation above.

Specified by:
initializeFromDom in interface UpdateDirective
Throws:
DirectiveIOException - if there are syntax errors in parameterization of the statement

execute

public void execute(DirectiveServices directive_services)
             throws DirectiveExecutionException
Parameterizes the table name and executes the column renaming

Specified by:
execute in interface UpdateDirective
Throws:
DirectiveExecutionException - if there are parameterization syntax errors, if the connection cannot be acquired, or if there is a SQLException

getDirectiveName

private String getDirectiveName()

validateProperties

private void validateProperties(String table_name)
                         throws DirectiveExecutionException
Throws:
DirectiveExecutionException