org.opencms.report
Class A_CmsReport

java.lang.Object
  extended by org.opencms.report.A_CmsReport
All Implemented Interfaces:
I_CmsReport
Direct Known Subclasses:
CmsHtmlReport, CmsLogReport, CmsStringBufferReport

public abstract class A_CmsReport
extends java.lang.Object
implements I_CmsReport

Base report class.

Since:
6.0.0
Version:
$Revision: 1.28 $
Author:
Alexander Kandzior, Thomas Weckert, Jan Baudisch, Peter Bonrad

Field Summary
 
Fields inherited from interface org.opencms.report.I_CmsReport
FORMAT_DEFAULT, FORMAT_ERROR, FORMAT_HEADLINE, FORMAT_NOTE, FORMAT_OK, FORMAT_WARNING, REPORT_TYPE_EXTENDED, REPORT_TYPE_SIMPLE
 
Constructor Summary
A_CmsReport()
           
 
Method Summary
 void addError(java.lang.Object obj)
          Adds an error object to the list of errors that occurred during the report.
 void addWarning(java.lang.Object obj)
          Adds a warning object to the list of warnings that occurred during the report.
 java.lang.String formatRuntime()
          Formats the runtime formatted as "hh:mm:ss".
 java.util.List getErrors()
          Returns a list of all errors that occurred during the report.
 long getLastEntryTime()
          Returns the time of last report entry.
 java.util.Locale getLocale()
          Returns the locale this report was initialized with.
protected  CmsMessages getMessages()
          Returns the default report message bundle.
 long getRuntime()
          Returns the time this report has been running.
 java.lang.String getSiteRoot()
          Returns the original site root of the user who started this report, or null if the original site root has not been set.
 java.util.List getWarnings()
          Returns a list of all warnings that occurred during the report.
 boolean hasError()
          Returns if the report generated an error output.
 boolean hasWarning()
          Returns if the report generated a warning output.
protected  void init(java.util.Locale locale, java.lang.String siteRoot)
          Initializes some member variables for this report.
 void print(CmsMessageContainer container)
          Prints a localized message to the report.
 void print(CmsMessageContainer container, int format)
          Prints a localized message to the report, using the indicated formatting.
protected  void print(java.lang.String value)
          Prints a String to the report.
protected abstract  void print(java.lang.String value, int format)
          Prints a String to the report, using the indicated formatting.
 void println(CmsMessageContainer container)
          Prints a localized message to the report.
 void println(CmsMessageContainer container, int format)
          Prints a localized message to the report, using the indicated formatting.
protected  void println(java.lang.String value)
          Prints a String with line break to the report.
protected  void println(java.lang.String value, int format)
          Prints a String with line break to the report, using the indicated formatting.
 void printMessageWithParam(CmsMessageContainer container, java.lang.Object param)
          Prints a localized message followed by a parametera and dots to the report.
 void printMessageWithParam(int m, int n, CmsMessageContainer container, java.lang.Object param)
          Convenience method to print a localized message, followed by a parameter and dots to the report.
 java.lang.String removeSiteRoot(java.lang.String resourcename)
          Removes the report site root prefix from the absolute path in the resource name, that is adjusts the resource name for the report site root.
 void resetRuntime()
          Resets the runtime to 0 milliseconds.
protected  void setLastEntryTime(long time)
          Sets the time of the last report entry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.opencms.report.I_CmsReport
getReportUpdate, println, println
 

Constructor Detail

A_CmsReport

public A_CmsReport()
Method Detail

addError

public void addError(java.lang.Object obj)
Description copied from interface: I_CmsReport
Adds an error object to the list of errors that occurred during the report.

Specified by:
addError in interface I_CmsReport
Parameters:
obj - the error object
See Also:
I_CmsReport.addError(java.lang.Object)

addWarning

public void addWarning(java.lang.Object obj)
Description copied from interface: I_CmsReport
Adds a warning object to the list of warnings that occurred during the report.

Specified by:
addWarning in interface I_CmsReport
Parameters:
obj - the error object
See Also:
I_CmsReport.addWarning(java.lang.Object)

formatRuntime

public java.lang.String formatRuntime()
Description copied from interface: I_CmsReport
Formats the runtime formatted as "hh:mm:ss".

Specified by:
formatRuntime in interface I_CmsReport
Returns:
the runtime formatted as "hh:mm:ss"
See Also:
I_CmsReport.formatRuntime()

getErrors

public java.util.List getErrors()
Description copied from interface: I_CmsReport
Returns a list of all errors that occurred during the report.

Specified by:
getErrors in interface I_CmsReport
Returns:
an error list that occurred during the report
See Also:
I_CmsReport.getErrors()

getLocale

public java.util.Locale getLocale()
Description copied from interface: I_CmsReport
Returns the locale this report was initialized with.

Specified by:
getLocale in interface I_CmsReport
Returns:
the locale this report was initialized with
See Also:
I_CmsReport.getLocale()

getRuntime

public long getRuntime()
Description copied from interface: I_CmsReport
Returns the time this report has been running.

Specified by:
getRuntime in interface I_CmsReport
Returns:
the time this report has been running
See Also:
I_CmsReport.getRuntime()

getSiteRoot

public java.lang.String getSiteRoot()
Returns the original site root of the user who started this report, or null if the original site root has not been set.

Specified by:
getSiteRoot in interface I_CmsReport
Returns:
the original site root of the user who started this report

getWarnings

public java.util.List getWarnings()
Description copied from interface: I_CmsReport
Returns a list of all warnings that occurred during the report.

Specified by:
getWarnings in interface I_CmsReport
Returns:
a warning list that occurred during the report
See Also:
I_CmsReport.getWarnings()

hasError

public boolean hasError()
Description copied from interface: I_CmsReport
Returns if the report generated an error output.

Specified by:
hasError in interface I_CmsReport
Returns:
true if the report generated an error, otherwise false
See Also:
I_CmsReport.hasError()

hasWarning

public boolean hasWarning()
Description copied from interface: I_CmsReport
Returns if the report generated a warning output.

Specified by:
hasWarning in interface I_CmsReport
Returns:
true if the report generated a warning, otherwise false
See Also:
I_CmsReport.hasWarning()

print

public void print(CmsMessageContainer container)
Description copied from interface: I_CmsReport
Prints a localized message to the report.

Specified by:
print in interface I_CmsReport
Parameters:
container - the String to add
See Also:
I_CmsReport.print(org.opencms.i18n.CmsMessageContainer)

print

public void print(CmsMessageContainer container,
                  int format)
Description copied from interface: I_CmsReport
Prints a localized message to the report, using the indicated formatting.

Use the contants starting with FORMAT from this interface to indicate which formatting to use.

Specified by:
print in interface I_CmsReport
Parameters:
container - the String to add
format - the formatting to use for the output
See Also:
I_CmsReport.print(org.opencms.i18n.CmsMessageContainer, int)

println

public void println(CmsMessageContainer container)
Description copied from interface: I_CmsReport
Prints a localized message to the report.

Specified by:
println in interface I_CmsReport
Parameters:
container - the message container to add
See Also:
I_CmsReport.println(org.opencms.i18n.CmsMessageContainer)

println

public void println(CmsMessageContainer container,
                    int format)
Description copied from interface: I_CmsReport
Prints a localized message to the report, using the indicated formatting.

Use the contants starting with FORMAT from this interface to indicate which formatting to use.

Specified by:
println in interface I_CmsReport
Parameters:
container - the message container to add
format - the formatting to use for the output
See Also:
I_CmsReport.println(org.opencms.i18n.CmsMessageContainer, int)

printMessageWithParam

public void printMessageWithParam(CmsMessageContainer container,
                                  java.lang.Object param)
Description copied from interface: I_CmsReport
Prints a localized message followed by a parametera and dots to the report.

Specified by:
printMessageWithParam in interface I_CmsReport
Parameters:
container - the Message to add
param - the Parameter to add
See Also:
I_CmsReport.printMessageWithParam(org.opencms.i18n.CmsMessageContainer,Object)

printMessageWithParam

public void printMessageWithParam(int m,
                                  int n,
                                  CmsMessageContainer container,
                                  java.lang.Object param)
Description copied from interface: I_CmsReport
Convenience method to print a localized message, followed by a parameter and dots to the report.

The output follows the pattern: ( 3 / 8 ) Deleting filename.txt ...

Specified by:
printMessageWithParam in interface I_CmsReport
Parameters:
m - the number of the report output
n - the total number of report outputs
container - the Message to add
param - the Parameter to add
See Also:
I_CmsReport.printMessageWithParam(int,int,org.opencms.i18n.CmsMessageContainer,Object)

removeSiteRoot

public java.lang.String removeSiteRoot(java.lang.String resourcename)
Removes the report site root prefix from the absolute path in the resource name, that is adjusts the resource name for the report site root.

If the site root for this report has not been set, or the resource name does not start with the report site root, the name it is left untouched.

Specified by:
removeSiteRoot in interface I_CmsReport
Parameters:
resourcename - the resource name (full path)
Returns:
the resource name adjusted for the report site root
See Also:
CmsRequestContext.removeSiteRoot(String)

resetRuntime

public void resetRuntime()
Description copied from interface: I_CmsReport
Resets the runtime to 0 milliseconds.

Specified by:
resetRuntime in interface I_CmsReport
See Also:
I_CmsReport.resetRuntime()

getMessages

protected CmsMessages getMessages()
Returns the default report message bundle.

Returns:
the default report message bundle

init

protected void init(java.util.Locale locale,
                    java.lang.String siteRoot)
Initializes some member variables for this report.

Parameters:
locale - the locale for this report
siteRoot - the site root of the user who started this report (may be null)

print

protected void print(java.lang.String value)
Prints a String to the report.

Parameters:
value - the String to add

print

protected abstract void print(java.lang.String value,
                              int format)
Prints a String to the report, using the indicated formatting.

Use the contants starting with FORMAT from this interface to indicate which formatting to use.

Parameters:
value - the message container to add
format - the formatting to use for the output

println

protected void println(java.lang.String value)
Prints a String with line break to the report.

Parameters:
value - the message container to add

println

protected void println(java.lang.String value,
                       int format)
Prints a String with line break to the report, using the indicated formatting.

Use the contants starting with C_FORMAT from this interface to indicate which formatting to use.

Parameters:
value - the String to add
format - the formatting to use for the output

setLastEntryTime

protected void setLastEntryTime(long time)
Sets the time of the last report entry.

Parameters:
time - the time of the actual entry

getLastEntryTime

public long getLastEntryTime()
Returns the time of last report entry.

Returns:
time of last report entry