Class BOMReportHelper

java.lang.Object
com.ptc.core.query.report.bom.common.BOMReportHelper

public class BOMReportHelper extends Object
Helper class to hide remote forwarding to BOMReportService. Exposes ability to produce several BOM reports as XML with XSLT styling. These report (unless otherwise noted) allow additional data to be collected via QueryBuilder ReportTemplate's (and/or implementations of Reportable) and correlated in to the results.

Various methods throughout this class take Object or Object[] arguments which are called "references". This ambiguous terminology and typing requires some explanation. [This arose to provide backward API compatibility while supporting new data constraints.]

For "part" references, each of these objects can be any of the following:
  • Object or version reference string for a WTPartMaster or WTPart
  • ObjectIdentifier or WTReference for a WTPartMaster or WTPart
  • WTPartMaster
  • WTPart
  • Part number [deprecated]
WARNING: Use of part numbers in this context in Windchill instances wherein WTPartMaster numbers are not globally unique can lead to results based on invalid input: '<'span any part whose number matches that specified! It is therefore suggested that such references be converted to one of the other forms.
For "report" references, each of these objects can be any of the following:
  • Object reference string for a ReportTemplate
  • ObjectIdentifier or ObjectReference for a ReportTemplate
  • Class which implements Reportable interface
  • ReportTemplate
  • String array containing the SOAP class and method (in that order) of a report task
  • Name of class which implements Reportable interface [deprecated]
  • Name of ReportTemplate [deprecated]
WARNING: Use of ReportTemplate names in this context in Windchill instances wherein ReportTemplate names are not globally unique can lead to results based on any ReportTemplate whose number matches that specified! Moreover, due to flexible logic required to allow all of these types of references, ReportTemplate name and Reportable class name references passed to these methods cannot be resolved as efficiently as the other forms of references. It is therefore suggested that such references be converted to one of the other forms.


Supported API: true

Extendable: false

  • Method Details

    • getXSLTChainContentType

      public static String getXSLTChainContentType(String[] xsltUrlStrings, boolean doTransformOnClient) throws WTException
      Get Content-Type HTTP header value for results produced by the other methods in this class for the given XSLT transformations and knowledge as to whether they are to be done on the client or server.

      Supported API: true
      Parameters:
      xsltUrlStrings - Same value as that to be passed to produce*Report method
      doTransformOnClient - Same value as that to be passed to produce*Report method
      Returns:
      Content-Type HTTP header string
      Throws:
      WTException - Encapsulates any client or server tracked exception that may have occurred.
    • produceBOMReport

      public static void produceBOMReport(Object rootPartRef, NavigationCriteria navCriteria, Object[] reportRefs, int[] reportTypes, Properties reportInputs, Locale locale, int levelLimit, String[] xsltUrlStrings, boolean doTransformOnClient, WriterProxy writerProxy) throws WTException
      Produce a hierarchical BOM report for a given part and a given set of ReportTemplates or other Reportables by producing XML data and transforming it with one or more specified XSLT stylesheets. The output is returned via 'writerProxy'.

      Supported API: true
      Parameters:
      rootPartRef - Object referencing root part (see class doc)
      navCriteria - NavigationCriteria to use to select part iterations
      reportRefs - Objects referencing ReportTemplates and/or implementations of Reportable to apply to obtain additional data (see class doc)
      reportTypes - Types of reports (as per BOMReportConstants); parallel array to reportRefs
      reportInputs - Additional inputs to reports (beyond ids that will be provided from expanded BOM)
      locale - Locale to return results in
      levelLimit - BOM traversal depth limit; if less than zero, the traversal is unbounded
      xsltUrlStrings - URLs to XSLT stylesheets to apply to XML results; relative URLs are evaluated as 'file:' URLs relative to the server codebase
      doTransformOnClient - If true, the first XSLT URL will be inserted into the XML as a processing instruction before the XML is returned. If false, the XSLT transformations will be done in order on the server.
      writerProxy - Proxy-writer allowing streaming writes to client.
      Throws:
      WTException - Encapsulates any client or server tracked exception that may have occurred.
    • produceConsolidatedBOMReport

      @Deprecated public static void produceConsolidatedBOMReport(Object[] rootPartRefs, double[] partQuantities, NavigationCriteria navCriteria, Object[] reportRefs, int[] reportTypes, Properties reportInputs, Locale locale, int levelLimit, String[] xsltUrlStrings, boolean doTransformOnClient, WriterProxy writerProxy) throws WTException
      Deprecated.
      see SingleLevelConsolidatedBOMTableBuilder Will be deleted in next release
      Produce a "consolidated" BOM report for a given part and a given set of ReportTemplates or other Reportables by producing XML data and transforming it with one or more specified XSLT stylesheets. The output is returned via 'writerProxy'.

      Supported API: true
      Parameters:
      rootPartRefs - References to top-level parts to produce report for (see class doc)
      partQuantities - Quantities of each top-level part; parallel array to 'partNumbers'
      navCriteria - NavigationCriteria to use to select part iterations
      reportRefs - Objects referencing ReportTemplates and/or implementations of Reportable to apply to obtain additional data (see class doc)
      reportTypes - Types of reports (as per BOMReportConstants); parallel array to reportNames
      reportInputs - Additional inputs to reports (beyond ids that will be provided from expanded BOM)
      locale - Locale to return results in
      levelLimit - BOM traversal depth limit; if less than zero, the traversal is unbounded
      xsltUrlStrings - URLs to XSLT stylesheets to apply to XML results; relative URLs are evaluated as 'file:' URLs relative to the server codebase
      doTransformOnClient - If true, the first XSLT URL will be inserted into the XML as a processing instruction before the XML is returned. If false, the XSLT transformations will be done in order on the server.
      writerProxy - Proxy-writer allowing streaming writes to client.
      Throws:
      WTException - Encapsulates any client or server tracked exception that may have occurred.
    • produceMultiBOMDiffReport

      @Deprecated public static void produceMultiBOMDiffReport(Object[] rootPartRefs, NavigationCriteria[] navCriteria, Object[] reportRefs, int[] reportTypes, Properties reportInputs, Locale locale, int levelLimit, String[] xsltUrlStrings, boolean doTransformOnClient, WriterProxy writerProxy) throws WTException
      Deprecated.
      Will be deleted in next release
      Produce a multiple BOM comparison BOM report.

      Supported API: true
      Parameters:
      rootPartRefs - References to top-level parts to produce report for (see class doc)
      reportRefs - Objects referencing ReportTemplates and/or implementations of Reportable to apply to obtain additional data (see class doc)
      reportTypes - Types of reports (as per BOMReportConstants); parallel array to reportNames
      reportInputs - Additional inputs to reports (beyond ids that will be provided from expanded BOM)
      locale - Locale to return results in
      levelLimit - - The limit on how many levels deep to go down in the BOMs.
      xsltUrlStrings - URLs to XSLT stylesheets to apply to XML results; relative URLs are evaluated as 'file:' URLs relative to the server codebase
      doTransformOnClient - If true, the first XSLT URL will be inserted into the XML as a processing instruction before the XML is returned. If false, the XSLT transformations will be done in order on the server.
      writerProxy - Proxy-writer allowing streaming writes to client.
      configSpecs - ConfigSpecs to use to select part iterations
      Throws:
      WTException - Encapsulates any client or server tracked exception that may have occurred.
    • produceMultiBOMReport

      @Deprecated public static void produceMultiBOMReport(Object[] rootPartRefs, NavigationCriteria[] navCriteria, Object[] reportRefs, int[] reportTypes, Properties reportInputs, Locale locale, int levelLimit, String[] xsltUrlStrings, boolean doTransformOnClient, WriterProxy writerProxy) throws WTException
      Deprecated.
      see MultiLevelBOMReportTreeBuilder Will be deleted in next release
      Produce a report consisting of multiple hierarchical BOM reports concatenated together.

      Supported API: true
      Parameters:
      rootPartRefs - References to top-level parts to produce report for (see class doc)
      reportRefs - Objects referencing ReportTemplates and/or implementations of Reportable to apply to obtain additional data (see class doc)
      reportTypes - Types of reports (as per BOMReportConstants); parallel array to reportNames
      reportInputs - Additional inputs to reports (beyond ids that will be provided from expanded BOM)
      locale - Locale to return results in
      levelLimit - - The limit on how many levels deep to go down in the BOMs.
      xsltUrlStrings - URLs to XSLT stylesheets to apply to XML results; relative URLs are evaluated as 'file:' URLs relative to the server codebase
      doTransformOnClient - If true, the first XSLT URL will be inserted into the XML as a processing instruction before the XML is returned. If false, the XSLT transformations will be done in order on the server.
      writerProxy - Proxy-writer allowing streaming writes to client.
      configSpecs - ConfigSpecs to use to select part iterations
      Throws:
      WTException - Encapsulates any client or server tracked exception that may have occurred.
    • getReportObjectsAndTypes

      public static Object[] getReportObjectsAndTypes(WTContainerRef containerRef, String propertiesResource) throws WTException
      Get a set of report objects and their types from a properties file resource. The properties file has the following format:
             report.1.type={report type number}                     - AND -
             report.1.name={report template name}                      - OR -
             report.1.class={implementation of Reportable interface}   - OR -
             report.1.soapClass={name of report task SOAP class}          - AND -
             report.1.soapMethod={name of report task SOAP method}
             report.2...
       
      Example:
             report.1.name=test
             report.1.type=1
             report.2.class=com.myco.MyReportableClass
             report.2.type=3
             report.3.soapClass=WCTYPE|com.ptc.windchill.enterprise.report.ReportTask
             report.3.soapMethod=MyReportTaskMethod
             report.3.type=2
       
      Notes:
      • Reports should meet qualifications laid out in package Javadoc for com.ptc.core.query.report.bom.common.
      • Report type numbers are defined in the package Javadoc for com.ptc.core.query.report.bom.common
      • Reports are searched for by name by up the container tree from the container indicated.
      • Numbers of report entries do not need to be consecutive.


      Supported API: true
      Parameters:
      containerRef - Reference to container to base search in
      containerRef - Resource path (ala getResourceAsStream()) to properties file to read
      Returns:
      Array of objects with 2 elements; first element is Object[] of report elements and the second is int[] of report types.
      Throws:
      WTException - Encapsulates any client or server tracked exception that may have occurred.
    • clientSupportsXSLT

      public static boolean clientSupportsXSLT(String userAgentHeader)
      Determines whether the given browser client supports XSLT transformations. Currently only recognizes IE 6.0 and higher as XSLT-capable.

      Supported API: true
      Parameters:
      userAgentHeader - Value of HTTP "User-Agent" header
      Returns:
      Whether given client supports client-side XSLT transformations