Class ESIWTPartRenderer

All Implemented Interfaces:
ESIRenderer, com.ptc.windchill.esi.translation.ESITranslationRenderer
Direct Known Subclasses:
ESIMadeFromObjectRenderer

public class ESIWTPartRenderer extends ESIAbstractEDRenderer implements com.ptc.windchill.esi.translation.ESITranslationRenderer
This class has methods to render a stand-alone part and build the relevant portions of the ESI response.

Supported API: true

Extendable: true
  • Method Details

    • getParts

      protected Collection getParts()
      Gets the value of the attribute: parts; The list of parts that are to be rendered.

      Supported API: true
      Returns:
      Collection
    • getRoot

      protected WTPart getRoot()
      Gets the value of the attribute: root; The base part of a tree of product structures.

      Supported API: true
      Returns:
      WTPart
    • isAlternatesRequired

      protected boolean isAlternatesRequired()
      Gets the value of the attribute: alternatesRequired; Should the renderer obtain the alternates to the parts that are to be rendered?

      Supported API: true
      Returns:
      boolean
    • isDocumentsRequired

      protected boolean isDocumentsRequired()
      Gets the value of the attribute: documentsRequired; Should the renderer call the document renderer?

      Supported API: true
      Returns:
      boolean
    • getTransactionID

      protected String getTransactionID()
      Gets the value of the attribute: transactionID; The idNumber attribute value of an ESITransaction that is to be associated with this renderer.

      Supported API: true
      Returns:
      String
    • validate

      protected void validate() throws ESIRendererException
      Make sure the object is ready to process. If root, auth, or wcAdapter are null, throws an exception.

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

      protected void buildGroups() throws ESIRendererException
      Output generator for the class. Does the following:
      1. Obtains the contents of the parts collection.
      2. Finds the ESI targets associated with the parts. Trims the collection of targets to contain only that associated with the currently processed ESI transaction.
      3. Finds the most current released version of the part for the above fetched target.
      4. Compares the current version to the most current version. If they are the same and the effectivity has not changed, the part is ignored.
      5. If the part is not ignored, calls the Windchill Adapter to obtain all the attributes of the part.
      6. Maps the result of the Windchill Adapter call.
      7. Calls adjustPartElement().
      8. If documents are required, calls the document renderer.
      As mentioned in (2) above, the method considers only the ESI target associated to the currently processed ESI transaction for building the output. This change is effective as of R10.0.

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

      protected Collection<ESITargetAssociation> getPreviousExportedIterations(Collection<ESITargetAssociation> currTargetAssoc) throws WTException
      Returns the previous exported iteration for each part and target combination from the input target associations. Invokes the API ESITransactionUtility.latestPartExport(Collection).

      Supported API: true
      Parameters:
      currTargetAssoc - - Collection of target associations. Typically, the target association between the part being processed and the current target.
      Returns:
      Collection of target associations between the previous exported iteration and the current target.
      Throws:
      WTException
    • adjustPartElement

      protected com.infoengine.object.factory.Element adjustPartElement(com.infoengine.object.factory.Element element, String group, WTPart part, List<Eff>[] effs, Collection targets) throws ESIRendererException
      Allow subclasses to fix the contents of an element.

      Supported API: true
      Parameters:
      element -
      group -
      part -
      effs - May be null.
      targets - Collection of ESITarget objects.
      Returns:
      Element
      Throws:
      ESIRendererException
    • adjustPartElement

      protected com.infoengine.object.factory.Element adjustPartElement(com.infoengine.object.factory.Element element, String group, WTPart part, Eff[] effs, Collection targets) throws ESIRendererException
      Allows subclasses to fix the contents of an I*E element. This overloaded version differs from the other version in that it takes an array of Eff instances rather than a single Eff object.

      Supported API: true
      Parameters:
      element - I*E Element whose contents need to be fixed.
      group - Name of the group in ESI response for which to adjust the I*E element.
      part - WTPart instance that is relevant to the operation.
      effs - Array of Effs containing the latest date, serial number and lot number effectivity values associated with the passed part.
      targets - Collection of ESITarget objects.
      Returns:
      Element
      Throws:
      ESIRendererException
    • adjustAlternateElement

      protected com.infoengine.object.factory.Element adjustAlternateElement(com.infoengine.object.factory.Element element, String group, WTPart part, Collection targets) throws ESIRendererException
      Allow subclasses to fix the contents of an element.

      Supported API: true
      Parameters:
      element -
      group -
      part -
      targets - Collection of ESITarget objects.
      Returns:
      Element
      Throws:
      ESIRendererException
    • getPart

      public void getPart(WTPart root, Collection<WTPart> children, boolean alternates, boolean documents, String auth, String wcAdapter, VdbBuilder builder) throws WTException
      GetPart RPC processor when called from GetBOM or getECN RPC. Validates arguments then creates a VDBBuilder if one hasn't already been provided. Creates a PartRenderer. Passes control to the renderer. Does not call asVDB() on the renderer because the caller of this method is responsible to do that.

      Supported API: true
      Parameters:
      root - The primary part for the BOM. Needed if target assignments are implicit.
      children - A collection of WTParts that are to be released. These parts are presumed to not be the root.
      alternates - true or false. If true, will return alternates parts for the part in question.
      documents - true or false. If true, will return the documents for the part in question. If alternates is true, will return the documents for the alternate parts.
      auth - This parameter contains authentication information from I*E
      wcAdapter - This parameter contains the name of the Windchill adapter.
      builder -
      Throws:
      WTException
    • getPart

      public void getPart(WTPart root, Collection<WTPart> children, boolean alternates, boolean documents, String auth, String wcAdapter, VdbBuilder builder, Collection enterpriseDataObjects) throws WTException
      GetPart RPC processor when called from GetBOM or getECN RPC. Validates arguments then creates a VDBBuilder if one hasn't already been provided. Creates a PartRenderer. Passes control to the renderer. Does not call asVDB() on the renderer because the caller of this method is responsible to do that.

      Supported API: true
      Parameters:
      root - The primary part for the BOM. Needed if target assignments are implicit.
      children - A collection of WTParts that are to be released. These parts are presumed to not be the root.
      alternates - true or false. If true, will return alternates parts for the part in question.
      documents - true or false. If true, will return the documents for the part in question. If alternates is true, will return the documents for the alternate parts.
      auth - This parameter contains authentication information from I*E
      wcAdapter - This parameter contains the name of the Windchill adapter.
      builder -
      Throws:
      WTException
    • setData

      public void setData(WTPart root, Collection<WTPart> parts, boolean buildAlts, boolean buildDocs, String auth, String wcAdapter, String transactionID)
      Establish the renderer's state so that it can process requests.

      Supported API: true
      Parameters:
      root - - The primary part to process. May not be null. If multiple parts are to be processed, the - renderer will use the root as the base part for target determination.
      parts - - A collection of additional parts to process. May be empty.
      buildAlts - - Specifies whether or not alternates associated to the part are to be returned by the renderer.
      buildDocs - - Specifies whether or not documents associated to the part are to be returned by the renderer.
      auth - - Info*Engine authentication information to use when executing a query task.
      wcAdapter - - Windchill adapter instance name to use when executing a webject.
      transactionID - Optional transaction ID to pass to the VDB builder.
    • setData

      public void setData(Persistable enterpriseData)
      Establish the renderer's state so that it can process requests.

      Supported API: true
      Parameters:
      enterpriseData - - Enterprise Data object associated with WTPart.
    • setData

      public void setData(Collection enterpriseDataObjects)
      Establish the renderer's state so that it can process requests.

      Supported API: true
      Parameters:
      enterpriseDataObjects - - Collection of Enterprise Data objects associated with WTPart.
    • getPart

      public void getPart(WTPart root, Collection<WTPart> children, boolean alternates, boolean documents, String auth, String wcAdapter, VdbBuilder builder, ESIAbstractStructureRenderer bomRenderer) throws WTException
      An overloaded version that may be called from getBOM() or getECN(). Invokes render() but does not call asVDB() since the caller of this method is responsible for doing that.

      Supported API: true
      Parameters:
      root - The primary part for the BOM. Needed if target assignments are implicit.
      children - A collection of WTParts that are to be released. These parts are presumed to not be the root.
      alternates - true or false. If true, will return alternates parts for the part in question.
      documents - true or false. If true, will return the documents for the part in question. If alternates is true, will return the documents for the alternate parts.
      auth - This parameter contains authentication information from I*E
      wcAdapter - This parameter contains the name of the Windchill adapter.
      builder - VdbBuilder instance to be populated with the rendered part information.
      bomRenderer - ESIBOMRenderer instance; this is used for processing alternate parts that are assemblies themselves.
      Throws:
      WTException
    • setData

      public void setData(WTPart root, Collection<WTPart> parts, boolean buildAlts, boolean buildDocs, String auth, String wcAdapter, String transactionID, ESIAbstractStructureRenderer abstractStructureRender)
      Establish the renderer's state so that it can process requests. This is an overloaded version that takes in an ESIBOMRenderer instance besides other parameters.

      Supported API: true
      Parameters:
      root - The primary part to process. May not be null. If multiple parts are to be processed, the renderer will use the root as the base part for target determination.
      parts - A collection of additional parts to process. May be empty.
      buildAlts - Specifies whether or not alternates associated to the part are to be returned by the renderer.
      buildDocs - Specifies whether or not documents associated to the part are to be returned by the renderer.
      auth - Info*Engine authentication information to use when executing a query task.
      wcAdapter - Windchill adapter instance name to use when executing a webject.
      transactionID - Optional transaction ID to pass to the VDB builder.
      abstractStructureRender - ESIBOMRenderer instance that was used for rendering the BOM whose parts are being processed by this renderer.
    • getPart

      public com.infoengine.object.IeCollection getPart(String objectID, ESITransaction txn, Collection<ESITarget> tgts, String auth, String wcAdapter, boolean useECNDTAttrs) throws WTException
      Creates a VdbBuilder instance for the input transaction, renders the input part and creates release activities as appropriate for each of the distribution targets in tgts. The settings pertaining to ESI response generation for a given distribution target are fetched from the target itself. Returns the rendered output as an Info*Engine collection to the caller.

      Supported API: true
      Parameters:
      objectID - UFID of the part 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 - This parameter contains authentication information required for executing certain Windchill adapter webjects as part of the rendering process.
      wcAdapter - This parameter contains the name of the Windchill adapter instance.
      useECNDTAttrs - If true, distribution target attributes that figure in the ECN Settings section will be used for the response generation; otherwise, attributes that figure in the Part Section will be used. For example, a true will be passed for this parameter when the method is invoked for the Preview functionality and the preference "Automatically Generate Change Notice" has a value "Yes".
      Returns:
      IeCollection The Info*Engine collection that holds the ESI response.
      Throws:
      WTException - - if any of the invoked methods throws this exception.
    • getPart

      public com.infoengine.object.IeCollection getPart(String objectID, ESITransaction txn, Collection<ESITarget> tgts, String auth, String wcAdapter, boolean useECNDTAttrs, Persistable enterpriseDataObj, Collection enterpriseDataObjects, Collection partObjects) throws WTException
      Creates a VdbBuilder instance for the input transaction, renders the input part and creates release activities as appropriate for each of the distribution targets in tgts. The settings pertaining to ESI response generation for a given distribution target are fetched from the target itself. Returns the rendered output as an Info*Engine collection to the caller.

      Supported API: true
      Parameters:
      objectID - UFID of the part 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 - This parameter contains authentication information required for executing certain Windchill adapter webjects as part of the rendering process.
      wcAdapter - This parameter contains the name of the Windchill adapter instance.
      useECNDTAttrs - If true, distribution target attributes that figure in the ECN Settings section will be used for the response generation; otherwise, attributes that figure in the Part Section will be used. For example, a true will be passed for this parameter when the method is invoked for the Preview functionality and the preference "Automatically Generate Change Notice" has a value "Yes".
      Returns:
      IeCollection The Info*Engine collection that holds the ESI response.
      Throws:
      WTException - - if any of the invoked methods throws this exception.
    • getRootToFetchOpionSetInfo

      protected Persistable getRootToFetchOpionSetInfo(WTPart part)
      Returns the root object to be used for fetching the option set information. This method is intended to be overridden by a customizer if they want to use a different root other than the input part. It returns the input part by default. The renderer "com.ptc.windchill.esi.ov.ChoiceMappableChoiceLinkRenderer" uses this object to find the appropriate option set for the current part being rendered. Check the java doc of this renderer for more information.

      Supported API: true
      Parameters:
      part - - WTPart
      Returns:
    • getContextToFetchOptionSetInfo

      protected Persistable getContextToFetchOptionSetInfo(WTPart part)
      Returns the context object to be used for fetching the option set information. This method is intended to be overridden by a customizer if they want to use a different context other than the input part. It returns the input part by default. The renderer "com.ptc.windchill.esi.ov.ChoiceMappableChoiceLinkRenderer" uses this object to render appropriate context information in the response. Check the java doc of this renderer for more information.

      Supported API: true
      Parameters:
      part - - WTPart
      Returns:
    • renderCurrentAlternates

      @Deprecated protected boolean renderCurrentAlternates()
      Deprecated.
      API and implementation will be replaced in future relase.

      Supported API: true
      Indicates renderer how alternates should be render. When API returns 'true' all current alternates will be rendered as added alternates. OOTB API returns 'true' or 'false' based on the optional property "com.ptc.windchill.esi.RenderCurrentAlternates"
      Returns:
      - The value of the property "com.ptc.windchill.esi.RenderCurrentAlternates".