Class ESIDocumentsRenderer

java.lang.Object
com.ptc.windchill.esi.rnd.BasicESIRenderer
com.ptc.windchill.esi.esidoc.ESIDocumentsRenderer
All Implemented Interfaces:
ESIRenderer, ESIDocumentsRendererInterface

public class ESIDocumentsRenderer extends BasicESIRenderer implements ESIDocumentsRendererInterface
This class has methods to render documents associated to a RevisionControlled object (including those associated to the relevant ERPMaterial object if the RevisionControlled object is a WTPart) and build the relevant portions of the ESI response.

Supported API: true

Extendable: true
  • Method Details

    • getCurrentPartIteration

      protected RevisionControlled getCurrentPartIteration()
      Gets the value of the attribute: currentPartIteration; The current iteration of the part associated with this document. No setter for this attribute - it must be set using setData().

      Supported API: true
      Returns:
      RevisionControlled
    • getPreviousPartIteration

      protected RevisionControlled getPreviousPartIteration()
      Gets the value of the attribute: previousPartIteration; The last release iteration of the part associated with this document. No setter for this attribute - it must be set using setData().

      Supported API: true
      Returns:
      RevisionControlled
    • getTargets

      protected Collection<ESITarget> getTargets()
      Gets the value of the attribute: targets; A collection ESITarget objects. No setter for this attribute - it must be set using setData().

      Supported API: true
      Returns:
      Collection
    • getWcAdapter

      @Deprecated protected String getWcAdapter()
      Deprecated.
      Use BasicESIRenderer.getAdapterName() instead.

      Supported API: true
      Returns the value of the attribute adapterName. This attribute holds the name of the Windchill Adapter instance where the Query-Objects webject is to be executed.
      Returns:
      The value stored in the field adapterName.
    • getDocUtility

      protected ESIDocUtility getDocUtility()
      Gets the value of the attribute: docUtility (reference to an ESIDocUtility instance). Do not access the attribute directly. Use the lazy-initializing getter.

      Supported API: true
      Returns:
      ESIDocUtility
    • setData

      public void setData(RevisionControlled currentObject, RevisionControlled previousObject, Collection<ESITarget> esiTargets, String wcAdapter, String auth) throws ESIRendererException
      Provide all necessary data to a Document Renderer.

      Supported API: true
      Parameters:
      currentObject - Currently published RevisionControlled object iteration for which to publish associated documents.
      previousObject - RevisionControlled object iteration that was previously published to a given distribution target. It is used for setting the instance variable previousPartIteration, provided the preference "Publish Only Incremental Changes to Document Associations" has a value "Yes".
      esiTargets - Collection of ESITargets to which documents associated with the current RevisionControlled object iteration are to be published. Strictly speaking, this will have just one ESITarget object.
      wcAdapter - Name of the Windchill adapter instance where the I*E task specified by the ESI preference "Query Document Task" will be executed.
      auth - Authentication information required for executing the I*E task specified by the ESI preference "Query Document Task".
      Throws:
      ESIRendererException
    • setData

      public void setData(Document doc, ESITarget tgt, String auth, String wcAdapter)
      Sets the required attributes on this renderer instance.

      Supported API: true
      Parameters:
      doc - Document instance representing the standalone document being published.
      tgt - Currently processed distribution target to which the document is being published.
      auth - Authentication information required for executing the I*E task specified by the ESI preference "Query Document Task".
      wcAdapter - Name of the Windchill adapter instance where the I*E task specified by the ESI preference "Query Document Task" will be executed.
    • setData

      public void setData(String auth, String wcAdapter)
      Sets the required attributes on this renderer instance.

      Supported API: true
      Parameters:
      auth - Authentication information required for executing the I*E task specified by the ESI preference "Query Document Task".
      wcAdapter - Name of the Windchill adapter instance where the I*E task specified by the ESI preference "Query Document Task" will be executed.
    • validate

      protected void validate() throws ESIRendererException
      Throws an exception if both currentPartIteration and document are null, or targets is null. This method may be overridden.

      Supported API: true
      Specified by:
      validate in class BasicESIRenderer
      Throws:
      ESIRendererException
    • buildGroups

      protected void buildGroups() throws ESIRendererException
      Creates the Document output and may be invoked either for documents associated to RevisionControlled objects or for standalone documents. Does the following when publishing associated documents:
      1. If there is a previously published iteration of the RevisionControlled object, obtains the differences in document associations between the currently and previously published iterations. Invokes ESIDocUtility.retrievePartDocDifferences() to obtain the differences.

        If there is no previously published iteration, obtains the documents from the current iteration by requesting them from ESIDocUtility.retrievePartDocInformation().

        The result of calling the ESIDocUtility methods is an array of collections of PartDocInfo objects.
      2. Obtains all the documents associated with the PartDocInfo objects.
      3. Obtains all the document links associated with the PartDocInfo objects.
      4. Separates the documents and document links on the basis of whether they were added, removed, changed, or unchanged.
      5. Invokes the Windchill adapter webject Query-Objects to obtain the data for the document and document link objects.
      6. Calls adjustObjectID(), adjustTargets(), adjustDocumentElement() and adjustDocLinkElement()
      7. Passes the resultant Info*Engine element to the VdbBuilder that is maintained by the base class.
      When publishing a standlone document, the method invokes processDocument(), which obtains the data for the document the usual way and builds the output.

      Supported API: true
      Specified by:
      buildGroups in class BasicESIRenderer
      Throws:
      ESIRendererException
    • processDocument

      protected void processDocument() throws WTException
      Processes a standalone document. It queries the database for the relevant data, fetches a PartDocInfo object for the document, builds the output and adds it to the VdbBuilder instance.

      Supported API: true
      Throws:
      WTException - , if any of the invoked methods throws this exception.
    • adjustDocumentElement

      protected com.infoengine.object.factory.Element adjustDocumentElement(com.infoengine.object.factory.Element element, String group, Document document, Collection targets) throws ESIRendererException
      Allow subclasses to fix the contents of an element. Default behavior is to return the element argument.

      Supported API: true
      Parameters:
      element - The element to be adjusted.
      group - the logical group name of the VdbGroup that will contain the element.
      document - The document object that is being processsed
      targets - Collection of ESITarget objects.
      Returns:
      Element
      Throws:
      ESIRendererException
    • adjustDocLinkElement

      protected com.infoengine.object.factory.Element adjustDocLinkElement(com.infoengine.object.factory.Element element, String group, BinaryLink documentLink, Collection targets) throws ESIRendererException
      Allow subclasses to fix the contents of an element. Default behavior is to return the element argument.

      Supported API: true
      Parameters:
      element - The element to be updated.
      group - The logical group name. Used by the VdbBuilder to identify a VdbGroup.
      documentLink - The object being mapped for output.
      targets - Collection of ESITarget objects.
      Returns:
      Element
      Throws:
      ESIRendererException
    • getESIDoc

      public void getESIDoc(Collection<ESITargetAssociation> previousTargetAssociations, Collection currentObjects, Collection<ESITarget> targetOrgs, String wcAdapter, String authorization, VdbBuilder builder) throws WTException
      Match the previously published object iteration with the currently published object iteration and call the document renderer once for each match. This method is provided for use with the part and certain other renderers that process manufacturing objects.

      Supported API: true
      Parameters:
      previousTargetAssociations - Collection of target associations for previously published RevisionControlled object iterations.
      currentObjects - Collection of currently published RevisionControlled object iterations.
      targetOrgs - Collection of ESITargets to which documents associated with the current RevisionControlled object iteration are to be published. Strictly speaking, this will have just one ESITarget object.
      wcAdapter - Name of the Windchill adapter instance to use for executing the I*E task specified by the ESI preference "Query Document Task".
      authorization - Authentication information required for executing the I*E task specified by the ESI preference "Query Document Task".
      builder - VdbBuilder instance to use when creating the output.
      Throws:
      WTException
    • getDocument

      public com.infoengine.object.IeCollection getDocument(String objectID, ESITransaction txn, Collection<ESITarget> tgts, String auth, String wcAdapter) throws WTException
      Creates a VdbBuilder instance for the input transaction, renders the input document and creates release activities as appropriate for each of the distribution targets in tgts. Returns the rendered output as an Info*Engine collection to the caller.

      Supported API: true
      Parameters:
      objectID - UFID of the input (standalone) document to be rendered.
      txn - ESITransaction object that represents the delivery of data to the distribution targets in tgts; will be null when the method is invoked for the Preview functionality.
      tgts - Collection of distribution targets that represent a given destination, such as an ERP instance.
      auth - Authentication information required for executing certain Windchill adapter webjects as part of the rendering process.
      wcAdapter - Name of the Windchill adapter instance to use.
      Returns:
      IeCollection The Info*Engine collection that holds the ESI response.
      Throws:
      WTException - - if any of the invoked methods throws this exception; ESIRendererException - if the document being rendered has not changed since it was last successfully published and the preference "Enforce Changes" has value "Yes".
    • buildGroups

      protected void buildGroups(RevisionControlled current, RevisionControlled previous, Collection<ESITarget> targets) throws WTException
      Overloaded version of buildGroups() where the actual rendering of documents and document links is done. It is invoked by the other argumentless version.

      Supported API: true
      Parameters:
      current - Currently published RevisionControlled object (such as a WTPart).
      previous - Previously published iteration of the RevisionControlled object.
      targets - Collection of ESITarget objects associated to the currently and previously published iterations.
      Throws:
      WTException - - if any of the invoked methods throws an exception.
    • isIncrementalDocAssociationsPublishEnabled

      public boolean isIncrementalDocAssociationsPublishEnabled(RevisionControlled currentObject)
      Returns the value of the preference "Publish Only Incremental Changes to Document Associations" based on the current object. Supported API: true
      Parameters:
      currentObject -
      Returns:
      value of the preference "Publish Only Incremental Changes to Document Associations" according to the current object.
    • adjustDocumentElementForSCCUsages

      protected com.infoengine.object.factory.Element adjustDocumentElementForSCCUsages(com.infoengine.object.factory.Element element, String group, Document document, Collection targets) throws ESIRendererException
      Allow subclasses to fix the contents of an element. Default behavior is to return the element argument.

      Supported API: true
      Parameters:
      element - The element to be adjusted.
      group - the logical group name of the VdbGroup that will contain the element.
      document - The document object that is being processsed
      targets - Collection of ESITarget objects.
      Returns:
      Element
      Throws:
      ESIRendererException
    • getDocumentDeltas

      protected Collection<Delta>[] getDocumentDeltas(Document document, Collection<ESITarget> targets) throws WTException
      Returns an array of collections, each one holding Delta objects. Delta object holds the previous exported iteration of a document and corresponding targets. The collection at index-0 contains added documents, index-1 contains changed and index-2 contains unchanged documents.

      Supported API: true
      Parameters:
      document - - Input document
      targets - - Collection of distribution targets.
      Returns:
      Array of collections.
      Throws:
      WTException
    • getDocument

      public com.infoengine.object.IeCollection getDocument(String objectID, ESITransactionFacade txn, Collection<? extends ESITargetFacade> targets, Map<? extends ESITargetFacade,Map<String,Object>> paramMap, String auth, String wcAdapter) throws WTException
      Returns the rendered output as an Info*Engine collection to the caller. Calls getDocument(String, ESITransaction, Collection, String, String) method.
      Supported API: true
      Specified by:
      getDocument in interface ESIDocumentsRendererInterface
      Parameters:
      objectID - UFID of the input (standalone) document to be rendered.
      txn - ESITransaction object that represents the delivery of data to the distribution targets in tgts; will be null when the method is invoked for the Preview functionality.
      targets - Collection of distribution targets that represent a given destination, such as an ERP instance.
      paramMap - Map holding ESITarget objects as keys and certain Maps as values;
      auth - Authentication information required for executing certain Windchill adapter webjects as part of the rendering process.
      wcAdapter - Name of the Windchill adapter instance to use.
      Returns:
      IeCollection The Info*Engine collection that holds the ESI response.
      Throws:
      WTException - - if any of the invoked methods throws this exception; ESIRendererException - if the document being rendered has not changed since it was last successfully published and the preference "Enforce Changes" has value "Yes". (non-Javadoc)
      See Also: