Package com.ptc.windchill.esi.txn
Class ESIReleaseUtility
java.lang.Object
com.ptc.windchill.esi.txn.ESIReleaseUtility
Provides utility methods for miscellaneous tasks that involve the ESIRelease object.
Supported API: true
Extendable: false
Supported API: true
Extendable: false
-
Method Summary
Modifier and TypeMethodDescriptionstatic final voidabortRelease(Persistable obj) Removes anESIReleaseif there are no associatedESITransactionobjects, otherwise does nothing.static voidcheckAndExecutePostEvent(Persistable obj, boolean isTxnSuccessful, String message) Invokes an overloaded version, which in turn invokes the postEvent() API, provided all the transactions associated with the given ESI release are completed successfully (meaning they have a value "succeeded" for their statuses).static ESIReleasecreateESIRelease(Persistable object, String userName) Creates a new ESIRelease object and associates it to the input object.static ESIReleasecreateESIReleaseObject(Persistable primaryBusinessObj, String userName) Creates an ESIRelease Object for the input persistable object.static ESITransactioncreateESITransaction(Persistable primaryBusinessObj, String targetNumber, ESIRelease release, String userName) Creates an ESITransaction object for the input persistable object.static WTCollectioncreateReleaseActivities(Collection<ReleaseActivityInfo> releaseActivityInfoObjs) Creates a ReleaseActivity for each ReleaseActivityInfo object in the input collection.getAssociatedESIReleaseObjects(Collection<String> txnUFIDs) Returns a Map whose key is anESITransactionobject and the value is its associatedESIReleaseobject.static ESIReleaseFetches the ESIRelease object associated to the input transaction object and returns it to the caller.static ESIReleaseFetches the ESIRelease object associated to the input releasable object and returns it to the caller.static Collection<ESITransaction> Returns a collection of ESITransaction objects associated with the input object.static PersistablegetAssocPrimaryBusinessObject(ESIRelease release) Fetches the primary business object associated to the input ESIRelease object and returns it to the caller.static PersistablegetAssocPrimaryBusinessObject(ESIRelease release, boolean fetchResObjIfAutoECN) Fetches the primary business object associated to the input ESIRelease object and returns it to the caller.static final voidhideRelease(ESIRelease release) Hide an ESIRelease from the user interface.static booleanLets the caller know if the input releasable object has an associated release that is pending.static voidsetEsiReleaseStatus(ESIRelease releaseObj, ReleaseStatusType status) Sets the input ESIRelease object's status to a given value and persists it.static voidsetEsiReleaseStatus(Persistable obj, ReleaseStatusType status) Sets the status of ESI release associated to the input releasable object to a given value and persist it.static voidstorePersistableObjStateOnEsiRelease(ESIRelease release, Persistable obj) Store the life cycle state of the input persistable object on the given release object.static voidupdateReleaseActivities(ESITransaction txn, boolean isSuccessful) Updates the status of all the ReleaseActivity objects associated with the input ESITransaction object.
-
Method Details
-
getAssociatedRelease
Fetches the ESIRelease object associated to the input releasable object and returns it to the caller.
Supported API: true- Parameters:
obj- The releasable object for which to fetch the associated ESIRelease object.- Returns:
- ESIRelease The ESIRelease object associated to the input object.
- Throws:
ESIException- - if some error was encountered while navigating to the ESIRelease object.
-
getAssociatedRelease
Fetches the ESIRelease object associated to the input transaction object and returns it to the caller.
Supported API: true- Parameters:
txn- ESITransaction object for which to fetch the associated ESIRelease object.- Returns:
- ESIRelease The ESIRelease object associated to the input object.
- Throws:
ESIException- - if some error was encountered while navigating to the ESIRelease object.
-
checkAndExecutePostEvent
public static void checkAndExecutePostEvent(Persistable obj, boolean isTxnSuccessful, String message) throws WTException Invokes an overloaded version, which in turn invokes the postEvent() API, provided all the transactions associated with the given ESI release are completed successfully (meaning they have a value "succeeded" for their statuses).
Supported API: true- Parameters:
obj- Input releasable objectisTxnSuccessful- Status of the overall transaction, whose PostResult RPC invoked this API.message- Message to be used for setting the errorMessage attribute on the "ESI Release Complete" event that gets dispatched via the call to the overloaded version; if null, an appropriate message will be internally worked out by the code.- Throws:
WTException- - if any of the invoked methods throws an exception.
-
setEsiReleaseStatus
public static void setEsiReleaseStatus(ESIRelease releaseObj, ReleaseStatusType status) throws WTException Sets the input ESIRelease object's status to a given value and persists it.
Supported API: true- Parameters:
releaseObj- - ESIRelease object whose status needs to be set.status- - status that needs to be set on the given ESIRelease object.- Throws:
WTException
-
setEsiReleaseStatus
public static void setEsiReleaseStatus(Persistable obj, ReleaseStatusType status) throws WTException Sets the status of ESI release associated to the input releasable object to a given value and persist it.
Supported API: true- Parameters:
obj- - The releasable object.status- - status that needs to be set on the ESIRelease object associated to the input releasable object.- Throws:
WTException
-
createESIRelease
Creates a new ESIRelease object and associates it to the input object. The thus created ESIRelease object will get to have a number that is one greater than the largest number that existed at the time of its creation and will be unique within the organization that the input object belongs to.
Supported API: true- Parameters:
object- The object that the new created ESIRelease object is to be associated with.userName- The name of the user responsible for initiating the ESI transaction.- Returns:
- The newly created ESIRelease object.
- Throws:
WTException
-
isReleasePending
Lets the caller know if the input releasable object has an associated release that is pending.
Supported API: true- Parameters:
obj- The releasable object for which to perform the check.- Returns:
- boolean true, if the input object has an associated "pending" release; false, otherwise.
- Throws:
ESIException- - if any of the invoked methods throws an exception.
-
getAssociatedTransactions
public static Collection<ESITransaction> getAssociatedTransactions(Persistable obj) throws WTException Returns a collection of ESITransaction objects associated with the input object.
Supported API: true- Parameters:
obj- The releasable object for which to fetch the associated ESITransactions.- Returns:
- Collection - an ArrayList of ESITransaction objects that are associated with the input releasable object.
- Throws:
WTException- - if any of the invoked methods throws this exception.
-
hideRelease
Hide an ESIRelease from the user interface.
Supported API: true- Parameters:
release- - The ESIRelease object to be hidden.- Throws:
WTException
-
getAssocPrimaryBusinessObject
Fetches the primary business object associated to the input ESIRelease object and returns it to the caller. However, if the primary business object happens to be an automatically generated change notice, the method returns the (only) resulting object in the change notice instead.
Supported API: true- Parameters:
release- The input ESIRelease object.- Returns:
- Persistable The object associated to the ESIRelease object; if this happens to be an auto-generated change notice, the (only) changeable in it is returned instead.
- Throws:
WTException- - if this exception was thrown by the overloaded API that is invoked.
-
getAssocPrimaryBusinessObject
public static Persistable getAssocPrimaryBusinessObject(ESIRelease release, boolean fetchResObjIfAutoECN) throws WTException Fetches the primary business object associated to the input ESIRelease object and returns it to the caller. However, if the primary business object happens to be an automatically generated change notice and a true was passed in for the boolean argument, the method returns the (only) resulting object in the change notice instead.
Supported API: true- Parameters:
release- The input ESIRelease object.fetchResObjIfAutoECN- If true, and if the object associated to the ESIRelease object is an auto-generated change notice, the resulting object in the change notice is returned; if false, the object associated to the input ESIRelease object is returned.- Returns:
- Persistable The object associated to the input ESIRelease object or the resulting object in the associated auto-generated change notice, as the case may be.
- Throws:
WTException- - if some error was encountered while navigating to the primary business object.
-
storePersistableObjStateOnEsiRelease
public static void storePersistableObjStateOnEsiRelease(ESIRelease release, Persistable obj) throws WTException Store the life cycle state of the input persistable object on the given release object.
Supported API: true- Parameters:
release- - Input release object.obj- - Input persistable object.- Throws:
WTException
-
updateReleaseActivities
public static void updateReleaseActivities(ESITransaction txn, boolean isSuccessful) throws WTException Updates the status of all the ReleaseActivity objects associated with the input ESITransaction object.
Supported API: true- Parameters:
txn- - ESITransaction object. This method does nothing if this argument is null.isSuccessful- - This is either true or false, according as publication of data to the distribution targets in the release was successful or otherwise, respectively.- Throws:
WTException
-
createESITransaction
public static ESITransaction createESITransaction(Persistable primaryBusinessObj, String targetNumber, ESIRelease release, String userName) throws WTException Creates an ESITransaction object for the input persistable object. Additionally it create links between newly created ESItransaction object and input target and release objects. It persists all these objects into the database.
Supported API: true- Parameters:
primaryBusinessObj- - The object that is to be associated with the ESITransaction.targetNumber- - The number of target object that is to be associated with the ESITransaction.release- - The release object that is to be associated with the ESITransaction.userName- - The use to be used to create transaction objects- Throws:
WTException
-
createReleaseActivities
public static WTCollection createReleaseActivities(Collection<ReleaseActivityInfo> releaseActivityInfoObjs) throws WTException Creates a ReleaseActivity for each ReleaseActivityInfo object in the input collection. It also creates ReleaseActivityMessage and ESITransactionRelease (link between ReleaseActivity and its ESITransaction object) objects.
Supported API: true- Parameters:
releaseActivityInfoObjs- - Collection of ReleaseActivityInfo objects, each holding the data necessary for creating a ReleaseActivity and its associated objects.- Returns:
- Collection of persisted ReleaseActivity objects.
- Throws:
WTException- Any exception while executing this method.
-
createESIReleaseObject
public static ESIRelease createESIReleaseObject(Persistable primaryBusinessObj, String userName) throws WTException Creates an ESIRelease Object for the input persistable object. If an ESIRelease object already exists for the input persistable object, then it will be returned to the caller after setting its status to PENDING. This method internally invokes the API ESIReleaseUtility.createESIRelease(Persistable, String). Check its javadoc for more details.
Supported API: true- Parameters:
primaryBusinessObj- - Primary business object for which the release has to be created.userName- - User name- Returns:
- ESIRelease ESIReleae object associated with the input primary business object.
- Throws:
WTException- Any exception while executing this method.
-
abortRelease
Removes anESIReleaseif there are no associatedESITransactionobjects, otherwise does nothing.Note : This method can ONLY be called on ESI work flow if any system errors (e.g. JMS server not available ) Occurred during release, means that unable to send messages to com.ptc.windchill.esi.Event queue.
Supported API: true- Parameters:
obj- - The primary business object for which publication is triggered.
-
getAssociatedESIReleaseObjects
public Map<ESITransaction,ESIRelease> getAssociatedESIReleaseObjects(Collection<String> txnUFIDs) throws WTException Returns a Map whose key is anESITransactionobject and the value is its associatedESIReleaseobject.
Supported API: true- Parameters:
txnUFIDs- - Collection of UFIDs ofESITransactionobjects.- Returns:
- - A Map whose key is an
ESITransactionobject and the value is its associatedESIReleaseobject. - Throws:
WTException
-