wt.load
Class LoadContent

java.lang.Object
  extended bywt.load.LoadContent

public class LoadContent
extends Object

Used to load file and URL content into ContentHolders such as documents and parts for test or demo data in Windchill. Methods in this class are defined for use by the load package inside of the map file (wt.home.loadFile.csvmapfile.txt). These methods were written to be called by the load package using introspection not by a user interface.


Field Summary
private static String CURRENT_AGG_KEY
           
private static String CURRENT_CH_KEY
           
private static String CURRENT_ROLE_KEY
           
private static String DEFAULT_DIR_KEY
           
private static String DEFAULT_DIRECTORY
           
private static String DEFAULT_URL_KEY
           
private static String LOAD_FILE_DIR
           
private static String WT_HOME
           
 
Constructor Summary
LoadContent()
           
 
Method Summary
static boolean createAggregate(Hashtable nv, Hashtable cmd_line, Vector return_objects)
          Add aggregate to the cached content holder object, and cache the aggregate.
static boolean createAggregateFile(Hashtable nv, Hashtable cmd_line, Vector return_objects)
          Add file content to the cached aggregate for the cached content holder object.
static boolean createAggregateURL(Hashtable nv, Hashtable cmd_line, Vector return_objects)
          Add URL content to the cached aggregate for the cached content holder object.
static boolean createContentFile(Hashtable nv, Hashtable cmd_line, Vector return_objects)
          Add file content to the cached content holder object.
private static boolean createContentFile(Hashtable nv, Hashtable cmd_line, Vector return_objects, boolean replace)
          Add file content to the cached content holder object.
static boolean createContentURL(Hashtable nv, Hashtable cmd_line, Vector return_objects)
          Add URL content to the cached content holder object.
private static URLData createOrReuseURLData(ContentHolder contentHolder, String role)
          If primary content for the content holder already exist, reuse it to avoid creating multiple primary content; otherwise create a new URLData for it.
static boolean createPrimary(Hashtable nv, Hashtable cmd_line, Vector return_objects)
          Add the primary piece of content for a document.
static boolean replaceContentFile(Hashtable nv, Hashtable cmd_line, Vector return_objects)
          Add file content to the cached content holder object.
static boolean setDefaultDirectory(Hashtable nv, Hashtable cmd_line, Vector return_objects)
          Create a default directory to load content from.
static boolean setDefaultURL(Hashtable nv, Hashtable cmd_line, Vector return_objects)
          Create a default URL to load content from.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WT_HOME

private static final String WT_HOME

LOAD_FILE_DIR

private static final String LOAD_FILE_DIR

DEFAULT_DIRECTORY

private static final String DEFAULT_DIRECTORY

CURRENT_CH_KEY

private static String CURRENT_CH_KEY

CURRENT_AGG_KEY

private static String CURRENT_AGG_KEY

CURRENT_ROLE_KEY

private static String CURRENT_ROLE_KEY

DEFAULT_DIR_KEY

private static String DEFAULT_DIR_KEY

DEFAULT_URL_KEY

private static String DEFAULT_URL_KEY
Constructor Detail

LoadContent

public LoadContent()
Method Detail

setDefaultDirectory

public static boolean setDefaultDirectory(Hashtable nv,
                                          Hashtable cmd_line,
                                          Vector return_objects)
Create a default directory to load content from. This directory is in affect until this method is called again.

Parameters:
nv - Name/value pair for the default directory.
cmd_line - command line argument that can be substituted into the load data.
return_objects - Object(s) created by this method used by wt.load.StandardLoadService for user feedback messages.

setDefaultURL

public static boolean setDefaultURL(Hashtable nv,
                                    Hashtable cmd_line,
                                    Vector return_objects)
Create a default URL to load content from. This URL is in affect until this method is called again.

Parameters:
nv - Name/value pair for the default URL.
cmd_line - command line argument that can be substituted into the load data.
return_objects - Object(s) created by this method used by wt.load.StandardLoadService for user feedback messages.

createPrimary

public static boolean createPrimary(Hashtable nv,
                                    Hashtable cmd_line,
                                    Vector return_objects)
Add the primary piece of content for a document. Can be an aggregate, a file, or a URL

Parameters:
nv - Name/value pairs for data pertaining to adding the content object.
cmd_line - command line argument that can be substituted into the load data.
return_objects - Object(s) created by this method used by wt.load.StandardLoadService for user feedback messages.

createContentURL

public static boolean createContentURL(Hashtable nv,
                                       Hashtable cmd_line,
                                       Vector return_objects)
Add URL content to the cached content holder object. If no object is cached using LoadServerHelper.getCacheValue(CURRENT_CH_KEY) then this method fails, returns false.

Parameters:
nv - Name/value pairs for data pertaining to adding the content object.
cmd_line - command line argument that can be substituted into the load data.
return_objects - Object(s) created by this method used by wt.load.StandardLoadService for user feedback messages.

createOrReuseURLData

private static URLData createOrReuseURLData(ContentHolder contentHolder,
                                            String role)
                                     throws WTException,
                                            PropertyVetoException
If primary content for the content holder already exist, reuse it to avoid creating multiple primary content; otherwise create a new URLData for it.

Throws:
WTException
PropertyVetoException

createContentFile

public static boolean createContentFile(Hashtable nv,
                                        Hashtable cmd_line,
                                        Vector return_objects)
Add file content to the cached content holder object. If no object is cached using LoadServerHelper.getCacheValue(CURRENT_CH_KEY) then this method fails, returns false.

Parameters:
nv - Name/value pairs for data pertaining to adding the content object.
cmd_line - command line argument that can be substituted into the load data.
return_objects - Object(s) created by this method used by wt.load.StandardLoadService for user feedback messages.

replaceContentFile

public static boolean replaceContentFile(Hashtable nv,
                                         Hashtable cmd_line,
                                         Vector return_objects)
Add file content to the cached content holder object. If no object is cached using LoadServerHelper.getCacheValue(CURRENT_CH_KEY) then this method fails, returns false.

This method will first try to find an existing file attached to the content holder that already has that name. If it does then it will replace that file with this new one. If no match is found then the file is added to the content holder. This method will only work on the create document methods that do not remove all content after the create. The original create documents do by default remove all of the content so this method used with them will always create and never find anything to replace. The csv tags that will work with this method are DocumentRetainContent and BeginWTDocumentRetainContent/EndWTDocumentRetainContent.

Parameters:
nv - Name/value pairs for data pertaining to adding the content object.
cmd_line - command line argument that can be substituted into the load data.
return_objects - Object(s) created by this method used by wt.load.StandardLoadService for user feedback messages.

createContentFile

private static boolean createContentFile(Hashtable nv,
                                         Hashtable cmd_line,
                                         Vector return_objects,
                                         boolean replace)
Add file content to the cached content holder object. If no object is cached using LoadServerHelper.getCacheValue(CURRENT_CH_KEY) then this method fails, returns false.

Parameters:
nv - Name/value pairs for data pertaining to adding the content object.
cmd_line - command line argument that can be substituted into the load data.
return_objects - Object(s) created by this method used by wt.load.StandardLoadService for user feedback messages.
replace - flag that if it is true the code should try to replace existing secondary content when the filenames are the same.

createAggregate

public static boolean createAggregate(Hashtable nv,
                                      Hashtable cmd_line,
                                      Vector return_objects)
Add aggregate to the cached content holder object, and cache the aggregate. If no object is cached using LoadServerHelper.getCacheValue(CURRENT_CH_KEY) then this method fails, returns false. For an aggregate the path is expected to be a directory, and the format is required as the display name of the format in the system (i.e. Microsoft Word)

Parameters:
nv - Name/value pairs for data pertaining to adding the content object.
cmd_line - command line argument that can be substituted into the load data.
return_objects - Object(s) created by this method used by wt.load.StandardLoadService for user feedback messages.

createAggregateFile

public static boolean createAggregateFile(Hashtable nv,
                                          Hashtable cmd_line,
                                          Vector return_objects)
Add file content to the cached aggregate for the cached content holder object. If no object is cached using LoadServerHelper.getCacheValue(CURRENT_AGG_KEY) and LoadServerHelper.getCacheValue(CURRENT_CH_KEY) then this method fails, returns false.

Parameters:
nv - Name/value pairs for data pertaining to adding the content object.
cmd_line - command line argument that can be substituted into the load data.
return_objects - Object(s) created by this method used by wt.load.StandardLoadService for user feedback messages.

createAggregateURL

public static boolean createAggregateURL(Hashtable nv,
                                         Hashtable cmd_line,
                                         Vector return_objects)
Add URL content to the cached aggregate for the cached content holder object. If no object is cached using LoadServerHelper.getCacheValue(CURRENT_AGG_KEY) and LoadServerHelper.getCacheValue(CURRENT_CH_KEY) then this method fails, returns false.

Parameters:
nv - Name/value pairs for data pertaining to adding the content object.
cmd_line - command line argument that can be substituted into the load data.
return_objects - Object(s) created by this method used by wt.load.StandardLoadService for user feedback messages.