com.ptc.core.query.report.bom.common
Class BOMReportHelper

java.lang.Object
  extended by 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:
WARNING: Use of part numbers in this context in Windchill instances wherein WTPartMaster numbers are not globally unique can lead to results based on 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:
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 Summary
static boolean clientSupportsXSLT(String userAgentHeader)
          Determines whether the given browser client supports XSLT transformations.
static Object[] getReportObjectsAndTypes(WTContainerRef containerRef, String propertiesResource)
          Get a set of report objects and their types from a properties file resource.
static String getXSLTChainContentType(String[] xsltUrlStrings, boolean doTransformOnClient)
          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.
static void produceBOMAMLReport(Object rootPartRef, ConfigSpec configSpec, Object[] reportRefs, int[] reportTypes, Properties reportInputs, Locale locale, int levelLimit, String[] xsltUrlStrings, boolean doTransformOnClient, wt.method.WriterProxy writerProxy, String axlContext)
          Produce a hierarchical BOM with AML 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.
static void produceBOMAXLReport(Object rootPartRef, ConfigSpec configSpec, Object[] reportRefs, int[] reportTypes, Properties reportInputs, Locale locale, int levelLimit, String[] xsltUrlStrings, boolean doTransformOnClient, wt.method.WriterProxy writerProxy, String axlContext)
          Produce a hierarchical BOM with AML/AVL 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.
static void produceBOMReport(Object rootPartRef, ConfigSpec configSpec, Object[] reportRefs, int[] reportTypes, Properties reportInputs, Locale locale, int levelLimit, String[] xsltUrlStrings, boolean doTransformOnClient, wt.method.WriterProxy writerProxy)
          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.
static void produceBOMSoleReport(Object rootPartRef, ConfigSpec configSpec, Object[] reportRefs, int[] reportTypes, Properties reportInputs, Locale locale, int levelLimit, String[] xsltUrlStrings, boolean doTransformOnClient, wt.method.WriterProxy writerProxy, String axlContext)
          Produce a Sole Sourced OEM 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.
static void produceBOMUniqueReport(Object rootPartRef, ConfigSpec configSpec, Object[] reportRefs, int[] reportTypes, Properties reportInputs, Locale locale, int levelLimit, String[] xsltUrlStrings, boolean doTransformOnClient, wt.method.WriterProxy writerProxy, String axlContext)
          Produce a Unique AML 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.
static void produceConsolidatedBOMReport(Object[] rootPartRefs, double[] partQuantities, ConfigSpec configSpec, Object[] reportRefs, int[] reportTypes, Properties reportInputs, Locale locale, int levelLimit, String[] xsltUrlStrings, boolean doTransformOnClient, wt.method.WriterProxy writerProxy)
          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.
static void produceMultiBOMDiffReport(Object[] rootPartRefs, ConfigSpec[] configSpecs, Object[] reportRefs, int[] reportTypes, Properties reportInputs, Locale locale, int levelLimit, String[] xsltUrlStrings, boolean doTransformOnClient, wt.method.WriterProxy writerProxy)
          Produce a multiple BOM comparison BOM report.
static void produceMultiBOMReport(Object[] rootPartRefs, ConfigSpec[] configSpecs, Object[] reportRefs, int[] reportTypes, Properties reportInputs, Locale locale, int levelLimit, String[] xsltUrlStrings, boolean doTransformOnClient, wt.method.WriterProxy writerProxy)
          Produce a report consisting of multiple hierarchical BOM reports concatenated together.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

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,
                                    ConfigSpec configSpec,
                                    Object[] reportRefs,
                                    int[] reportTypes,
                                    Properties reportInputs,
                                    Locale locale,
                                    int levelLimit,
                                    String[] xsltUrlStrings,
                                    boolean doTransformOnClient,
                                    wt.method.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)
configSpec - ConfigSpec 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.

produceBOMAXLReport

public static void produceBOMAXLReport(Object rootPartRef,
                                       ConfigSpec configSpec,
                                       Object[] reportRefs,
                                       int[] reportTypes,
                                       Properties reportInputs,
                                       Locale locale,
                                       int levelLimit,
                                       String[] xsltUrlStrings,
                                       boolean doTransformOnClient,
                                       wt.method.WriterProxy writerProxy,
                                       String axlContext)
                                throws WTException
Produce a hierarchical BOM with AML/AVL 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)
configSpec - ConfigSpec 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 expandable BOM with AXL)
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.
axlContext - AXLContext object identifier string.
Throws:
WTException - Encapsulates any client or server tracked exception that may have occurred.

produceBOMAMLReport

public static void produceBOMAMLReport(Object rootPartRef,
                                       ConfigSpec configSpec,
                                       Object[] reportRefs,
                                       int[] reportTypes,
                                       Properties reportInputs,
                                       Locale locale,
                                       int levelLimit,
                                       String[] xsltUrlStrings,
                                       boolean doTransformOnClient,
                                       wt.method.WriterProxy writerProxy,
                                       String axlContext)
                                throws WTException
Produce a hierarchical BOM with AML 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)
configSpec - ConfigSpec 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 expandable BOM with AXL)
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.
axlContext - AXLContext object identifier string.
Throws:
WTException - Encapsulates any client or server tracked exception that may have occurred.

produceBOMSoleReport

public static void produceBOMSoleReport(Object rootPartRef,
                                        ConfigSpec configSpec,
                                        Object[] reportRefs,
                                        int[] reportTypes,
                                        Properties reportInputs,
                                        Locale locale,
                                        int levelLimit,
                                        String[] xsltUrlStrings,
                                        boolean doTransformOnClient,
                                        wt.method.WriterProxy writerProxy,
                                        String axlContext)
                                 throws WTException
Produce a Sole Sourced OEM 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)
configSpec - ConfigSpec 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 expandable BOM with AXL)
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.
axlContext - AXLContext object identifier string.
Throws:
WTException - Encapsulates any client or server tracked exception that may have occurred.

produceBOMUniqueReport

public static void produceBOMUniqueReport(Object rootPartRef,
                                          ConfigSpec configSpec,
                                          Object[] reportRefs,
                                          int[] reportTypes,
                                          Properties reportInputs,
                                          Locale locale,
                                          int levelLimit,
                                          String[] xsltUrlStrings,
                                          boolean doTransformOnClient,
                                          wt.method.WriterProxy writerProxy,
                                          String axlContext)
                                   throws WTException
Produce a Unique AML 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)
configSpec - ConfigSpec 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 expandable BOM with AXL)
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.
axlContext - AXLContext object identifier string.
Throws:
WTException - Encapsulates any client or server tracked exception that may have occurred.

produceConsolidatedBOMReport

public static void produceConsolidatedBOMReport(Object[] rootPartRefs,
                                                double[] partQuantities,
                                                ConfigSpec configSpec,
                                                Object[] reportRefs,
                                                int[] reportTypes,
                                                Properties reportInputs,
                                                Locale locale,
                                                int levelLimit,
                                                String[] xsltUrlStrings,
                                                boolean doTransformOnClient,
                                                wt.method.WriterProxy writerProxy)
                                         throws WTException
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'
configSpec - ConfigSpec 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

public static void produceMultiBOMDiffReport(Object[] rootPartRefs,
                                             ConfigSpec[] configSpecs,
                                             Object[] reportRefs,
                                             int[] reportTypes,
                                             Properties reportInputs,
                                             Locale locale,
                                             int levelLimit,
                                             String[] xsltUrlStrings,
                                             boolean doTransformOnClient,
                                             wt.method.WriterProxy writerProxy)
                                      throws WTException
Produce a multiple BOM comparison BOM report.

Supported API: true

Parameters:
rootPartRefs - References to top-level parts to produce report for (see class doc)
configSpecs - ConfigSpecs 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 - - 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.
Throws:
WTException - Encapsulates any client or server tracked exception that may have occurred.

produceMultiBOMReport

public static void produceMultiBOMReport(Object[] rootPartRefs,
                                         ConfigSpec[] configSpecs,
                                         Object[] reportRefs,
                                         int[] reportTypes,
                                         Properties reportInputs,
                                         Locale locale,
                                         int levelLimit,
                                         String[] xsltUrlStrings,
                                         boolean doTransformOnClient,
                                         wt.method.WriterProxy writerProxy)
                                  throws WTException
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)
configSpecs - ConfigSpecs 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 - - 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.
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