Class ESIResponseGenerator

java.lang.Object
com.ptc.windchill.esi.txn.ESIResponseGenerator
All Implemented Interfaces:
Runnable

public class ESIResponseGenerator extends Object implements Runnable
Implements the Runnable interface. The run() method has the necessary logic to generate the ESI response for each distribution target that is associated to a given business object and deliver it to an appropriate destination.

Supported API: true

Extendable: true
  • Field Details

    • obj

      protected Persistable obj
      The object that was released by the user.

      Supported API: true
    • primaryObj

      protected Persistable primaryObj
      The object for which to invoke the relevant getXXX() API.

      Supported API: true
    • primaryObjId

      protected String primaryObjId
      The UFID of the object in primaryObj

      Supported API: true
    • type

      protected String type
      The type of Releasable object used to call getXXX() API specied in ESIConst.

      Supported API: true
  • Constructor Details

    • ESIResponseGenerator

      public ESIResponseGenerator(Persistable obj, String userName, Locale locale) throws ESIException
      Constructor for the class; it sets the attributes esiRelease, primaryObj, primaryObjId, type and wcAdapter besides obj, userName and locale. Delegates part of the work to the method initialize().

      Supported API: true
      Parameters:
      obj - The object that was released by the user.
      userName - Name of the user who initiated the release; if null, the user associated with the session will be used.
      locale - Locale that is relevant for the publication; with ESI, this will be used for setting the custom JMS message property com_infoengine_locale that gets sent with the ESI response.
      Throws:
      ESIException - - if any of the invoked methods throws an exception.
    • ESIResponseGenerator

      public ESIResponseGenerator(Persistable obj, String userName, Locale locale, Persistable edObj) throws ESIException
      Constructor for the class; it sets the attributes esiRelease, primaryObj, primaryObjId, type and wcAdapter besides obj, userName, locale, enterprisedata object. Delegates part of the work to the method initialize().

      Supported API: true
      Parameters:
      obj - The object that was released by the user.
      userName - Name of the user who initiated the release; if null, the user associated with the session will be used.
      locale - Locale that is relevant for the publication; with ESI, this will be used for setting the custom JMS message property com_infoengine_locale that gets sent with the ESI response.
      edObj - The enterprise data object.
      Throws:
      ESIException - - if any of the invoked methods throws an exception.
  • Method Details

    • setType

      protected void setType() throws ESIException
      Sets the attribute type.

      Supported API: true
      Throws:
      ESIException - - if any of the invoked methods throws an exception.
    • generateResponse

      public com.infoengine.object.IeCollection generateResponse(String destId, ESITransaction txn, Collection<ESITarget> tgts) throws WTException
      Generates the ESI response for the object in primaryObj, making use of the input transaction and the distribution targets in the input collection. Delegates the work to an appropriate getXXX() API.

      Supported API: true
      Parameters:
      txn - ESITransaction object that represents the delivery of data to the distribution targets in the input collection.
      tgts - Collection of distribution targets that represent a given destination, such as an ERP instance.
      Returns:
      IeCollection The Info*Engine collection holding the ESI response.
      Throws:
      WTException - - if any of the invoked methods throws this exception.
    • getTargetAssociations

      public static Collection<ESITargetAssociation> getTargetAssociations(Persistable obj) throws WTException
      Static utility method that returns the ESITargetAssociations for the input object. Delegates part of the work to an ESITargetUtility instance. When the input object is a Change Notice, only those associations for which the distribution target attribute "ESI Response Output Format" has a value "ESI XML" are fetched.

      Supported API: true
      Parameters:
      obj - input object for which to fetch the ESITargetAssociations.
      Returns:
      A Collection of ESITargetAssociation objects.
      Throws:
      WTException - if any of the invoked methods throws this exception.
    • getTargetAssociations

      public Collection<ESITargetAssociation> getTargetAssociations(Persistable obj, boolean throwExceptionForNoChangeables) throws WTException
      Returns the ESITargetAssociations for the input object. Delegates part of the work to an ESITargetUtility instance. When the input object is a Change Notice, if no changeables could be fetched, an exception is thrown provided throwExceptionForNoChangeables is true.

      Supported API: true
      Parameters:
      obj - - Input object for which to fetch the ESITargetAssociations.
      throwExceptionForNoChangeables - - If the input object is a Change Notice and no changeables could be fetched from it, an exception is thrown provided a true was passed in for this parameter.
      Returns:
      A Collection of ESITargetAssociation objects.
      Throws:
      WTException - if any of the invoked methods throws this exception.
      ESIException - if the input object is a Change Notice and no changeables could be fetched from it and a true was passed in for throwExceptionForNoChangeables.
    • getPart

      protected com.infoengine.object.IeCollection getPart(ESITransaction txn, Collection<ESITarget> tgts) throws WTException
      Invokes the ESI services API that generates the ESI response for a stand-alone part.

      Supported API: true
      Parameters:
      txn - ESITransaction object that represents the delivery of data to the distribution targets in the input collection.
      tgts - Collection of distribution targets that represent a given destination, such as an ERP instance.
      Returns:
      IeCollection The VDB collection that results from invoking the relevant API; this holds the ESI response.
      Throws:
      WTException - - if the invoked ESI services API throws this exception.
    • getSmartCollection

      protected com.infoengine.object.IeCollection getSmartCollection(ESITransaction txn, Collection<ESITarget> tgts) throws WTException
      Invokes the ESI services API that generates the ESI response for a smart collection.

      Supported API: true
      Parameters:
      txn - ESITransaction object that represents the delivery of data to the distribution targets in the input collection.
      tgts - Collection of distribution targets that represent a given destination, such as an ERP instance.
      Returns:
      IeCollection The VDB collection that results from invoking the relevant API; this holds the ESI response.
      Throws:
      WTException - - if the invoked ESI services API throws this exception.
    • getBOM

      protected com.infoengine.object.IeCollection getBOM(ESITransaction txn, Collection<ESITarget> tgts) throws WTException
      Invokes the ESI services API that generates the ESI response for an assembly part.

      Supported API: true
      Parameters:
      txn - ESITransaction object that represents the delivery of data to the distribution targets in the input collection.
      tgts - Collection of distribution targets that represent a given destination, such as an ERP instance.
      Returns:
      IeCollection The VDB collection that results from invoking the relevant API; this holds the ESI response.
      Throws:
      WTException - - if the invoked ESI services API throws this exception.
    • getECN

      protected com.infoengine.object.IeCollection getECN(ESITransaction txn, Collection<ESITarget> tgts) throws WTException
      Invokes the ESI services API that generates the ESI response for a Change Notice.

      Supported API: true
      Parameters:
      txn - ESITransaction object that represents the delivery of data to the distribution targets in the input collection.
      tgts - Collection of distribution targets that represent a given destination, such as an ERP instance.
      Returns:
      IeCollection The VDB collection that results from invoking the relevant API; this holds the ESI response.
      Throws:
      WTException - - if the invoked ESI services API throws this exception.
    • getResource

      protected com.infoengine.object.IeCollection getResource(ESITransaction txn, Collection<ESITarget> tgts) throws WTException
      Invokes the ESI services API that generates the ESI response for a manufacturing resource.

      Supported API: true
      Parameters:
      txn - ESITransaction object that represents the delivery of data to the distribution targets in the input collection.
      tgts - Collection of distribution targets that represent a given destination, such as an ERP instance.
      Returns:
      IeCollection The VDB collection that results from invoking the relevant API; this holds the ESI response.
      Throws:
      WTException - - if the invoked ESI services API throws this exception.
    • getProcessPlan

      protected com.infoengine.object.IeCollection getProcessPlan(ESITransaction txn, Collection<ESITarget> tgts) throws WTException
      Invokes the ESI services API that generates the ESI response for a process plan.

      Supported API: true
      Parameters:
      txn - ESITransaction object that represents the delivery of data to the distribution targets in the input collection.
      tgts - Collection of distribution targets that represent a given destination, such as an ERP instance.
      Returns:
      IeCollection The VDB collection that results from invoking the relevant API; this holds the ESI response.
      Throws:
      WTException - - if the invoked ESI services API throws this exception.
    • getOperation

      protected com.infoengine.object.IeCollection getOperation(ESITransaction txn, Collection<ESITarget> tgts) throws WTException
      Invokes the ESI services API that generates the ESI response for a operation.

      Supported API: true
      Parameters:
      txn - ESITransaction object that represents the delivery of data to the distribution targets in the input collection.
      tgts - Collection of distribution targets that represent a given destination, such as an ERP instance.
      Returns:
      IeCollection The VDB collection that results from invoking the relevant API; this holds the ESI response.
      Throws:
      WTException
    • getProductionVersion

      protected com.infoengine.object.IeCollection getProductionVersion(ESITransaction txn, Collection<ESITarget> tgts) throws WTException
      Invokes the ESI services API that generates the ESI response for a production version.

      Supported API: true
      Parameters:
      txn - ESITransaction object that represents the delivery of data to the distribution targets in the input collection.
      tgts - Collection of distribution targets that represent a given destination, such as an ERP instance.
      Returns:
      IeCollection The VDB collection that results from invoking the relevant API; this holds the ESI response.
      Throws:
      WTException - - if the invoked ESI services API throws this exception.
    • getEsiRelease

      protected ESIRelease getEsiRelease()
      Returns the ESIRelease object used for publication.

      Supported API: true
      Returns:
      the esiRelease
    • getUserName

      protected String getUserName()
      Returns user that is being used for publication.

      Supported API: true
      Returns:
      the userName
    • getLocale

      protected Locale getLocale()
      Returns locale used for publication

      Supported API: true
      Returns:
      the locale
    • getDestinationInfo

      protected HashMap<String,HashMap<ESITransaction,Collection<ESITargetFacade>>> getDestinationInfo()
      Returns destination info map set by initilizer API of thread before it calls run API.

      Supported API: true
      Returns:
      the destinationInfo
    • getTargetInfoMap

      protected Map<String,Map<ESITargetFacade,Map<String,Object>>> getTargetInfoMap()
      Returns the target information map in case targets are overriden.

      Supported API: true
      Returns:
      the targetInfoMap
    • adjustTransactionElement

      protected com.infoengine.object.factory.Element adjustTransactionElement(com.infoengine.object.factory.Element element, ESITransaction transaction, String destinationID) throws ESIRendererException
      Allow subclasses to fix the contents of transaction element.

      Supported API: true
      Parameters:
      element - - The transaction element for release that will be added to response.
      transaction - - The esi transatcion object
      Returns:
      destinationID - The destination id for transaction
      Throws:
      ESIRendererException