Class ESIAbstractDocumentsRenderer

java.lang.Object
com.ptc.windchill.esi.rnd.BasicESIRenderer
com.ptc.windchill.esi.esidoc.ESIAbstractDocumentsRenderer
All Implemented Interfaces:
ESIRenderer
Direct Known Subclasses:
ESIEPMDocumentRenderer

public abstract class ESIAbstractDocumentsRenderer extends BasicESIRenderer
Abstract documents renderer to render document structure. This class cannot be used by instantiating it directly. Document type specific implementor must extend this class in order render document and structure.

Supported API: true

Extendable: true
See Also:
  • Method Details

    • getDocUtility

      protected ESIDocUtility getDocUtility()
      Gets the value of the attribute: docUtility; Reference to a ESIDocUtility. Do not access the attribute directly. Use the lazy-initializing getter.

      Supported API: true
      Returns:
      ESIDocUtility
    • getTreeNavigator

      protected TreeNavigator getTreeNavigator(Persistable root, int multiLevel, NavigationCriteria navCriteria, Map<String,Object> navigationOptions) throws WTException
      Returns an instance of TreeNavigator. Invokes newTreeNavigator() method of the factory TreeNavigatorFactory.

      Supported API: true
      Parameters:
      root - - The root object of document structure.
      multiLevel - - The number of levels in document structure to be navigated.
      navCriteria - - Navigation criteria.
      navigationOptions - - The map containing key and value pair to be used by TreeNavigationRequestBuilder while initializing TreeNavigator instance.
      Returns:
      An instance of TreeNavigator.
      Throws:
      WTException
      See Also:
    • setData

      protected void setData(Object objectInfo, ESITarget target, Map<String,Object> paramsMap, String auth, String wcAdapter) throws WTException
      Establishes the state of the renderer. It sets the values of the various member variables used for navigating and rendering a document structure.

      Supported API: true
      Parameters:
      objectInfo - - UFID/document object of the header/root of the document structure to be rendered.
      target - - Distribution target object to be used for fetching various attributes required for navigating and rendering the document structure.
      paramsMap - - Used to pass in various parameters required for navigating and rendering document structure. If a certain parameter is not found in this map, then it will be fetched from the target. Check the Javadoc of getDocument(...) method for all the valid parameters in the respective document structure renderer.
      auth - - Authentication information required for executing certain Windchill adapter webjects as part of the rendering process.
      wcAdapter - - Name of the Windchill adapter instance.
      Throws:
      WTException - if any of the invoked methods throws this exception.
    • buildGroups

      protected void buildGroups() throws ESIRendererException
      Builds the renderer output. Does the following:
      1. Obtains the list of assembly nodes from the document structure. Uses the services of a TreeNavigator to find assembly nodes and leaf nodes.
      2. Calls getAssemblyNodes() method of TreeNavigator.
      3. Calls compareAssemblyNodes() method for processing the assembly nodes i.e. nodes having children.
      4. Calls getLeafNodes() method of TreeNavigator.
      5. Calls compareLeafNodes() method for processing leaf documents nodes i.e. nodes having no children.
      6. Calls getAssociatedNodes() method of TreeNavigator to get referenced leaf nodes.
      7. Calls compareLeafNodes() method for processing referenced leaf documents nodes i.e. nodes having no children.
      8. Calls processLinks() method for processing links that associates assembly nodes to children and referenced by to referenced documents.


      Supported API: true
      Specified by:
      buildGroups in class BasicESIRenderer
      Throws:
      ESIRendererException - Throws ESI Renderer exception if filed to render specified object.
      See Also:
    • validate

      protected void validate() throws ESIRendererException
      Validates the state of renderer before processing of renderer.

      Supported API: true
      Specified by:
      validate in class BasicESIRenderer
      Throws:
      ESIRendererException
      See Also:
    • compareAssemblyNodes

      protected void compareAssemblyNodes(Collection<Persistable> assemblyNodes) throws ESIRendererException
      Compares collection of assembly objects returned by the tree navigation and calls renderAssemblyNodes API to render assembly documents.
      1. For each document in the collection:
        • Fetches the latest released version for each associated target.
        • For each fetched version, current version pair, obtains the difference from object comparison framework by invoking compareDocuments API. If there is no previous version, that object is considered as getting published for the first time. Hence difference wont be calculated.
        • Calls updateRoleAToLinkMap() method.
      2. Calls renderAssemblyNodes() method for rendering the assembly nodes i.e. nodes with children.


      Supported API: true
      Parameters:
      assemblyNodes - - The collection of document objects having children.
      Throws:
      ESIRendererException
    • renderAssemblyNodes

      protected void renderAssemblyNodes(Set<Persistable>[] assemblyNodeDiffArray, Map<Persistable,Persistable> currentAndPreviousExpObjects) throws ESIRendererException
      Render assembly node objects after comparing assembly nodes objects for differences.
      • For set of all document array calls renderDocuments API with areAssemblies parameter true.

      Supported API: true
      Parameters:
      assemblyNodeDiffArray - - An array of Persistable object set each element in array represents objects as follows.
      0th element in array contains all added assembly nodes.
      1st element in array contains all changed assembly nodes.
      2nd element in array contains all unchanged assembly nodes.
      currentAndPreviousExpObjects - - The map containing current iteration as key and previously published iteration as value.
      Throws:
      ESIRendererException
    • compareLeafNodes

      protected void compareLeafNodes(Collection<Persistable> leaves) throws ESIRendererException
      Compares collection of leaf document objects returned by the tree navigation and calls renderLeaves API to render leaf documents.
      1. For each document in the collection:
        • Fetches the latest released version for each associated target.
        • For each fetched version, current version pair, obtains the difference from object comparison framework by invoking compareDocuments API. If there is no previous version, that object is considered as getting published for the first time. Hence difference wont be calculated.
        • Calls updateRoleAToLinkMap() method.
      2. Calls renderLeaves() method for rendering the leaf nodes i.e. nodes without children.


      Supported API: true
      Parameters:
      leaves - - The collection of leaf document objects i.e. document object nodes having no children.
      Throws:
      ESIRendererException
    • getPreviousExportedIterations

      protected Collection<ESITargetAssociation> getPreviousExportedIterations(Collection<ESITargetAssociation> targetAssociations, String... releaseClass) throws WTException
      Returns the previous exported iterations for each document and target combination from the input target associations. Invokes the API
      invalid reference
      ESITransactionUtility#latestObjectExport(Collection, String)
      .

      Supported API: true
      Parameters:
      targetAssociations - - Collection of distribution target associations. Typically,the target associations between the current document and current target being processed.
      releaseClass - - ESI release class. Used to fetch appropriate ReleaseActivity objects while computing previous exported iterations.
      Returns:
      Collection of targte associations with the previous exported iterations.
      Throws:
      WTException
    • renderLeaves

      protected void renderLeaves(Set<Persistable>[] leafDiffArray, Map<Persistable,Persistable> currentAndPreviousExpObjects) throws ESIRendererException
      Render leaf document objects after comparing leaf document objects for differences.
      • For set of all document array calls renderDocuments API with areAssemblies parameter false.

      Supported API: true
      Parameters:
      leafDiffArray - - An array of Persistable object set each element in array represents objects as follows.
      0th element in array contains all added leaves.
      1st element in array contains all changed leaves.
      2nd element in array contains all unchanged leaves.
      currentAndPreviousExpObjects - - The map containing current iteration as key and previously published iteration as value.
      Throws:
      ESIRendererException
    • renderDocuments

      protected void renderDocuments(Set<Persistable>[] documentsDiffArray, Map<Persistable,Persistable> currentAndPreviousExpObjects, boolean areAssemblyNodes) throws ESIRendererException
      Render the document objects.
      1. Retrieves InfoEngine elements of a set in difference array:
      2. For each document in the set of array:
        • Calls mapDocumentElement() to map the document element
        • Adds the mapped InfoEngine element to the VdbBuilder
        • Calls postRenderAssemblyNode() or postRenderLeaf method based on assembly or leaf object in the specified input set.


      Supported API: true
      Parameters:
      documentsDiffArray - - An array of Persistable object set each element in array represents objects as follows.
      0th element in array contains all added documents.
      1st element in array contains all changed documents.
      2nd element in array contains all unchanged documents.
      currentAndPreviousExpObjects - - The map containing current iteration as key and previously published iteration as value.
      areAssemblyNodes - - Indicates set of documents specified for rendering are Assembly nodes are Leaf nodes.
      Throws:
      ESIRendererException
    • mapDocumentElement

      protected com.infoengine.object.factory.Element mapDocumentElement(String groupName, Document currentDocument, Document previousDocument, com.infoengine.object.factory.Element docElement, Collection<ESITarget> targets) throws ESIRendererException
      Builds the output InfoEngine Element for the input document and returns it to the caller. This API will call adjustDocumentElement for customization. API maps source attribute to target attribute while setting appropriate values.
      • Calls mapElement() to map the document element
      • Adds attribute values as per ESI business logic
      • Calls adjustObjectID() to adjust ObjectID.
      • Calls adjustTargets() to adjust TargetID.
      • Calls adjustDocumentElement to adjust values based on customised implementation


      Supported API: true
      Parameters:
      groupName - - The group name to map the element.
      currentDocument - - An instance of document object.
      previousDocument - - An previous iteration of document if exists.
      docElement - - An InfoEngine elements for current document
      targets - - The collection of targets
      Returns:
      The mapped InfoEngine document element.
      Throws:
      ESIRendererException
    • updateRoleAToLinkMap

      protected void updateRoleAToLinkMap(Persistable roleAObject, ESIAbstractDocumentsRenderer.DiffStatus status, Map<ObjectToObjectLink,Persistable>[] linksArray) throws ESIRendererException
      Called by compareAssemblyNodes and compareLeaves API after difference is calculated to accumulate the link information per object in internal collection of the renderer.

      Supported API: true
      Parameters:
      roleAObject - - A RoleA object.
      status - - A status for difference for an RoleA object.
      linksArray - - An array of map containing difference information for link in map. 0th element in array contains all added link map.
      1st element in array contains all deleted link map.
      2nd element in array contains all changed link map.
      3nd element in array contains all unchanged link map.
      Each map contains link as a key and RoleB object as a value.
      Throws:
      ESIRendererException
    • postRenderAssemblyNode

      protected void postRenderAssemblyNode(Persistable assemblyNode, ESIAbstractDocumentsRenderer.DiffStatus status, Persistable previousIteration) throws ESIRendererException
      Called by renderAssemblyNodes API in order to do post processing for every document assembly object based on change status.

      Supported API: true
      Parameters:
      assemblyNode - - The document assembly object
      status - - A status of object i.e. Added, Changed, Unchanged, Deleted etc.
      previousIteration - - The previous iteration of document assembly if exists
      Throws:
      ESIRendererException
    • postRenderLeaf

      protected void postRenderLeaf(Persistable leaf, ESIAbstractDocumentsRenderer.DiffStatus status, Persistable previousIteration) throws ESIRendererException
      Called by renderLeaves API in order to do post processing for every leaf node based on change status.

      Supported API: true
      Parameters:
      leaf - - The leaf object
      status - - A status of object i.e. Added, Changed, Unchanged, Deleted etc.
      previousIteration - - The previous iteration of leaf if exists
      Throws:
      ESIRendererException
    • processLinks

      protected void processLinks(Map<Persistable,Map<ObjectToObjectLink,Persistable>[]> linksInfo) throws ESIRendererException
      Processes all links in the document structure including references associated with documents API separates out all Added,Changed,Unchanged and deleted links for structure and reference links to getInfoEngine elements for the objects.
      • Calls renderDocumentLinks() to render links


      Supported API: true
      Parameters:
      linksInfo - - A map containing RoleA object as a key and an array of map containing difference information for link in map as value.
      A value array contains information as follows:
      0th element in array contains all added link map.
      1st element in array contains all deleted link map.
      2nd element in array contains all changed link map.
      3nd element in array contains all unchanged link map.
      Each map contains link as a key and RoleB object as a value.
      Throws:
      ESIRendererException
    • renderDocumentLinks

      protected void renderDocumentLinks(String groupName, Map<Persistable,Set<ESIAbstractDocumentsRenderer.LinkAndRoleBObject>> linksInfo, Map<String,com.infoengine.object.factory.Element> allDocLinkElements, boolean isStructureLink) throws ESIRendererException
      Renders document links. For each document link in the input map, it invokes mapDocumentStructureLink(...) /mapReferencedLink(...) method and adds the returned InfoEngine element to the VdbBuilder instance associated with this renderer.
      • Calls mapDocumentStructureLink() if isStructureLink is true else mapReferencedLink(...) to render links
      • Adds the mapped InfoEngine element to the VdbBuilder


      Supported API: true
      Parameters:
      groupName - - Name of the group in ESI response for which to perform the mapping.
      linksInfo - - Map containing RoleA Object and set of LinkAndRoleBObject object.
      allDocLinkElements - - InfoEngine elements corresponding to the document links in the input map.
      isStructureLink - - Indicates whether Map contains structure or reference/association links.
      Throws:
      ESIRendererException
    • mapDocumentStructureLink

      protected com.infoengine.object.factory.Element mapDocumentStructureLink(String groupName, Document assemblyNode, com.infoengine.object.factory.Element docStructureLinkElement, Collection<ESITarget> targets, ObjectToObjectLink docLink, Persistable roleBObject) throws ESIRendererException
      Performs the required mapping of attributes for the given document link that creates document structure. Call adjustDocumentLinkElement for customization.
      • Calls mapElement() to map the document element
      • Adds attribute values as per ESI business logic
      • Calls adjustObjectID() to adjust ObjectID.
      • Calls adjustTargets() to adjust TargetID.
      • Calls adjustDocumentElement to adjust values based on customised implementation


      Supported API: true
      Parameters:
      groupName - - Name of the group in ESI response for which to perform the mapping.
      assemblyNode - - The document assembly object having children.
      docStructureLinkElement - - An InfoEngine element for link.
      targets - - The collection of targets.
      docLink - - The structure link i.e. link used to create parent child structure.
      roleBObject - - The RoleB object i.e. child.
      Returns:
      Mapped InfoEngine element.
      Throws:
      ESIRendererException
    • mapReferencedLink

      protected com.infoengine.object.factory.Element mapReferencedLink(String groupName, Document referencedBy, com.infoengine.object.factory.Element docReferenceLinkElement, Collection<ESITarget> targets, ObjectToObjectLink docLink, Persistable roleBObject) throws ESIRendererException
      Performs the required mapping of attributes for the given document link that creates associates reference document . Call adjustDocumentLinkElement for customization.
      • Calls mapElement() to map the document element
      • Adds attribute values as per ESI business logic
      • Calls adjustObjectID() to adjust ObjectID.
      • Calls adjustTargets() to adjust TargetID.
      • Calls adjustDocumentElement to adjust values based on customised implementation


      Supported API: true
      Parameters:
      groupName - - Name of the group in ESI response for which to perform the mapping.
      referencedBy - - The referencedBy object that refers other document.
      docReferenceLinkElement - - An InfoEngine element for link.
      targets - - The collection of targets.
      docLink - - The reference link i.e. link used to refer document.
      roleBObject - - The RoleB object i.e. reference document.
      Returns:
      Mapped InfoEngine element.
      Throws:
      ESIRendererException
    • adjustDocumentLinkElement

      protected com.infoengine.object.factory.Element adjustDocumentLinkElement(com.infoengine.object.factory.Element element, String groupName, BinaryLink docLink, Collection<ESITarget> targets, Persistable roleAObject, Persistable roleBObject)
      Allow subclasses to fix the contents of an element before it's added to the output group(s). Default behaviour is to return the argument.

      Supported API: true
      Parameters:
      element - - InfoEngine element whose contents are to be fixed.
      groupName - - InfoEngine group name. The input element will be added to this group in the response.
      docLink - - document link.
      targets - - Collection of ESITarget objects.
      roleAObject - - The resolved iteration of role A object.
      roleBObject - - The resolved iteration of role B object.
      Returns:
      InfoEngine element having fixed data.
    • adjustDocumentLinkElement

      protected com.infoengine.object.factory.Element adjustDocumentLinkElement(com.infoengine.object.factory.Element element, String groupName, BinaryLink docLink, Collection<ESITarget> targets)
      Allow subclasses to fix the contents of an element before it's added to the output group(s). Default behaviour is to return the argument.

      Supported API: true
      Parameters:
      element - - InfoEngine element whose contents are to be fixed.
      groupName - - InfoEngine group name. The input element will be added to this group in the response.
      docLink - - document link.
      targets - - Collection of ESITarget objects.
      Returns:
      InfoEngine element having fixed data.
    • 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 behaviour 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 processed
      targets - - The collection of ESITarget objects.
      Returns:
      The adjusted document element.
      Throws:
      ESIRendererException
    • compareDocuments

      public abstract Set<Persistable>[] compareDocuments(Document currentIteration, Document previousIteration) throws WTException
      Compares two iterations of a document object.

      Supported API: true
      Parameters:
      currentIteration - -The document object with which previousIteration needs to be compared.
      previousIteration - - The document object that is used to compare currentIteration of document.
      Returns:
      An array of Sets containing the difference information between the input document iterations.
      Throws:
      WTException
    • getDeltaFlagName

      protected abstract String getDeltaFlagName()
      The flag name that is used to get the value for delta information needed while rendering the document/ document structure.

      Supported API: true
      Returns:
      The delta flag name.
    • getNumberOfLevelsFlagName

      protected abstract String getNumberOfLevelsFlagName()
      The flag name that is used to get the value for number of levels to be used to navigate document structure while rendering the document structure.

      Supported API: true
      Returns:
      The number of levels flag name.
    • getFilterFlagName

      protected abstract String getFilterFlagName()
      The flag name that is used to get the value for navigation filter to be used to navigate document structure while rendering the document structure.

      Supported API: true
      Returns:
      The navigation filter flag name.
    • getReferencedDocumentFlagName

      protected abstract String getReferencedDocumentFlagName()
      The flag name that is used to get the value for reference document to be used to render reference document while rendering the document/document structure.

      Supported API: true
      Returns:
      The reference document flag name.
    • getAssemblyHeaderReleaseClass

      protected abstract String getAssemblyHeaderReleaseClass(Persistable assemblyNode) throws WTException
      Returns the Release Class for document assembly objects.

      Supported API: true
      Parameters:
      assemblyNode - -The document assembly object having children.
      Returns:
      the Release Class for assembly node Objects
      Throws:
      WTException
    • getLeafReleaseClass

      protected abstract String getLeafReleaseClass(Persistable leaf) throws WTException
      Returns the Release Class for Leaf Objects.

      Supported API: true
      Parameters:
      leaf - -The leaf object i.e. child of assembly.
      Returns:
      the Release Class for Leaf Objects
      Throws:
      WTException
    • getStructureLinkClass

      protected abstract Class<? extends ObjectToObjectLink> getStructureLinkClass()
      Returns the link class that defines structure.

      Supported API: true
      Returns:
      The link class that defines structure.
    • getReferencedLinkClass

      protected abstract Class<? extends ObjectToObjectLink> getReferencedLinkClass()
      Returns the link class that defines reference association.

      Supported API: true
      Returns:
      The link class that defines reference association.
    • getAddedDocumentsGroupName

      protected abstract String getAddedDocumentsGroupName()
      Returns the group name for the added documents group. All sub classes must implement this method.

      Supported API: true
      Returns:
      the group name for the added documents objects.
    • getChangedDocumentsGroupName

      protected abstract String getChangedDocumentsGroupName()
      Returns the group name for the changed documents group. All sub classes must implement this method.

      Supported API: true
      Returns:
      the group name for the changed documents objects.
    • getUnchangedDocumentsGroupName

      protected abstract String getUnchangedDocumentsGroupName()
      Returns the group name for the unchanged documents group. All sub classes must implement this method.

      Supported API: true
      Returns:
      the group name for the unchanged documents objects.
    • getDeletdDocumentsGroupName

      protected abstract String getDeletdDocumentsGroupName()
      Returns the group name for the deleted documents group. All sub classes must implement this method.

      Supported API: true
      Returns:
      the group name for the deleted documents objects.
    • getAddedDocumentStructLinksGroupName

      protected abstract String getAddedDocumentStructLinksGroupName()
      Returns the group name for the added document's structure links group. All sub classes must implement this method.

      Supported API: true
      Returns:
      the group name for the added document's structure links objects.
    • getChangedDocumentStructLinksGroupName

      protected abstract String getChangedDocumentStructLinksGroupName()
      Returns the group name for the changed document's structure links group. All sub classes must implement this method.

      Supported API: true
      Returns:
      the group name for the changed document's structure links objects.
    • getUnchangedDocumentStructLinksGroupName

      protected abstract String getUnchangedDocumentStructLinksGroupName()
      Returns the group name for the unchanged document's structure links group. All sub classes must implement this method.

      Supported API: true
      Returns:
      the group name for the unchanged document's structure links objects.
    • getDeletedDocumentStructLinksGroupName

      protected abstract String getDeletedDocumentStructLinksGroupName()
      Returns the group name for the deleted document's structure links group. All sub classes must implement this method.

      Supported API: true
      Returns:
      the group name for the deleted document's structure links objects.
    • getAddedDocumentRefLinksGroupName

      protected abstract String getAddedDocumentRefLinksGroupName()
      Returns the group name for the added document's reference links group. All sub classes must implement this method.

      Supported API: true
      Returns:
      the group name for the added document's reference links objects.
    • getChangedDocumentRefLinksGroupName

      protected abstract String getChangedDocumentRefLinksGroupName()
      Returns the group name for the changed document's reference links group. All sub classes must implement this method.

      Supported API: true
      Returns:
      the group name for the changed document's reference links objects.
    • getUnchangedDocumentRefLinksGroupName

      protected abstract String getUnchangedDocumentRefLinksGroupName()
      Returns the group name for the unchanged document's reference links group. All sub classes must implement this method.

      Supported API: true
      Returns:
      the group name for the unchanged document's reference links objects.
    • getDeletedDocumentRefLinksGroupName

      protected abstract String getDeletedDocumentRefLinksGroupName()
      Returns the group name for the deleted document's reference links group. All sub classes must implement this method.

      Supported API: true
      Returns:
      the group name for the deleted document's reference links objects.
    • getIsAssemblyAttValue

      protected abstract String getIsAssemblyAttValue(Document document)
      Return the value for 'IsAssembly' attribute that needs to be set by mapDocumentElement(String, Document, Document, Element, Collection) for attribute.

      Supported API: true
      Parameters:
      document - - The document for which it needs to determine value for IsAssembly attribute
      Returns:
      the value that need to be set for 'IsAssembly' attribute