wt.load
Class LoadServerHelper

java.lang.Object
  extended bywt.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

Nested Class Summary
private static class LoadServerHelper.DomainKey
           
 
Field Summary
static int BLANK_OKAY
          Used to set the required flag for getValue.
private static String CLASSNAME
           
static String DEFAULT_CONT_PATH
           
static String DEFAULT_TARGET_DOMAIN_KEY
           
private static String DOMAIN_CACHE_KEY
           
private static Hashtable EMPTY_HASH
           
static long EXTERNALIZATION_VERSION_UID
           
static int NOT_REQUIRED
          Used to set the required flag for getValue.
protected static long OLD_FORMAT_VERSION_UID
           
private static String PARENT_ORG_PATH
           
static int REQUIRED
          Used to set the required flag for getValue.
private static String RESOURCE
           
(package private) static long serialVersionUID
           
private static String SERVICE_NAME
           
static String TARGET_CONTAINER_KEY
          Map key used to store the target container in the parameter list.
private static boolean VERBOSE
           
 
Constructor Summary
LoadServerHelper()
           
 
Method Summary
static void changePrincipal(String desiredPrincipal)
          Set the principal for operation on Windchill if the desiredPrincipal is different than the current principal.
(package private) static AdminDomainRef createDomain(AdminDomainRef parentDomainRef, String domainNameOrPath, String description, WTContainerRef containerRef)
           
private static AdminDomainRef createDomain(AdminDomainRef parentDomainRef, String domainNameOrPath, String description, WTContainerRef containerRef, boolean useCache)
           
private static Map createDomainCache()
           
private static AdministrativeDomain findDomain(String domainPath, WTContainerRef containerRef, boolean searchParent)
           
private static Hashtable getCache()
           
static Object getCacheValue(String key)
          Retrieve some object or value that was being stored for a latter command in the load process.
private static WTContainerRef getContainerFromLoadLine(Hashtable nv, Hashtable cmd_line, String cont_pathKey)
           
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 AdminDomainRef getTargetDomain(Hashtable nv, Hashtable cmd_line, String domain_key, boolean isRequired)
          Input file may specify Domain path as: a)Full path ('/System').
private static AdminDomainRef getTargetDomain(Hashtable nv, Hashtable cmd_line, String domain_key, boolean isRequired, boolean useDomainCache, String cont_pathKey)
           
static AdminDomainRef getTargetDomain(Hashtable nv, Hashtable cmd_line, String domain_key, boolean isRequired, String cont_pathKey)
          Deprecated. Now container path should be supplied as part of domain path.
static AdminDomainRef getTargetDomain(String domainPath, Hashtable nv, Hashtable cmd_line)
           
private static AdminDomainRef getTargetDomain(String domainPath, Hashtable nv, Hashtable cmd_line, boolean useDomainCache)
           
static AdminDomainRef getTargetDomain(String domainPath, Hashtable nv, Hashtable cmd_line, String cont_pathKey)
          Deprecated.  
private static AdminDomainRef getTargetDomain(String domainPath, Hashtable nv, Hashtable cmd_line, String cont_pathKey, boolean useDomainCache)
           
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.
private static void PP(String s)
           
static void printMessage(String text)
          Prints a message to both the MethodServer log and the session window that started the load.
 void readExternal(ObjectInput input)
          Reads the non-transient fields of this class from an external source.
private  boolean readOldVersion(ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source, which is not the current version.
protected  boolean readVersion(LoadServerHelper thisObject, ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source.
static void removeCacheValue(String 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.
 void writeExternal(ObjectOutput output)
          Writes the non-transient fields of this class to an external source.
 
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
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

EXTERNALIZATION_VERSION_UID

public static final long EXTERNALIZATION_VERSION_UID
See Also:
Constant Field Values

OLD_FORMAT_VERSION_UID

protected static final long OLD_FORMAT_VERSION_UID
See Also:
Constant Field Values

VERBOSE

private static boolean VERBOSE

SERVICE_NAME

private static final String SERVICE_NAME
See Also:
Constant Field Values

DOMAIN_CACHE_KEY

private static final String DOMAIN_CACHE_KEY
See Also:
Constant Field Values

DEFAULT_TARGET_DOMAIN_KEY

public static final String DEFAULT_TARGET_DOMAIN_KEY
See Also:
Constant Field Values

DEFAULT_CONT_PATH

public static final String DEFAULT_CONT_PATH

EMPTY_HASH

private static final Hashtable EMPTY_HASH

PARENT_ORG_PATH

private static final String PARENT_ORG_PATH
See Also:
Constant Field Values

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
Constructor Detail

LoadServerHelper

public LoadServerHelper()
Method Detail

writeExternal

public void writeExternal(ObjectOutput output)
                   throws IOException
Writes the non-transient fields of this class to an external source.

Supported API: false

Specified by:
writeExternal in interface Externalizable
Parameters:
output -
Throws:
IOException

readExternal

public void readExternal(ObjectInput input)
                  throws IOException,
                         ClassNotFoundException
Reads the non-transient fields of this class from an external source.

Supported API: false

Specified by:
readExternal in interface Externalizable
Parameters:
input -
Throws:
IOException
ClassNotFoundException

readVersion

protected boolean readVersion(LoadServerHelper thisObject,
                              ObjectInput input,
                              long readSerialVersionUID,
                              boolean passThrough,
                              boolean superDone)
                       throws IOException,
                              ClassNotFoundException
Reads the non-transient fields of this class from an external source.

Supported API: false

Parameters:
thisObject -
input -
readSerialVersionUID -
passThrough -
superDone -
Returns:
boolean
Throws:
IOException
ClassNotFoundException

readOldVersion

private boolean readOldVersion(ObjectInput input,
                               long readSerialVersionUID,
                               boolean passThrough,
                               boolean superDone)
                        throws IOException,
                               ClassNotFoundException
Reads the non-transient fields of this class from an external source, which is not the current version.

Parameters:
input -
readSerialVersionUID -
passThrough -
superDone -
Returns:
boolean
Throws:
IOException
ClassNotFoundException

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

getCache

private static Hashtable getCache()
                           throws WTException
Throws:
WTException

getTargetDomain

public static AdminDomainRef getTargetDomain(Hashtable nv,
                                             Hashtable cmd_line,
                                             String domain_key,
                                             boolean isRequired,
                                             String cont_pathKey)
                                      throws WTException
Deprecated. Now container path should be supplied as part of domain path.

Parameters:
nv -
cmd_line -
domain_key -
isRequired -
cont_pathKey -
Returns:
Throws:
WTException

getTargetDomain

private static AdminDomainRef getTargetDomain(Hashtable nv,
                                              Hashtable cmd_line,
                                              String domain_key,
                                              boolean isRequired,
                                              boolean useDomainCache,
                                              String cont_pathKey)
                                       throws WTException
Throws:
WTException

getTargetDomain

public static AdminDomainRef getTargetDomain(String domainPath,
                                             Hashtable nv,
                                             Hashtable cmd_line,
                                             String cont_pathKey)
                                      throws WTException
Deprecated.  

Parameters:
nv -
cmd_line -
cont_pathKey -
Returns:
Throws:
WTException

getTargetDomain

private static AdminDomainRef getTargetDomain(String domainPath,
                                              Hashtable nv,
                                              Hashtable cmd_line,
                                              String cont_pathKey,
                                              boolean useDomainCache)
                                       throws WTException
Throws:
WTException

getContainerFromLoadLine

private static WTContainerRef getContainerFromLoadLine(Hashtable nv,
                                                       Hashtable cmd_line,
                                                       String cont_pathKey)
                                                throws WTException
Throws:
WTException

getTargetDomain

public static AdminDomainRef getTargetDomain(Hashtable nv,
                                             Hashtable cmd_line,
                                             String domain_key,
                                             boolean isRequired)
                                      throws WTException
Input file may specify Domain path as: a)Full path ('/System'). In this case will look in target container and then in Exchange. b)Container qualified path ('[/]/System'). If the container is parent Org for the target container, you may use [/Org] for container path part. For migration purposes, it also supports domain name ('System'). If domain name is one of 'special' domains, will return this domain. Otherwise, will return domain with Root parent in Classic.

Parameters:
cmd_line -
domain_key -
isRequired -
Returns:
Throws:
WTException

getTargetDomain

public static AdminDomainRef getTargetDomain(String domainPath,
                                             Hashtable nv,
                                             Hashtable cmd_line)
                                      throws WTException
Parameters:
domainPath - Domain path. It can be a) Container qualified domain path , e.g. '[/]/System'. b) Domain path, e.g. '/MyDomain/MyNestedDomain'. For domain path, will first look in the target container, and then in Exchange This API also supports Domain name, e.g. 'Default', to enable lookup of special domains (Default, Root, User, System) in pre-7.0 format.
nv -
cmd_line -
Returns:
Throws:
WTException

getTargetDomain

private static AdminDomainRef getTargetDomain(String domainPath,
                                              Hashtable nv,
                                              Hashtable cmd_line,
                                              boolean useDomainCache)
                                       throws WTException
Throws:
WTException

findDomain

private static AdministrativeDomain findDomain(String domainPath,
                                               WTContainerRef containerRef,
                                               boolean searchParent)
                                        throws WTException
Throws:
WTException

createDomainCache

private static Map createDomainCache()
                              throws WTException
Throws:
WTException

createDomain

static AdminDomainRef createDomain(AdminDomainRef parentDomainRef,
                                   String domainNameOrPath,
                                   String description,
                                   WTContainerRef containerRef)
                            throws WTException,
                                   WTPropertyVetoException
Throws:
WTException
WTPropertyVetoException

createDomain

private static AdminDomainRef createDomain(AdminDomainRef parentDomainRef,
                                           String domainNameOrPath,
                                           String description,
                                           WTContainerRef containerRef,
                                           boolean useCache)
                                    throws WTException,
                                           WTPropertyVetoException
Throws:
WTException
WTPropertyVetoException

PP

private static void PP(String s)