com.ptc.windchill.upgrade.directives.dataload
Class LoadDataFile

java.lang.Object
  extended bycom.ptc.windchill.upgrade.directives.dataload.LoadDataFile
All Implemented Interfaces:
UpdateDirective

public final class LoadDataFile
extends Object
implements UpdateDirective

Alters a table to populate it with necessary data. The LoadDatFile directive has three attributes delimChar, mapFile, and dataFile.

Format

   <LoadDataFile mapFile="path +file name" dataFile="path + file name">

 The attribute  delimChar  is optional.  If this value is not included it is assumed that
 the value is a comma.

 The attribute mapFile is optional.  If the attribute is not included it is assumed it is using
 the map file all the other load files use which is, csvmapfile.txt file.

 The only attribute that is required is dataFile.  The directive needs to know what file it is loading.
 Also, the path to file is necessary.  If it is not included it assumes the file is under WT_HOME.

 The directive LoadDataFile could have four different looks to it, they are:
 

Example Usages:

1.
    <LoadDataFile delimChar="~" mapFile="..." dataFile="...."/>
  
2.
    <LoadDataFile mapFile="..." dataFile="..."/>
 
3.
    <LoadDataFile dataFile="...."/>
   
4.
     <LoadDataFile delimChar="~" dataFile="...."/>
  


Supported API: false

Extendable: false


Nested Class Summary
private  class LoadDataFile.DataOutputter
          Encapsulates the conditional writing of the data records to the data file.
 
Field Summary
private static Object creationLock__
           
static String DATA_FILE_TO_LOAD
           
private  String dataFilesPath_
           
private static String DEFAULT_DELIMITER_ATTR_VALUE
           
private static String DEFAULT_MAP_FILE
           
private  String delimiter_
           
static String DELIMITER_ATTR_NAME
           
static String MAP_FILE
           
private  String mapFilesPath_
           
private  String user_
           
private  WTProperties wtProperties_
           
 
Constructor Summary
LoadDataFile()
          Create an instance with no data.
 
Method Summary
 void asDomOn(Element element)
           
 void execute(DirectiveServices directive_services)
          Executes the inner class DataOutputter.
private  String getDirectiveName()
          The name of the directive.
 void initializeFromDom(Element element)
          Reads from DOMs formatted as described in the class documentation above.
private  String modifyLoadFilePath(String relative_path)
           
 void run()
           
private  String userLoggedIn()
          Stores the login name
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DELIMITER_ATTR_NAME

public static final String DELIMITER_ATTR_NAME
See Also:
Constant Field Values

DEFAULT_DELIMITER_ATTR_VALUE

private static final String DEFAULT_DELIMITER_ATTR_VALUE
See Also:
Constant Field Values

DEFAULT_MAP_FILE

private static final String DEFAULT_MAP_FILE
See Also:
Constant Field Values

DATA_FILE_TO_LOAD

public static final String DATA_FILE_TO_LOAD
See Also:
Constant Field Values

MAP_FILE

public static final String MAP_FILE
See Also:
Constant Field Values

wtProperties_

private WTProperties wtProperties_

delimiter_

private String delimiter_

mapFilesPath_

private String mapFilesPath_

dataFilesPath_

private String dataFilesPath_

user_

private String user_

creationLock__

private static Object creationLock__
Constructor Detail

LoadDataFile

public LoadDataFile()
Create an instance with no data.

Method Detail

userLoggedIn

private String userLoggedIn()
Stores the login name


run

public void run()

asDomOn

public void asDomOn(Element element)
Specified by:
asDomOn in interface UpdateDirective

initializeFromDom

public void initializeFromDom(Element element)
Reads from DOMs formatted as described in the class documentation above.

Specified by:
initializeFromDom in interface UpdateDirective

getDirectiveName

private String getDirectiveName()
The name of the directive.


execute

public void execute(DirectiveServices directive_services)
             throws DirectiveExecutionException
Executes the inner class DataOutputter.

Specified by:
execute in interface UpdateDirective
Throws:
DirectiveExecutionException - if the class cannot be found, is not actually a Migrator, the instance cannot created due to visibility issues or because the class is abstract or an interface, or the migrator fails or returns a false return value

modifyLoadFilePath

private String modifyLoadFilePath(String relative_path)