wt.ixb.archive
Class ArchiveHndHelper

java.lang.Object
  extended bywt.ixb.archive.ArchiveHndHelper

public class ArchiveHndHelper
extends Object

This class holds String constants and helper methods which IX handlers need to support Archive and Restore functionality.


Field Summary
static int IMPORT_PRIORITY_COLLECTION_UNITS
           
private static String RESOURCE
           
private static ReferenceFactory RF
           
static String XML_ARCHIVE_INFO
           
static String XML_ATTR_CONTAINER_ID
           
static String XML_ATTR_CREATE_STAMP
           
static String XML_ATTR_CREATED_BY_DNADDR
           
static String XML_ATTR_CREATED_BY_OIDADDR
           
static String XML_ATTR_FOLDER_ID
           
static String XML_ATTR_LOCAL_ID
           
static String XML_ATTR_MODIFIED_BY_DNADDR
           
static String XML_ATTR_MODIFIED_BY_OIDADDR
           
static String XML_ATTR_MODIFY_STAMP
           
static String XML_ATTR_OWNED_BY_DNADDR
           
static String XML_ATTR_OWNED_BY_OIDADDR
           
static String XML_CREATE_RECORD
           
static String XML_FLEXIBLE_VERSIONING_INFO
           
static String XML_LC_ACTION
           
static String XML_LC_ACTOR_NAME
           
static String XML_LC_ASSERTION
           
static String XML_LC_COMMENTS
           
static String XML_LC_CRITERION
           
static String XML_LC_CRITERION_CREATEDDATE
           
static String XML_LC_CRITERION_MODIFYDATE
           
static String XML_LC_HISTORY
           
static String XML_LC_HISTORY_CREATEDATE
           
static String XML_LC_HISTORY_MODIFYDATE
           
static String XML_LC_NAME
           
static String XML_LC_PHASE_NAME
           
static String XML_LC_ROLE_NAME
           
static String XML_LC_SATISFIED
           
static String XML_LC_SIGNATURE
           
static String XML_LC_SIGNATURE_CREATEDDATE
           
static String XML_LC_SIGNATURE_MODIFYDATE
           
static String XML_LC_SIGNATURE_PHASE
           
static String XML_LC_SIGNER
           
static String XML_LC_SIGNER_NAME
           
static String XML_LC_STATE
           
static String XML_LC_TEAM_ID
           
static String XML_LC_VOTE
           
static String XML_MERGE_INWARDS_UFID
           
static String XML_MERGE_OUTWARDS_UFID
           
static String XML_OBJECT_HISTORY
           
static String XML_PREDECCESOR_BRANCH_POINT_UFID
           
static String XML_TAG_BASE_CRITERION_DEF
           
static String XML_TAG_COLLECTION_CRITERIA
           
static String XML_TAG_CRITERION_DEF_VALID_WITH
           
static String XML_TAG_RELATIONSHIP_MAP
           
static String XML_TAG_RELATIONSHIP_MAP_DEF
           
 
Constructor Summary
ArchiveHndHelper()
           
 
Method Summary
static void addOidForReuse(Transaction transaction, ObjectIdentifier oid)
          Adds an oid to transaction map for restore
static void archiveCreateRecord(Object o, IxbElement fileXml, Exporter exporter)
          Archives the createRecord to xml.
static void archiveFlexibleVersioningInfo(Object o, IxbElement fileXml, Exporter exporter)
          Archives the flexibleVersioningInfo to xml.
static Object findAmongExistingObjectsForRestore(IxbElement fileXml, Importer importer)
          Implements a standard way to find from existing windchill database an object that matches the IxbHndHelper.XML_ATTR_LOCAL_ID element in the archived xml file.
private static String getXmlElementValue(IxbElement fileXml, String xmlTag)
          Obtains xml element value.
private static String getXmlElementValue(IxbElement fileXml, String xmlTag, boolean isElementOptional)
          Obtains xml element value.
private static boolean isADn(String user)
           
static Object restoreCreateRecord(Object o, IxbElement fileXml, Importer importer)
          Restores the createRecord and object id from xml.
static Object restoreObjectId(Object o, IxbElement fileXml, Importer importer)
          Restores object id from xml file.
static Ufid stringToUfid(String ufidString)
          Converts string to ufid
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XML_ARCHIVE_INFO

public static final String XML_ARCHIVE_INFO
See Also:
Constant Field Values

XML_ATTR_LOCAL_ID

public static final String XML_ATTR_LOCAL_ID
See Also:
Constant Field Values

XML_ATTR_CONTAINER_ID

public static final String XML_ATTR_CONTAINER_ID
See Also:
Constant Field Values

XML_ATTR_FOLDER_ID

public static final String XML_ATTR_FOLDER_ID
See Also:
Constant Field Values

XML_CREATE_RECORD

public static final String XML_CREATE_RECORD
See Also:
Constant Field Values

XML_ATTR_CREATE_STAMP

public static final String XML_ATTR_CREATE_STAMP
See Also:
Constant Field Values

XML_ATTR_MODIFY_STAMP

public static final String XML_ATTR_MODIFY_STAMP
See Also:
Constant Field Values

XML_ATTR_CREATED_BY_DNADDR

public static final String XML_ATTR_CREATED_BY_DNADDR
See Also:
Constant Field Values

XML_ATTR_CREATED_BY_OIDADDR

public static final String XML_ATTR_CREATED_BY_OIDADDR
See Also:
Constant Field Values

XML_ATTR_MODIFIED_BY_DNADDR

public static final String XML_ATTR_MODIFIED_BY_DNADDR
See Also:
Constant Field Values

XML_ATTR_MODIFIED_BY_OIDADDR

public static final String XML_ATTR_MODIFIED_BY_OIDADDR
See Also:
Constant Field Values

XML_ATTR_OWNED_BY_DNADDR

public static final String XML_ATTR_OWNED_BY_DNADDR
See Also:
Constant Field Values

XML_ATTR_OWNED_BY_OIDADDR

public static final String XML_ATTR_OWNED_BY_OIDADDR
See Also:
Constant Field Values

XML_FLEXIBLE_VERSIONING_INFO

public static final String XML_FLEXIBLE_VERSIONING_INFO
See Also:
Constant Field Values

XML_PREDECCESOR_BRANCH_POINT_UFID

public static final String XML_PREDECCESOR_BRANCH_POINT_UFID
See Also:
Constant Field Values

XML_MERGE_INWARDS_UFID

public static final String XML_MERGE_INWARDS_UFID
See Also:
Constant Field Values

XML_MERGE_OUTWARDS_UFID

public static final String XML_MERGE_OUTWARDS_UFID
See Also:
Constant Field Values

XML_OBJECT_HISTORY

public static final String XML_OBJECT_HISTORY
See Also:
Constant Field Values

XML_LC_HISTORY

public static final String XML_LC_HISTORY
See Also:
Constant Field Values

XML_LC_ACTION

public static final String XML_LC_ACTION
See Also:
Constant Field Values

XML_LC_ACTOR_NAME

public static final String XML_LC_ACTOR_NAME
See Also:
Constant Field Values

XML_LC_NAME

public static final String XML_LC_NAME
See Also:
Constant Field Values

XML_LC_PHASE_NAME

public static final String XML_LC_PHASE_NAME
See Also:
Constant Field Values

XML_LC_STATE

public static final String XML_LC_STATE
See Also:
Constant Field Values

XML_LC_TEAM_ID

public static final String XML_LC_TEAM_ID
See Also:
Constant Field Values

XML_LC_HISTORY_CREATEDATE

public static final String XML_LC_HISTORY_CREATEDATE
See Also:
Constant Field Values

XML_LC_HISTORY_MODIFYDATE

public static final String XML_LC_HISTORY_MODIFYDATE
See Also:
Constant Field Values

XML_LC_SIGNATURE

public static final String XML_LC_SIGNATURE
See Also:
Constant Field Values

XML_LC_COMMENTS

public static final String XML_LC_COMMENTS
See Also:
Constant Field Values

XML_LC_SIGNATURE_PHASE

public static final String XML_LC_SIGNATURE_PHASE
See Also:
Constant Field Values

XML_LC_ROLE_NAME

public static final String XML_LC_ROLE_NAME
See Also:
Constant Field Values

XML_LC_SIGNER_NAME

public static final String XML_LC_SIGNER_NAME
See Also:
Constant Field Values

XML_LC_SIGNER

public static final String XML_LC_SIGNER
See Also:
Constant Field Values

XML_LC_VOTE

public static final String XML_LC_VOTE
See Also:
Constant Field Values

XML_LC_SIGNATURE_CREATEDDATE

public static final String XML_LC_SIGNATURE_CREATEDDATE
See Also:
Constant Field Values

XML_LC_SIGNATURE_MODIFYDATE

public static final String XML_LC_SIGNATURE_MODIFYDATE
See Also:
Constant Field Values

XML_LC_CRITERION

public static final String XML_LC_CRITERION
See Also:
Constant Field Values

XML_LC_ASSERTION

public static final String XML_LC_ASSERTION
See Also:
Constant Field Values

XML_LC_SATISFIED

public static final String XML_LC_SATISFIED
See Also:
Constant Field Values

XML_LC_CRITERION_CREATEDDATE

public static final String XML_LC_CRITERION_CREATEDDATE
See Also:
Constant Field Values

XML_LC_CRITERION_MODIFYDATE

public static final String XML_LC_CRITERION_MODIFYDATE
See Also:
Constant Field Values

XML_TAG_RELATIONSHIP_MAP

public static final String XML_TAG_RELATIONSHIP_MAP
See Also:
Constant Field Values

XML_TAG_BASE_CRITERION_DEF

public static final String XML_TAG_BASE_CRITERION_DEF
See Also:
Constant Field Values

XML_TAG_COLLECTION_CRITERIA

public static final String XML_TAG_COLLECTION_CRITERIA
See Also:
Constant Field Values

XML_TAG_CRITERION_DEF_VALID_WITH

public static final String XML_TAG_CRITERION_DEF_VALID_WITH
See Also:
Constant Field Values

XML_TAG_RELATIONSHIP_MAP_DEF

public static final String XML_TAG_RELATIONSHIP_MAP_DEF
See Also:
Constant Field Values

IMPORT_PRIORITY_COLLECTION_UNITS

public static final int IMPORT_PRIORITY_COLLECTION_UNITS
See Also:
Constant Field Values

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

RF

private static final ReferenceFactory RF
Constructor Detail

ArchiveHndHelper

public ArchiveHndHelper()
Method Detail

archiveCreateRecord

public static final void archiveCreateRecord(Object o,
                                             IxbElement fileXml,
                                             Exporter exporter)
                                      throws WTException

Archives the createRecord to xml.

The context object must be Iterated and Ownable.

Parameters:
o - the context object
fileXml - the xml
exporter - the exporter
Throws:
WTException

restoreCreateRecord

public static final Object restoreCreateRecord(Object o,
                                               IxbElement fileXml,
                                               Importer importer)
                                        throws WTException

Restores the createRecord and object id from xml.

This method must be called before the object is persisted. The context object must be Iterated and Ownable.

Parameters:
o - the context object
fileXml - the xml
importer - the importer
Returns:
Throws:
WTException

restoreObjectId

public static final Object restoreObjectId(Object o,
                                           IxbElement fileXml,
                                           Importer importer)
                                    throws WTException

Restores object id from xml file.

For object classes that have archived createRecord in xml file (mainly business classes such as EPMDocument, WTPart, WTDocument), it is not necessary to call this method, because it has already been called from within restoreCreateRecord method.

This method must be called before the object is persisted, exception will be thrown otherwise. The context object must be Persistable.

Parameters:
o - the context object
fileXml - the xml
importer - the importer
Returns:
Throws:
WTException

findAmongExistingObjectsForRestore

public static final Object findAmongExistingObjectsForRestore(IxbElement fileXml,
                                                              Importer importer)
                                                       throws WTException
Implements a standard way to find from existing windchill database an object that matches the IxbHndHelper.XML_ATTR_LOCAL_ID element in the archived xml file.

The assumption is that it runs on the same system where the xml backup was made. This method should not be used in export/import context.

.

Parameters:
fileXml -
importer -
Returns:
Throws:
WTException

archiveFlexibleVersioningInfo

public static final void archiveFlexibleVersioningInfo(Object o,
                                                       IxbElement fileXml,
                                                       Exporter exporter)
                                                throws WTException

Archives the flexibleVersioningInfo to xml.

The context object must be Iterated and Federatable.

Parameters:
o - the context object
fileXml - the xml
exporter - the exporter
Throws:
WTException

stringToUfid

public static Ufid stringToUfid(String ufidString)
                         throws WTException
Converts string to ufid

Throws:
WTException

addOidForReuse

public static void addOidForReuse(Transaction transaction,
                                  ObjectIdentifier oid)
                           throws WTException
Adds an oid to transaction map for restore

Parameters:
oid - the object identifier to be reused
Throws:
WTException

getXmlElementValue

private static String getXmlElementValue(IxbElement fileXml,
                                         String xmlTag,
                                         boolean isElementOptional)
                                  throws WTException
Obtains xml element value.

Parameters:
fileXml - the XML
xmlTag - the tag name of the xml element
Returns:
xml element value
Throws:
WTException - if the xml element cannot be found and it is not optional

isADn

private static boolean isADn(String user)

getXmlElementValue

private static String getXmlElementValue(IxbElement fileXml,
                                         String xmlTag)
                                  throws WTException
Obtains xml element value.

Parameters:
fileXml -
xmlTag -
Returns:
xml element value
Throws:
WTException - if the xml element cannot be found