Class DiagnosticsViewerTransformHelper
- java.lang.Object
 - 
- com.microstrategy.web.admin.transforms.DiagnosticsViewerTransformHelper
 
 
- 
public class DiagnosticsViewerTransformHelper extends java.lang.ObjectTitle: DiagnosticsViewerTransformHelper This class provides a series of helper methods for building up the XML that will be displayed to the user as Log Diagnostic information- Since:
 - MicroStrategy Web 7.3.1 or earlier
 
 
- 
- 
Field Summary
Fields Modifier and Type Field Description static intFILE_READING_EXCEPTIONIdentifier for exceptions generated related with problems reading a file on the specified path locationstatic intWRONG_PARAMETERS_EXCEPTIONIdentifier for exceptions generated related with wrong parameters received in the method callstatic intXML_PARSING_EXCEPTIONIdentifier for exceptions generated related with XML Parsing of a String or a File 
- 
Constructor Summary
Constructors Constructor Description DiagnosticsViewerTransformHelper() 
- 
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static HashListgenerateNumericComboContents(int start, int end)Generate a combo box with the value range specified.static java.io.BufferedReadergetDiagnosticHTMLContent(DiagnosticsBean bean, java.lang.String xslPath, org.w3c.dom.Document originalXML)Based on the XML received, transform it with the XSL indicated and return the result of the transform on a BufferedReader instance.static org.w3c.dom.NodeListgetSingleFileContent(DOMSupport domSupport, org.w3c.dom.Document xmlDocument, java.lang.String filePath)Reads the contents of the file specified on the path, adds a beginning and ending tag for it to be translated into an XML Document format.static java.lang.StringgetXMLLogFileContents(DiagnosticsBean bean, DOMSupport domSupport, org.w3c.dom.Document xmlDocument)Given theDiagnosticsBeaninstance properties regarding start and end dates to display log files, get the file information and gather it on aDocumentinstance.static voidrenderBufferedReaderContents(MarkupOutput out, java.io.BufferedReader bufferedReader)Save the contents of theBufferedReaderinstance into theMarkupOutputinstance so they can be displayed to the user.static voidrenderDateComboBoxes(MarkupOutput out, java.lang.String formatString, int year, int month, int day, java.lang.String paramYear, java.lang.String paramMonth, java.lang.String paramDay)For the given year, month and day information, the format and the name of the parameters to use, generate three combo boxes for allowing users to select dates.static org.w3c.dom.DocumentsortDiagnosticXMLFile(DiagnosticsBean bean, java.lang.String xslPath, org.w3c.dom.Document originalXML)Given an original XML file, it transforms it with the xsl file specified.static booleanvalidateDate(java.util.Calendar fromDate, java.util.Calendar toDate, DiagnosticsBean bean)Validate the dates specified by the user. 
 - 
 
- 
- 
Field Detail
- 
XML_PARSING_EXCEPTION
public static final int XML_PARSING_EXCEPTION
Identifier for exceptions generated related with XML Parsing of a String or a File- See Also:
 - Constant Field Values
 
 
- 
WRONG_PARAMETERS_EXCEPTION
public static final int WRONG_PARAMETERS_EXCEPTION
Identifier for exceptions generated related with wrong parameters received in the method call- See Also:
 - Constant Field Values
 
 
- 
FILE_READING_EXCEPTION
public static final int FILE_READING_EXCEPTION
Identifier for exceptions generated related with problems reading a file on the specified path location- See Also:
 - Constant Field Values
 
 
 - 
 
- 
Method Detail
- 
getSingleFileContent
public static org.w3c.dom.NodeList getSingleFileContent(DOMSupport domSupport, org.w3c.dom.Document xmlDocument, java.lang.String filePath) throws WebAppException
Reads the contents of the file specified on the path, adds a beginning and ending tag for it to be translated into an XML Document format.- Parameters:
 domSupport-DOMSupportinitialized instancexmlDocument- originalDocumentinstance where the generated XML node list will be copied over.filePath-Stringwith the location and name of the file to read- Returns:
 - a 
NodeListinstance initialized with the contents of the file. The tags added for it to be a valid XML Document are removed, so the original children are the ones returned - Throws:
 WebAppException- if any problem happens while reading the file contents or building up the XML structure. The exceptions will use codes such asXML_PARSING_EXCEPTION,WRONG_PARAMETERS_EXCEPTION, etc.
 
- 
getXMLLogFileContents
public static java.lang.String getXMLLogFileContents(DiagnosticsBean bean, DOMSupport domSupport, org.w3c.dom.Document xmlDocument) throws WebAppException
Given theDiagnosticsBeaninstance properties regarding start and end dates to display log files, get the file information and gather it on aDocumentinstance.- Parameters:
 bean-DiagnosticsBeancurrently being transformeddomSupport- initializedDOMSupportinstancexmlDocument-Documentinstance where the XML contents of the files will be saved.- Returns:
 - a 
Stringwith the information of those log files that was not possible to read. By specification, if there are log file contents to display even that some files failed, an empty string will be returned. - Throws:
 WebAppException
 
- 
validateDate
public static boolean validateDate(java.util.Calendar fromDate, java.util.Calendar toDate, DiagnosticsBean bean) throws WebAppExceptionValidate the dates specified by the user.- Parameters:
 fromDate- aCalendarinstance initialized with the start date, loaded from individual year, month and day valuestoDate- aCalendarinstance initialized with the end date, loaded from individual year, month and day valuesbean- theDiagnosticsBeaninstance being transformed, and where the start and end dates are also stored.- Returns:
 Trueif the dates are valid- Throws:
 WebAppException- if an error happens while analyzing the dates or if the dates are not validated properly. For example, if the start date is after the end date, if a date does not make sense (Feb 30), etc.
 
- 
generateNumericComboContents
public static HashList generateNumericComboContents(int start, int end)
Generate a combo box with the value range specified. Used for building up combo boxes for representing days, months or years.- Parameters:
 start- number where to start the list (inclusive)end- number where to end the list (inclusive)- Returns:
 - a HashList with the contents for the combo box to generate. For example, if specifying start = 1 and end = 30, it
 will generate a combo box that can be used for representing months like April, June, etc. This combo box can later
 on be input argument for one of the display combo boxes methods available on 
HTMLHelper 
 
- 
sortDiagnosticXMLFile
public static org.w3c.dom.Document sortDiagnosticXMLFile(DiagnosticsBean bean, java.lang.String xslPath, org.w3c.dom.Document originalXML) throws WebAppException
Given an original XML file, it transforms it with the xsl file specified. This method will mostly be used for sorting the contents of the log XML file given the configuration fields there included as well as the specifications on the XSL to be used.- Parameters:
 bean-DiagnosticsBeancurrently being transformedxslPath- aStringwith the location of the XSL file to use for transforming the XML. Commonly, /WEB-INF/xml/SortErrors.xsl can be used.originalXML- the original XML containing the log information to be sorted- Returns:
 - a 
Documentinstance with the sorted XML - Throws:
 WebAppException- if any error happens while transforming the XML
 
- 
getDiagnosticHTMLContent
public static java.io.BufferedReader getDiagnosticHTMLContent(DiagnosticsBean bean, java.lang.String xslPath, org.w3c.dom.Document originalXML) throws WebAppException
Based on the XML received, transform it with the XSL indicated and return the result of the transform on a BufferedReader instance. Used normally for getting HTML from the XML and later on display it to the user.- Parameters:
 bean-DiagnosticsBeancurrently being transformedxslPath- aStringwith the location of the XSL file to use for transforming the XML. Commonly, /WEB-INF/xml/DisplayErrors.xsl can be used.originalXML- the original XML containing the log information to be sorted- Returns:
 - a 
BufferedReaderinstance with the contents of the XML transformed. If it could not be performed, it will return null. - Throws:
 WebAppException- if any error happened while transforming the XML.
 
- 
renderDateComboBoxes
public static void renderDateComboBoxes(MarkupOutput out, java.lang.String formatString, int year, int month, int day, java.lang.String paramYear, java.lang.String paramMonth, java.lang.String paramDay)
For the given year, month and day information, the format and the name of the parameters to use, generate three combo boxes for allowing users to select dates.- Parameters:
 out-MarkupOutputinstance where to save the contents generatedformatString- aStringlike mmddyyyy which specifies in which order year, month and day will be displayedyear- the current value selected for yearmonth- the current value selected for monthday- the current value selected for dayparamYear- the name of the parameter to use for the year combo box to generateparamMonth- the name of the parameter to use for the month combo box to generateparamDay- the name of the parameter to use for the day combo box to generate
 
- 
renderBufferedReaderContents
public static void renderBufferedReaderContents(MarkupOutput out, java.io.BufferedReader bufferedReader) throws WebAppException
Save the contents of theBufferedReaderinstance into theMarkupOutputinstance so they can be displayed to the user.- Parameters:
 out-MarkupOutputinstance where to save the contents to be renderedbufferedReader-BufferedReaderinstance with the information that should be displayed- Throws:
 WebAppException- if an error happens while processing theBufferedReaderinstance.
 
 - 
 
 -