wt.load
Class LoadServerHelper

java.lang.Object
  extended by wt.load.LoadServerHelper
All Implemented Interfaces:
Externalizable, Serializable

public class LoadServerHelper
extends Object
implements Externalizable

Provides helper methods for use in load classes such as LoadDoc and LoadPart.

Supported API: true

Extendable: false

See Also:
Serialized Form

Field Summary
static int BLANK_OKAY
          Used to set the required flag for getValue.
static int NOT_REQUIRED
          Used to set the required flag for getValue.
static int REQUIRED
          Used to set the required flag for getValue.
static String TARGET_CONTAINER_KEY
          Map key used to store the target container in the parameter list.
 
Method Summary
static void changePrincipal(String desiredPrincipal)
          Set the principal for operation on Windchill if the desiredPrincipal is different than the current principal.
static Object getCacheValue(String key)
          Retrieve some object or value that was being stored for a latter command in the load process.
static Object getFromCache(Object key)
          Retrieve some object or value that was being stored for a latter command in the load process.
static WTContainerRef getTargetContainer(Hashtable cmd_line)
          Returns the container ref to use for the load.
static WTContainerRef getTargetContainer(Hashtable nv, Hashtable cmd_line)
          Returns the container ref to use for the load.This signature assumes that the csvmapfile.txt uses following string for the container path: parentContainerPath If you are using a different key, use the signature that allows you to specify the lookup key.
static WTContainerRef getTargetContainer(Hashtable nv, Hashtable cmd_line, String cont_pathKey)
          Returns the container ref to use for the load.
static WTContainerRef getTargetContainer(Hashtable nv, Hashtable cmd_line, String cont_pathKey, boolean useCache)
          Returns the container ref to use for the load.
static WTContainerRef getTargetContainer(Hashtable cmd_line, String cont_pathKey)
          Returns the container ref to use for the load.
static WTContainerRef getTargetContainer(Hashtable cmd_line, String cont_pathKey, boolean useCache)
          Returns the container ref to use for the load.
static String getValue(String name, Hashtable nv, Hashtable cmd_line, int required)
          Get the value for the variable from either the file or the command line.
static void printMessage(String text)
          Prints a message to both the MethodServer log and the session window that started the load.
static void putCacheValue(Object key, Object value)
          Save some object or value that can be used by a latter command in the load process.
static void removeCacheValue(String key)
          Remove an object or value that was stored for the load process.
static Object removeFromCache(Object key)
          Remove an object or value that was stored for the load process.
static void setCacheValue(String key, Object value)
          Save some object or value that can be used by a latter command in the load process.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REQUIRED

public static final int REQUIRED
Used to set the required flag for getValue.

Supported API: true

See Also:
Constant Field Values

NOT_REQUIRED

public static final int NOT_REQUIRED
Used to set the required flag for getValue.

Supported API: true

See Also:
Constant Field Values

BLANK_OKAY

public static final int BLANK_OKAY
Used to set the required flag for getValue.

Supported API: true

See Also:
Constant Field Values

TARGET_CONTAINER_KEY

public static final String TARGET_CONTAINER_KEY
Map key used to store the target container in the parameter list.

Supported API: true

See Also:
Constant Field Values
Method Detail

changePrincipal

public static void changePrincipal(String desiredPrincipal)
                            throws WTException
Set the principal for operation on Windchill if the desiredPrincipal is different than the current principal.

Supported API: true

Parameters:
desiredPrincipal - The principal that is desired for this operation.
Throws:
WTException

getCacheValue

public static Object getCacheValue(String key)
                            throws WTException
Retrieve some object or value that was being stored for a latter command in the load process.

Supported API: true

Parameters:
key - Key to hashtable storing the value.
Returns:
Object
Throws:
WTException

setCacheValue

public static void setCacheValue(String key,
                                 Object value)
                          throws WTException
Save some object or value that can be used by a latter command in the load process.

Supported API: true

Parameters:
key - Key to hashtable storing the value.
value - Value to be stored in the hashtable for latter use in the load process.
Throws:
WTException

removeCacheValue

public static void removeCacheValue(String key)
                             throws WTException
Remove an object or value that was stored for the load process.

Supported API: true

Parameters:
key - Key to hashtable storing the value.
Throws:
WTException

printMessage

public static void printMessage(String text)
Prints a message to both the MethodServer log and the session window that started the load.

Supported API: true

Parameters:
text - The message to be written to the log and the current session screen.

getValue

public static String getValue(String name,
                              Hashtable nv,
                              Hashtable cmd_line,
                              int required)
Get the value for the variable from either the file or the command line. The name of the variable must be in the csvmapfile.txt. Does not throw exceptions on missing required attributes so that all attributes can be checked first.

Supported API: true

Parameters:
name - Name of attribute to retrieve.
nv - Hashtable with values from data file.
cmd_line - Hashtable with misc values from the command line.
required - Flag if this is a required variable or not.
Returns:
String

getTargetContainer

public static final WTContainerRef getTargetContainer(Hashtable cmd_line)
                                               throws WTException
Returns the container ref to use for the load. If ixb processing is being used, the container reference is set in the cmd_line hash by the framework. If this is not set, then the container_path is queried. This signature assumes that the csvmapfile.txt uses following string for the container path: parentContainerPath

Supported API: true

Parameters:
cmd_line - The framework that calls you loader has populated this for you. It is a representation of the csv/xml file contents.
Returns:
WTContainerRef
Throws:
WTException

getTargetContainer

public static final WTContainerRef getTargetContainer(Hashtable nv,
                                                      Hashtable cmd_line)
                                               throws WTException
Returns the container ref to use for the load.This signature assumes that the csvmapfile.txt uses following string for the container path: parentContainerPath If you are using a different key, use the signature that allows you to specify the lookup key. The nv hash is consulted first, and the value is trumped by the command line. The target container ref is then cached for future use.

Supported API: true

Parameters:
nv - Although it hard-wiring container values in an input file is strongly discouraged, if you wish to do so you can.
cmd_line - The framework that calls you loader has populated this for you. It is a representation of the csv/xml file contents.
Returns:
WTContainerRef
Throws:
WTException

getTargetContainer

public static final WTContainerRef getTargetContainer(Hashtable cmd_line,
                                                      String cont_pathKey)
                                               throws WTException
Returns the container ref to use for the load. If ixb processing is being used, the container reference is set in the cmd_line hash by the framework. If this is not set, then the container_path is queried. This signature is to be used if the containerPath is keyed by a string other than parentContainerPath

Supported API: true

Parameters:
cmd_line - The framework that calls you loader has populated this for you. It is a representation of the csv/xml file contents.
cont_pathKey - The key for the containerPath used in the csvmapfile.txt definition for your object.
Returns:
WTContainerRef
Throws:
WTException

getTargetContainer

public static final WTContainerRef getTargetContainer(Hashtable nv,
                                                      Hashtable cmd_line,
                                                      String cont_pathKey)
                                               throws WTException
Returns the container ref to use for the load. If ixb processing is being used, the container reference is set in the cmd_line hash by the framework. If this is not set, then the container_path is queried. This signature is to be used if the containerPath is keyed by a string other than parentContainerPath

Supported API: true

Parameters:
nv -
cmd_line - The framework that calls you loader has populated this for you. It is a representation of the csv/xml file contents.
cont_pathKey - The key for the containerPath used in the csvmapfile.txt definition for your object.
Returns:
WTContainerRef
Throws:
WTException

getTargetContainer

public static final WTContainerRef getTargetContainer(Hashtable cmd_line,
                                                      String cont_pathKey,
                                                      boolean useCache)
                                               throws WTException
Returns the container ref to use for the load. If ixb processing is being used, the container reference is set in the cmd_line hash by the framework. If this is not set, then the container_path is queried. This signature is to be used if the containerPath is keyed by a string other than parentContainerPath. If the path is not in the hashtable, then we try to use the cached value of the containerPath

Supported API: true

Parameters:
cmd_line - The framework that calls you loader has populated this for you. It is a representation of the csv/xml file contents.
cont_pathKey - The key for the containerPath used in the csvmapfile.txt definition for your object.
useCache - Use cache value if not defined in cmd_line.
Returns:
WTContainerRef
Throws:
WTException

getTargetContainer

public static final WTContainerRef getTargetContainer(Hashtable nv,
                                                      Hashtable cmd_line,
                                                      String cont_pathKey,
                                                      boolean useCache)
                                               throws WTException
Returns the container ref to use for the load. If ixb processing is being used, the container reference is set in the cmd_line hash by the framework. If this is not set, then the container_path is queried. This signature is to be used if the containerPath is keyed by a string other than parentContainerPath. If the path is not in the hashtable, then we try to use the cached value of the containerPath

Supported API: true

Parameters:
nv -
cmd_line - The framework that calls you loader has populated this for you. It is a representation of the csv/xml file contents.
cont_pathKey - The key for the containerPath used in the csvmapfile.txt definition for your object.
useCache - Use cache value if not defined in cmd_line.
Returns:
WTContainerRef
Throws:
WTException

getFromCache

public static Object getFromCache(Object key)
                           throws WTException
Retrieve some object or value that was being stored for a latter command in the load process.

Supported API: true

Parameters:
key - Key to cache
Returns:
Object
Throws:
WTException

putCacheValue

public static void putCacheValue(Object key,
                                 Object value)
                          throws WTException
Save some object or value that can be used by a latter command in the load process.

Supported API: true

Parameters:
key - Key to the cache
value - Value to be cached
Throws:
wt.util.WTException82
WTException

removeFromCache

public static Object removeFromCache(Object key)
                              throws WTException
Remove an object or value that was stored for the load process.

Supported API: true

Parameters:
key - Key to the cache
Returns:
The previously cached value, if any
Throws:
WTException