com.ptc.windchill.esi.txn
Class ESITransactionUtility

java.lang.Object
  extended bycom.ptc.windchill.esi.txn.ESITransactionUtility
All Implemented Interfaces:
Externalizable, Serializable

public final class ESITransactionUtility
extends Object
implements Externalizable

Provides common services which are not intended to be available to remote consumers. This class is not thread-safe. A separate instance must be created if multiple threads are to use the services of the class.

Supported API: true

Extendable: false

See Also:
Serialized Form

Field Summary
static boolean autofailLineNumbers
           
private static boolean checkIterations
           
private static String CLASSNAME
           
private  Transaction dbTransaction
           
private static String DEFAULT_ADMIN_USER
           
private static int EVENT_MESSAGE_LENGTH
           
static long EXTERNALIZATION_VERSION_UID
           
private static boolean isFailureLoggingSuppressed
           
private static boolean isSuccessLoggingSuppressed
           
private static String NULL_STRING
           
protected static long OLD_FORMAT_VERSION_UID
           
(package private) static String PART_RELEASE_CLASS
           
static String REFERENCE_LINK_RA_CLASS
           
private static String RELEASE_ACTIVITIES_MAP_NAME
           
private static String RELEASE_ACTIVITIES_MESSAGE_MAP_NAME
           
(package private) static String RELEASE_ACTIVITY
           
private static String RESOURCE
           
private static int RESULT_MESSAGE_LENGTH
           
private static String SEPARATOR_STRING
           
(package private) static long serialVersionUID
           
private static String STANDARD_RELEASE_CLASS
           
private static int SYNCH_ID
           
private static String TARGET_HISTORY_MAP_NAME
           
private  ESITargetUtility targetUtility
           
private  TaskHelper taskHelper
           
private static String TRANSACTION_MESSAGE_MAP_NAME
           
private static boolean TRUNCATE_EXCESS_MESSAGE_TEXT
           
private static int VECTOR_SIZE_MULTIPLIER
           
private static String XML_META_NAME
           
 
Constructor Summary
ESITransactionUtility()
           
 
Method Summary
 void abortTransaction(Persistable obj)
          Remove a transaction.
private  void addPartMastersToQuery(QuerySpec qs, Collection masters, int pmIndex, Class partMasterClass)
           
 void addTransactionMessage(ESITransaction txn, String text, boolean txnRequired)
          Adds a message to an ESITransaction.
private  void addTxnsForObjectsToVector(Vector v, Vector qr)
           
private  void addTxnsToVector(Vector v, QueryResult qr)
           
private  void addUniqueTransactions(Group g, Vector v)
           
 void adjustTargetAssignments(String ufids, Group targetInfo)
          Given a concatenated set of UFIDs (for WTParts) and a Collection of ESITarget UFIDs, make (or remove) any required assignments.
static boolean checkReleaseActivity(Persistable obj, ESITarget target, String status, String action)
           
private  boolean checkTx(Persistable obj, String status)
           
 void commitDbTransaction()
           
 void createReleaseActivity(Persistable persistable, String description, ESITransaction transaction, boolean successful, ESITarget target, String message, String timestamp, String action, String cls, String user)
          Create and save a new ReleaseActivity from the arguments

Supported API: true
private  void createReleaseActivity(Persistable persistable, String description, ESITransaction transaction, boolean successful, ESITarget target, String message, String timestamp, String action, String cls, String user, boolean isTransactionRequired, boolean isWarning)
           
private static void createSynchObject()
           
 ESITransaction createTransaction(Persistable object)
          Creates a new ESITransaction that is associated to the argument.
 ESITransaction createTransaction(Persistable object, String userName)
          Creates a new ESITransaction that is associated to the argument.
 void createWarning(Collection warningAssns, String txnID)
          ESIWarningSubTxnRequest Create a ReleaseActivity with status = Warning for each of the object - target pairs ESIWarningSubTxnRequest objects) in the warningAssns argument.
protected  String decodeUser(String userIn)
           
 void deleteTargetAssociation(ESITargetAssignmentLink link)
          Removes the argument from the database.
 void deleteTargetAssociation(Group links)
          Deletes from the database the ESITargetAssignmentLink objects that are identified by the argument.
private  QueryResult findAbortedTx(ESITransaction tx)
           
private  Vector findLatestReleaseBOMParts(Collection tgtAssns, Collection parts)
           
private  Vector findLatestReleaseParts(Collection tgtAssns, Collection parts)
           
 QueryResult findTransactions(Persistable obj)
          Returns all ESITransactions for the given object.
 QueryResult findTransactions(Persistable obj, String status)
          Returns ESITransactions for the given object and status.
private  Vector findTransactionsForAssociatedObjects(Persistable obj)
           
private  QueryResult findTransactionsForReleasedObjects(Persistable obj)
           
private  void fixReleaseElement(Element elem, ReleaseActivity ra)
           
private  ReleaseActivityAction getActionCode(String action)
           
 Collection getActivities(Persistable object)
          This method will return a Collection of ReleaseActivities that are associated with the persisable object.
 Collection getActivities(String ufid)
          Returns the ReleaseActivities associated with the ESITransaction identified by the UFID in the argument.
private  ReleaseActivityMessage getActivitiesMessage(String ufid)
           
 Collection getAllActivities(Persistable object)
          This method will return a Collection of ReleaseActivities that are associated with the persisable object.
private  Vector getAssociationsFromFromGroup(Group links)
           
 Collection getBOMActivities(Collection parts)
          Given a collection of parts returns a collection of ReleaseActivity objects where the release activity represents a BOM, for any iterations of the part's part master.
private  Class getClassFromObjects(Collection collection)
           
 WTDocument getCurrentDocument(WTDocumentMaster master)
           
private  ReleaseActivity getLatestActivityForEffectivity(Eff[] effs, ESITarget target)
           
 Collection getLatestUnreleasedDocuments(Collection docs, Collection targets)
          Given a collection of WTDocuments and targets this method returns a collection of ESITargetAssocations for documents that have not been exported to that target.
(package private)  int getMaxTransactionNumber()
          Finds the maximum value for transaction number in the database.
private  Class getPersistableClassFromTargetAssociations(Collection collection)
           
 Collection getRelatedTransactions(ESITransaction txn)
          Returns all transactions that are related to the argument of the method.
 Group getReleaseActivities(String ufid)
          Returns an Info*Engine Group of mapped ReleaseActivity objects given the ufid of the ESITransaction object.
 Group getReleaseActivitiesMessage(String ufid)
          Returns an Info*Engine Group of mapped ReleaseActivityMessage object given the ufid of the ReleaseActivity object.
private static Persistable getSynchObject()
           
private  Class getTargetClassFromTargetAssociations(Collection collection)
           
private  Collection getTargetHistories(Collection objects)
           
 Group getTargetsWithHistory(Collection objects)
          Returns an Info*Engine Group of mapped ESITargetHistory objects.
 Collection getTargetsWithHistory(Persistable object)
          Returns a Collection of ESITargetHistory objects.
private  ESITargetUtility getTargetUtility()
           
 ESITransaction getTransaction(String number)
          Return the ESITransaction object whose number matches the method argument.
 Collection getTransactionActivities(String id)
          Return a collection ReleaseActivities associated with the ESITransaction identified by the argument.
 Group getTransactionLogMessage(String ufid)
          Returns an Info*Engine Group of mapped ESITransactionMessage object given the ufid of the ESITransaction object.
 Group getTransactions(Group ufids)
          Returns an Info*Engine Group of ESITransaction objects that are associated with the objects in the argument.
private  ESITransactionMessage getTransactionsMessage(String ufid)
           
 String getTransactionUfid(String tx_number)
          Returns UFID of ESITransaction
private  Collection getUniqueMastersFromParts(Collection parts)
           
private  Collection getUniqueMastersFromTargetAssociations(Collection parts)
           
 boolean hasReleased(Persistable obj)
          Check if the given object has been released successfully.
 boolean hasReleased(Persistable obj, ESITarget target)
          Check if the object has been released successfully for the given target.
 boolean hasTxFailed(Persistable obj)
          Returns true if find a related transaction failed for a given object, otherwise return false.
 boolean hasTxSucceed(Persistable obj)
          Returns true if find a transaction is SUCCEED for the given object, otherwise returns false.
private  boolean hasWarningMessages(String txnID)
           
 void hideTransaction(String ufid)
          Hide an ESITransaction from the user interface.
private  boolean isBOMRelease(Persistable part, String cls)
           
 boolean isInRelease(Persistable obj)
          This is to check if the releasable object is in ESI release .
private  boolean isIterationInRelease(Master master)
           
 boolean isNewerThan(Versioned v1, Versioned v2)
           
private  boolean isObjInRelease(Persistable obj)
           
 boolean isPartNewerThan(WTPart current, WTPart other)
          This method checks two different part versions and returns true if the current iteration is newer than the other version.
 boolean isPartReleaseNeeded(Collection assns)
          Given a collection of ESITargetAssociations, returns true if any of the persistable objects have not been published to the ESI target identified in the target association.
private  boolean isReleaseBlocked(ESITransactionObjectLink link)
           
private  boolean isReleaseBlocked(Persistable object, ESITarget target)
           
static boolean isReleaseFailedChange(Persistable obj, ESITarget target)
           
private  boolean isRequestedTarget(ESITargetAssociation assn, Collection assns)
           
 boolean isTxnPending(Persistable object)
          Determines whether a transaction containing the argument is already active.
 boolean isTxPending(Persistable obj)
          Returns true if ESI transaction for the given object is in pending status, otherwise return false.
 boolean isTxProcessing(Persistable obj)
          Returns true if the ESI transaction is in processing for the given object, otherwise return false.
 Collection latestBOMExport(Collection parts)
           
 Eff latestEffExport(EffManagedVersion part, ESITarget target)
          Returns the last exported Eff for the supplied part and target.
 Collection latestExport(Collection targetAssociations)
          This method will return a collection of latest exported objects.
 Collection latestPartExport(Collection parts)
          Returns a collection of ESITargetAssociations

Supported API: true
private static void lockSynchObject()
           
private  void mapReleaseActivities(Collection collection, Group grp)
           
private  void mapReleaseActivitiesMessage(ReleaseActivityMessage activiyMessage, Group grp)
           
private  void mapTargetHistory(Collection collection, Group grp)
           
private  void mapTransactionMessage(ESITransactionMessage transactionMessage, Group grp)
           
 void markPending(Collection tgtAssns, String txnID)
          Create a ReleaseActivity with status = PENDING for each of the object - target pairs (ESIPendingTxnRequest objects) in the tgtAssns argument.
static void performStartupProcess()
          Performs the necessary startup logic for the Transaction Utility.
 void postEvent(String objectID, String transaction, boolean isSuccessful, String message)
          Process postEvent RPC requests

Supported API: true
 void postResult(String objectID, String description, String txnID, boolean isSuccessful, boolean isSubtran, String targetSystem, String message, String timestamp, String action, String cls, String user)
          Process postResult RPC requests

Supported API: true
private  void postResultSubtransaction(ESITransaction transaction, String objectID, String description, String message, String timestamp, String action, String cls, String user, boolean isSuccessful, String targetSystem)
           
private  void postResultTransaction(ESITransaction transaction, String timestamp, boolean isSuccessful, String msg)
           
private  void purgePending(Persistable p, ESITarget tgt, String cls)
           
 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(ESITransactionUtility thisObject, ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source.
 void recordExport(Persistable obj, ESITarget org, String releaseClass)
          Mark a persistable as exported to an organization

Supported API: true
 void removePending(ESITransaction txn)
          Deletes all ReleaseActivities that have a status of PENDING and are associated with the argument.
The method does not create a database transaction.
 void removePending(ESITransaction txn, boolean txnNeeded)
           
 void removeTransactionMessage(ESITransaction txn)
          Removes any ESITransactionMessage that is associated with an ESITransaction.
private  QueryResult retrieveIterations(Class iterationClass, Master master)
           
 void rollbackDbTransaction()
           
 void startDbTransaction()
           
(package private)  void updateTransaction(ESITransaction txn)
          Save a transaction in the database

Supported API: true
 void validateDelete(ESITarget tgt)
          Deprecated.  
 void validateDelete(ESITransaction txn)
          Deprecated.  
 void validateDelete(WTPart part)
          Deprecated at X05/R8.0, replaced by by calling isInRelease and referential integrity exception delegate.
 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

REFERENCE_LINK_RA_CLASS

public static final String REFERENCE_LINK_RA_CLASS
See Also:
Constant Field Values

autofailLineNumbers

public static final boolean autofailLineNumbers

EVENT_MESSAGE_LENGTH

private static final int EVENT_MESSAGE_LENGTH
See Also:
Constant Field Values

RESULT_MESSAGE_LENGTH

private static final int RESULT_MESSAGE_LENGTH
See Also:
Constant Field Values

NULL_STRING

private static final String NULL_STRING
See Also:
Constant Field Values

SEPARATOR_STRING

private static final String SEPARATOR_STRING
See Also:
Constant Field Values

STANDARD_RELEASE_CLASS

private static final String STANDARD_RELEASE_CLASS

isSuccessLoggingSuppressed

private static boolean isSuccessLoggingSuppressed

isFailureLoggingSuppressed

private static boolean isFailureLoggingSuppressed

targetUtility

private ESITargetUtility targetUtility

taskHelper

private TaskHelper taskHelper

dbTransaction

private Transaction dbTransaction

VECTOR_SIZE_MULTIPLIER

private static final int VECTOR_SIZE_MULTIPLIER

XML_META_NAME

private static final String XML_META_NAME
See Also:
Constant Field Values

TARGET_HISTORY_MAP_NAME

private static final String TARGET_HISTORY_MAP_NAME

RELEASE_ACTIVITIES_MAP_NAME

private static final String RELEASE_ACTIVITIES_MAP_NAME

RELEASE_ACTIVITIES_MESSAGE_MAP_NAME

private static final String RELEASE_ACTIVITIES_MESSAGE_MAP_NAME

TRANSACTION_MESSAGE_MAP_NAME

private static final String TRANSACTION_MESSAGE_MAP_NAME

DEFAULT_ADMIN_USER

private static final String DEFAULT_ADMIN_USER

TRUNCATE_EXCESS_MESSAGE_TEXT

private static boolean TRUNCATE_EXCESS_MESSAGE_TEXT

checkIterations

private static boolean checkIterations

SYNCH_ID

private static int SYNCH_ID

RELEASE_ACTIVITY

static final String RELEASE_ACTIVITY

PART_RELEASE_CLASS

static final String PART_RELEASE_CLASS
Constructor Detail

ESITransactionUtility

public ESITransactionUtility()
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(ESITransactionUtility 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

abortTransaction

public final void abortTransaction(Persistable obj)
Remove a transaction.

Note : This method can ONLY be called on ESI workflow if any system errors (e.g. JMS server not available ) occured during release, means that unable to send messages to com.ptc.windchill.esi.Event queue.

Supported API: true

Parameters:
obj -

addTransactionMessage

public final void addTransactionMessage(ESITransaction txn,
                                        String text,
                                        boolean txnRequired)
                                 throws WTException
Adds a message to an ESITransaction. If the transaction already had a message, the old one is replaced by the new message. This results in multiple database activities which should be wrapped in a database transaction. If caller has started a transaction, pass false in the txnRequired argument, otherwise pass true in the argument.

Supported API: true

Parameters:
txn - The transaction to which an message is to be added.
text - The text of the message to add.
txnRequired - Should this request be wrapped in a database transaction. Should be false if caller has started a transaction.
Throws:
WTException

adjustTargetAssignments

public final void adjustTargetAssignments(String ufids,
                                          Group targetInfo)
                                   throws WTException
Given a concatenated set of UFIDs (for WTParts) and a Collection of ESITarget UFIDs, make (or remove) any required assignments. Once this method determines that there are no deletion requests for already-published targets, all work is delegated to an instance of ESITargetUtilty.

Supported API: true

Parameters:
ufids - A concatenated list of UFIDs of the objects to operate on.
targetInfo - A collection of Info*Engine elements containing the UFIDs of the ESITargets to assign/remove and the operation to perform.
Throws:
WTException

createReleaseActivity

public final void createReleaseActivity(Persistable persistable,
                                        String description,
                                        ESITransaction transaction,
                                        boolean successful,
                                        ESITarget target,
                                        String message,
                                        String timestamp,
                                        String action,
                                        String cls,
                                        String user)
                                 throws WTException
Create and save a new ReleaseActivity from the arguments

Supported API: true

Parameters:
persistable - The object being flagged as released
description - A textual description of the release type
transaction - The transaction associated with this activity.
successful - Was the transaction successful?
target - The destination where this object was released
message - An optional message to associate with the ReleaseActivity
timestamp - The time when the ReleaseActivity occurred. Must resolve to a java.sql.TimeStamp. If it doesn't the current time will be used.
action - must be "create", "change", or "delete" (case insensitive)
cls - The ESI logical class of the object being flagged
user - The user who requested the activity
Throws:
WTException

createTransaction

public final ESITransaction createTransaction(Persistable object)
                                       throws WTException
Creates a new ESITransaction that is associated to the argument. Persists the transaction and the relationship.

Supported API: true

Parameters:
object - The object that is to be associated with the ESITransaction.
Returns:
ESITransaction
Throws:
WTException

createTransaction

public final ESITransaction createTransaction(Persistable object,
                                              String userName)
                                       throws WTException
Creates a new ESITransaction that is associated to the argument. Persists the transaction and the relationship.

Supported API: true

Parameters:
object - The object that is to be associated with the ESITransaction.
userName - The name of the user responsible for initiating the transaction.
Returns:
ESITransaction
Throws:
WTException

createWarning

public void createWarning(Collection warningAssns,
                          String txnID)
                   throws WTException
ESIWarningSubTxnRequest Create a ReleaseActivity with status = Warning for each of the object - target pairs ESIWarningSubTxnRequest objects) in the warningAssns argument. Associate the ReleaseActivity objects with the ESITransaction whose idNumber attribute is equal to the value of the txnID argument. Enclose all database requests in a database transaction so that if anything fails the entire request is rolled back.

Supported API: false

Parameters:
warningAssns -
txnID -
Throws:
WTException

deleteTargetAssociation

public final void deleteTargetAssociation(ESITargetAssignmentLink link)
                                   throws WTException
Removes the argument from the database. Ensures that the target has not already been published before allowing the deletion to occur.

Supported API: true

Parameters:
link - The ESITargetAssignmentLink that is to be deleted.
Throws:
WTException

deleteTargetAssociation

public final void deleteTargetAssociation(Group links)
                                   throws WTException
Deletes from the database the ESITargetAssignmentLink objects that are identified by the argument. Delegates all work to an instance of ESITransactionUtility. Uses a database transaction so that all objects are deleted or none of them are.

Supported API: true

Parameters:
links - An Info*Engine group of Element objects. Each element has an Att object that contains the UFID of an ESITargetAssignmentLink that is to be deleted.
Throws:
WTException

findTransactions

public final QueryResult findTransactions(Persistable obj)
                                   throws ESIException
Returns all ESITransactions for the given object.

Supported API: true

Parameters:
obj -
Returns:
QueryResult
Throws:
ESIException

findTransactions

public final QueryResult findTransactions(Persistable obj,
                                          String status)
                                   throws ESIException
Returns ESITransactions for the given object and status.

Supported API: true

Parameters:
obj -
status -
Returns:
QueryResult
Throws:
ESIException

getActivities

public final Collection getActivities(String ufid)
                               throws WTException
Returns the ReleaseActivities associated with the ESITransaction identified by the UFID in the argument.

Supported API: true

Parameters:
ufid - The UFID of an ESITransaction.
Returns:
Collection
Throws:
WTException

getActivities

public final Collection getActivities(Persistable object)
                               throws WTException
This method will return a Collection of ReleaseActivities that are associated with the persisable object. Only release activities that are Pending or Successful are returned.

Supported API: true

Parameters:
object - Persistable object whose history is to be retrieved.
Returns:
Collection
Throws:
WTException

getAllActivities

public final Collection getAllActivities(Persistable object)
                                  throws WTException
This method will return a Collection of ReleaseActivities that are associated with the persisable object.

Supported API: true

Parameters:
object - Persistable object whose history is to be retrieved.
Returns:
Collection
Throws:
WTException

getBOMActivities

public final Collection getBOMActivities(Collection parts)
                                  throws WTException
Given a collection of parts returns a collection of ReleaseActivity objects where the release activity represents a BOM, for any iterations of the part's part master. Find the part master associated with the part in the argument. Find all iterations of the master. If any of those iterations has a successful ReleaseActivity that has a releaseClass indicating it is a BOM, add it to the result.

Supported API: true

Parameters:
parts - A collection of WTPart instances to examine.
Returns:
Collection
Throws:
WTException

getLatestUnreleasedDocuments

public final Collection getLatestUnreleasedDocuments(Collection docs,
                                                     Collection targets)
                                              throws WTException
Given a collection of WTDocuments and targets this method returns a collection of ESITargetAssocations for documents that have not been exported to that target. The returned target association persistable objects are the highest version.iteration associated with an ESITarget. In other words, it is the last object that was released to the target. The objects in the request class must all be members of the same class.

Supported API: true

Parameters:
docs - This is a collection of WTDocuments. The persistables must all be objects of the same class.
targets - Collection of ESITargets associated with the documents.
Returns:
Collection
Throws:
WTException

getMaxTransactionNumber

final int getMaxTransactionNumber()
                           throws WTException
Finds the maximum value for transaction number in the database.

Supported API: true

Returns:
int
Throws:
WTException

getRelatedTransactions

public final Collection getRelatedTransactions(ESITransaction txn)
                                        throws WTException
Returns all transactions that are related to the argument of the method. This method is not implemented for ESI 7.0

Supported API: false

Parameters:
txn -
Returns:
Collection
Throws:
WTException

getReleaseActivities

public final Group getReleaseActivities(String ufid)
                                 throws WTException
Returns an Info*Engine Group of mapped ReleaseActivity objects given the ufid of the ESITransaction object.

Supported API: true

Parameters:
ufid - The ufid of the ESITransaction object.
Returns:
Group
Throws:
WTException

getReleaseActivitiesMessage

public final Group getReleaseActivitiesMessage(String ufid)
                                        throws WTException
Returns an Info*Engine Group of mapped ReleaseActivityMessage object given the ufid of the ReleaseActivity object.

Supported API: true

Parameters:
ufid - ufid of the ReleaseActivity object.
Returns:
Group
Throws:
WTException

getTargetsWithHistory

public final Group getTargetsWithHistory(Collection objects)
                                  throws WTException
Returns an Info*Engine Group of mapped ESITargetHistory objects. The ESITargetHistory objects contain the following
The result will be serialized by the ESI mapping service to a group of Info*Engine Element objects.

Supported API: true

Parameters:
objects - A collection of persistable objects. The objects must all be instances of the same class.
Returns:
Group
Throws:
WTException

getTargetsWithHistory

public final Collection getTargetsWithHistory(Persistable object)
                                       throws WTException
Returns a Collection of ESITargetHistory objects. The ESITargetHistory objects contain the following

Supported API: true

Parameters:
object - The Persistable whose target assignments are to be queried.
Returns:
Collection
Throws:
WTException

getTransaction

public final ESITransaction getTransaction(String number)
                                    throws WTException
Return the ESITransaction object whose number matches the method argument. Throw an ESIException if no entry is found.

Supported API: true

Parameters:
number - The transaction number of the desired ESITransaction object.
Returns:
ESITransaction
Throws:
WTException

getTransactions

public final Group getTransactions(Group ufids)
                            throws WTException
Returns an Info*Engine Group of ESITransaction objects that are associated with the objects in the argument. The argument is an Info*Engine Group containing Elements that have been created by (or resemble the output of) a Query-Objects webject.

Supported API: true

Parameters:
ufids - An Info*Engine Group containing Elements that have been create by (or resemble the output of) a Query-Objects webject.
Returns:
Group
Throws:
WTException

getTransactionActivities

public final Collection getTransactionActivities(String id)
                                          throws WTException
Return a collection ReleaseActivities associated with the ESITransaction identified by the argument. If no such transaction, throw an ESIException.

Supported API: true

Parameters:
id - the id of the transaction of interest.
Returns:
Collection
Throws:
WTException

getTransactionLogMessage

public final Group getTransactionLogMessage(String ufid)
                                     throws WTException
Returns an Info*Engine Group of mapped ESITransactionMessage object given the ufid of the ESITransaction object.

Supported API: true

Parameters:
ufid - ufid of the ESITransaction object.
Returns:
Group
Throws:
WTException

hasReleased

public final boolean hasReleased(Persistable obj,
                                 ESITarget target)
                          throws ESIException
Check if the object has been released successfully for the given target.

Supported API: true

Parameters:
obj -
target -
Returns:
boolean
Throws:
ESIException

hasTxFailed

public final boolean hasTxFailed(Persistable obj)
                          throws ESIException
Returns true if find a related transaction failed for a given object, otherwise return false.

Supported API: true

Parameters:
obj -
Returns:
boolean
Throws:
ESIException

hasTxSucceed

public final boolean hasTxSucceed(Persistable obj)
                           throws ESIException
Returns true if find a transaction is SUCCEED for the given object, otherwise returns false.

Supported API: true

Parameters:
obj -
Returns:
boolean
Throws:
ESIException

hideTransaction

public final void hideTransaction(String ufid)
                           throws WTException
Hide an ESITransaction from the user interface.

Supported API: true

Parameters:
ufid -
Throws:
WTException

isInRelease

public boolean isInRelease(Persistable obj)
                    throws ESIException
This is to check if the releasable object is in ESI release . Returns true if the transaction or release activity has been created for the given releasable object or any releasable iteration for the given master, regarding less the targets and the status. Otherwise returns false.

Supported API: true

Parameters:
obj - The persistable object.
Returns:
boolean
Throws:
ESIException

isPartNewerThan

public final boolean isPartNewerThan(WTPart current,
                                     WTPart other)
This method checks two different part versions and returns true if the current iteration is newer than the other version. if the esi property enableCheckForPartIteration is set to true then part iterations are also checked.

Supported API: true

Parameters:
current - current part iteration to test
other - previous part iteration.
Returns:
boolean

isPartReleaseNeeded

public final boolean isPartReleaseNeeded(Collection assns)
                                  throws WTException
Given a collection of ESITargetAssociations, returns true if any of the persistable objects have not been published to the ESI target identified in the target association.

Supported API: true

Parameters:
assns - A Collection of ESITargetAssociations.
Returns:
boolean
Throws:
WTException

isTxPending

public final boolean isTxPending(Persistable obj)
                          throws ESIException
Returns true if ESI transaction for the given object is in pending status, otherwise return false.

Supported API: true

Parameters:
obj -
Returns:
boolean
Throws:
ESIException

isTxnPending

public final boolean isTxnPending(Persistable object)
                           throws WTException
Determines whether a transaction containing the argument is already active. Will return true if the object is associated to a transaction whose status is PROCESSING or PENDING.

Supported API: true

Parameters:
object - The object of interest
Returns:
boolean
Throws:
WTException

isTxProcessing

public final boolean isTxProcessing(Persistable obj)
                             throws ESIException
Returns true if the ESI transaction is in processing for the given object, otherwise return false.

Supported API: true

Parameters:
obj -
Returns:
boolean
Throws:
ESIException

latestEffExport

public Eff latestEffExport(EffManagedVersion part,
                           ESITarget target)
                    throws WTException
Returns the last exported Eff for the supplied part and target. The last exported may either be pending or successful in its release status.

Supported API: false

Parameters:
part - The part iteration for which effectivity is defined.
target - The ERP target system.
Returns:
Eff
Throws:
WTException

latestExport

public final Collection latestExport(Collection targetAssociations)
                              throws WTException
This method will return a collection of latest exported objects. It is not implemented for ESI 7.0

Supported API: false

Parameters:
targetAssociations -
Returns:
Collection
Throws:
WTException

latestPartExport

public final Collection latestPartExport(Collection parts)
                                  throws WTException
Returns a collection of ESITargetAssociations

Supported API: true

Parameters:
parts - A collection of ESITargetAssociations with WTParts as the pesistable object.
Returns:
Collection
Throws:
WTException

markPending

public void markPending(Collection tgtAssns,
                        String txnID)
                 throws WTException
Create a ReleaseActivity with status = PENDING for each of the object - target pairs (ESIPendingTxnRequest objects) in the tgtAssns argument. Associate the ReleaseActivity objects with the ESITransaction whose idNumber attribute is equal to the value of the txnID argument. Enclose all database requests in a database transaction so that if anything fails the entire request is rolled back.

Supported API: false

Parameters:
tgtAssns - A collection of ESITargetAssociations
txnID - The id of the ESITransaction that is to be associated to the ReleaseActivity objects that are created by this method.
Throws:
WTException

performStartupProcess

public static void performStartupProcess()
                                  throws WTException
Performs the necessary startup logic for the Transaction Utility. Should be called upon method server startup.

Supported API: true

Throws:
WTException

postEvent

public final void postEvent(String objectID,
                            String transaction,
                            boolean isSuccessful,
                            String message)
                     throws WTException
Process postEvent RPC requests

Supported API: true

Parameters:
objectID - The object which is associated with the Windchill event that this RPC will create. It is expected to be the value supplied in the that is provided in the ESIEvent that intiates the transaction.
transaction - The transaction number that is associated with this event
isSuccessful - Did the request succeed?
message - An optional message to pass to the Windchill workflow that is suspended and waiting for this event.
Throws:
WTException

postResult

public final void postResult(String objectID,
                             String description,
                             String txnID,
                             boolean isSuccessful,
                             boolean isSubtran,
                             String targetSystem,
                             String message,
                             String timestamp,
                             String action,
                             String cls,
                             String user)
                      throws WTException
Process postResult RPC requests

Supported API: true

Parameters:
objectID - The UFID of the object being tracked
description - A user-friendly description of the object
txnID - The transaction number related to this request
isSuccessful - Did the request succeed?
isSubtran - If false, this is the end of the transaction messages. If true, it is a transaction line item.
targetSystem - The ESITarget system id associated with this request.
message - An optional textual description. Generally used for error messages, but not restricted to errors.
timestamp - Optional parameter. If supplied must be a string that can be converted to a java.sql.timestamp.
action - The action that was requested. Must be one of the values defined by ReleaseActivityAction.
cls - The ESI logical class of the object being tracked. This value came from the ESI RPC response that generated the ESI transaction.
user - The user who requested the transaction.
Throws:
WTException

recordExport

public final void recordExport(Persistable obj,
                               ESITarget org,
                               String releaseClass)
                        throws WTException
Mark a persistable as exported to an organization

Supported API: true

Parameters:
obj - the object being flagged
org - The ESIOrganization which received the object
releaseClass - the type of release activity.
Throws:
WTException

removePending

public final void removePending(ESITransaction txn)
                         throws WTException
Deletes all ReleaseActivities that have a status of PENDING and are associated with the argument.
The method does not create a database transaction. It is assumed that this operation will be performed as part of a larger database request.

Supported API: true

Parameters:
txn - The ESITranaction that has completed.
Throws:
WTException

removeTransactionMessage

public final void removeTransactionMessage(ESITransaction txn)
                                    throws WTException
Removes any ESITransactionMessage that is associated with an ESITransaction.

Supported API: true

Parameters:
txn - The transaction from which all messages are to be removed.
Throws:
WTException

updateTransaction

final void updateTransaction(ESITransaction txn)
                      throws WTException
Save a transaction in the database

Supported API: true

Parameters:
txn - The transaction to be saved
Throws:
WTException

validateDelete

public final void validateDelete(ESITarget tgt)
                          throws WTException
Deprecated.  

Deprecated at X05/R8.0, replaced by Referential Integrity exception delegate. Throws an exception if the argument is not eligible to be deleted. Examines ESI properties to determine whether or not to check ReleaseActivities. If the check is to be made, the method throws a WTException if the argument is associated to one or more ReleaseActivity (or ESIProperties-designated subclass) objects. If no exception, the method calls ESITargetUtility to perform additional checks.



Supported API: false

Parameters:
tgt - The ESI target whose associations are to be checked.
Throws:
WTException

validateDelete

public final void validateDelete(ESITransaction txn)
                          throws WTException
Deprecated.  

Deprecated at X05/R8.0 , replaced by referential integrity exception delegate.

Throws a WTException if the argument is not eligible for deletion.



Supported API: false

Parameters:
txn - The ESITransaction to validate.
Throws:
WTException

validateDelete

public final void validateDelete(WTPart part)
                          throws WTException
Deprecated at X05/R8.0, replaced by by calling isInRelease and referential integrity exception delegate. Throws an exception if the argument is not eligible to be deleted.
  1. Examines ESI properties to determine whether or not to check ReleaseActivity objects. If the check is to be made, the method throws a WTException if the argument is associated to one or more ReleaseActivity (or ESIProperties-designated subclass) objects.
  2. Examines ESI properties to determine whether or not to check ESITransactionObjectLink objects. If the check is to be made, the method throws a WTException of the argument is associated to one or more ESITransactionObjectLink (or ESIProperties-designated subclass) objects.



Supported API: true

Parameters:
part - The part to evaluate.
Throws:
WTException

getActionCode

private ReleaseActivityAction getActionCode(String action)
                                     throws WTException
Throws:
WTException

decodeUser

protected String decodeUser(String userIn)
                     throws WTException
Throws:
WTException

getPersistableClassFromTargetAssociations

private Class getPersistableClassFromTargetAssociations(Collection collection)
                                                 throws WTException
Throws:
WTException

getTargetClassFromTargetAssociations

private Class getTargetClassFromTargetAssociations(Collection collection)
                                            throws WTException
Throws:
WTException

getClassFromObjects

private Class getClassFromObjects(Collection collection)
                           throws WTException
Throws:
WTException

getUniqueMastersFromParts

private Collection getUniqueMastersFromParts(Collection parts)

getUniqueMastersFromTargetAssociations

private Collection getUniqueMastersFromTargetAssociations(Collection parts)

addPartMastersToQuery

private void addPartMastersToQuery(QuerySpec qs,
                                   Collection masters,
                                   int pmIndex,
                                   Class partMasterClass)
                            throws WTException
Throws:
WTException

findLatestReleaseParts

private Vector findLatestReleaseParts(Collection tgtAssns,
                                      Collection parts)
                               throws WTException
Throws:
WTException

isRequestedTarget

private boolean isRequestedTarget(ESITargetAssociation assn,
                                  Collection assns)

mapTargetHistory

private void mapTargetHistory(Collection collection,
                              Group grp)
                       throws WTException
Throws:
WTException

mapReleaseActivities

private void mapReleaseActivities(Collection collection,
                                  Group grp)
                           throws WTException
Throws:
WTException

fixReleaseElement

private void fixReleaseElement(Element elem,
                               ReleaseActivity ra)
                        throws WTException
Throws:
WTException

mapReleaseActivitiesMessage

private void mapReleaseActivitiesMessage(ReleaseActivityMessage activiyMessage,
                                         Group grp)
                                  throws WTException
Throws:
WTException

mapTransactionMessage

private void mapTransactionMessage(ESITransactionMessage transactionMessage,
                                   Group grp)
                            throws WTException
Throws:
WTException

getActivitiesMessage

private ReleaseActivityMessage getActivitiesMessage(String ufid)
                                             throws WTException
Throws:
WTException

getTransactionsMessage

private ESITransactionMessage getTransactionsMessage(String ufid)
                                              throws WTException
Throws:
WTException

getTargetHistories

private Collection getTargetHistories(Collection objects)
                               throws WTException
Throws:
WTException

isReleaseBlocked

private boolean isReleaseBlocked(ESITransactionObjectLink link)

postResultTransaction

private void postResultTransaction(ESITransaction transaction,
                                   String timestamp,
                                   boolean isSuccessful,
                                   String msg)
                            throws WTException
Throws:
WTException

postResultSubtransaction

private void postResultSubtransaction(ESITransaction transaction,
                                      String objectID,
                                      String description,
                                      String message,
                                      String timestamp,
                                      String action,
                                      String cls,
                                      String user,
                                      boolean isSuccessful,
                                      String targetSystem)
                               throws WTException
Throws:
WTException

getTargetUtility

private ESITargetUtility getTargetUtility()

getCurrentDocument

public WTDocument getCurrentDocument(WTDocumentMaster master)
                              throws WTException
Throws:
WTException

isReleaseBlocked

private boolean isReleaseBlocked(Persistable object,
                                 ESITarget target)
                          throws WTException
Throws:
WTException

getLatestActivityForEffectivity

private ReleaseActivity getLatestActivityForEffectivity(Eff[] effs,
                                                        ESITarget target)
                                                 throws WTException
Throws:
WTException

getTransactionUfid

public String getTransactionUfid(String tx_number)
                          throws WTException
Returns UFID of ESITransaction

Returns:
The UFID of ESITransaction
Throws:
WTException

hasReleased

public boolean hasReleased(Persistable obj)
                    throws ESIException
Check if the given object has been released successfully. Only apply for the objects explicitly released on workflow such as ECN, the root of BOM, single part.

Throws:
ESIException

isBOMRelease

private boolean isBOMRelease(Persistable part,
                             String cls)
                      throws WTException
Throws:
WTException

removePending

public final void removePending(ESITransaction txn,
                                boolean txnNeeded)
                         throws WTException
Throws:
WTException

startDbTransaction

public void startDbTransaction()
                        throws WTException
Throws:
WTException

commitDbTransaction

public void commitDbTransaction()
                         throws WTException
Throws:
WTException

rollbackDbTransaction

public void rollbackDbTransaction()
                           throws WTException
Throws:
WTException

latestBOMExport

public final Collection latestBOMExport(Collection parts)
                                 throws WTException
Throws:
WTException

findLatestReleaseBOMParts

private Vector findLatestReleaseBOMParts(Collection tgtAssns,
                                         Collection parts)
                                  throws WTException
Throws:
WTException

checkTx

private boolean checkTx(Persistable obj,
                        String status)
                 throws ESIException
Throws:
ESIException

findAbortedTx

private QueryResult findAbortedTx(ESITransaction tx)
                           throws ESIException
Throws:
ESIException

isNewerThan

public boolean isNewerThan(Versioned v1,
                           Versioned v2)
                    throws WTException
Throws:
WTException

createReleaseActivity

private void createReleaseActivity(Persistable persistable,
                                   String description,
                                   ESITransaction transaction,
                                   boolean successful,
                                   ESITarget target,
                                   String message,
                                   String timestamp,
                                   String action,
                                   String cls,
                                   String user,
                                   boolean isTransactionRequired,
                                   boolean isWarning)
                            throws WTException
Throws:
WTException

purgePending

private void purgePending(Persistable p,
                          ESITarget tgt,
                          String cls)
                   throws WTException
Throws:
WTException

addTxnsToVector

private void addTxnsToVector(Vector v,
                             QueryResult qr)
                      throws WTException
Throws:
WTException

addUniqueTransactions

private void addUniqueTransactions(Group g,
                                   Vector v)
                            throws WTException
Throws:
WTException

getSynchObject

private static Persistable getSynchObject()
                                   throws WTException
Throws:
WTException

createSynchObject

private static void createSynchObject()
                               throws WTException
Throws:
WTException

lockSynchObject

private static void lockSynchObject()
                             throws WTException
Throws:
WTException

getAssociationsFromFromGroup

private Vector getAssociationsFromFromGroup(Group links)
                                     throws WTException
Throws:
WTException

hasWarningMessages

private boolean hasWarningMessages(String txnID)
                            throws WTException
Throws:
WTException

findTransactionsForAssociatedObjects

private Vector findTransactionsForAssociatedObjects(Persistable obj)
                                             throws WTException
Throws:
WTException

findTransactionsForReleasedObjects

private QueryResult findTransactionsForReleasedObjects(Persistable obj)
                                                throws WTException
Throws:
WTException

addTxnsForObjectsToVector

private void addTxnsForObjectsToVector(Vector v,
                                       Vector qr)
                                throws WTException
Throws:
WTException

isIterationInRelease

private boolean isIterationInRelease(Master master)
                              throws ESIException
Throws:
ESIException

isObjInRelease

private boolean isObjInRelease(Persistable obj)
                        throws ESIException
Throws:
ESIException

retrieveIterations

private QueryResult retrieveIterations(Class iterationClass,
                                       Master master)
                                throws WTException
Throws:
WTException

checkReleaseActivity

public static boolean checkReleaseActivity(Persistable obj,
                                           ESITarget target,
                                           String status,
                                           String action)

isReleaseFailedChange

public static boolean isReleaseFailedChange(Persistable obj,
                                            ESITarget target)