org.opencms.report
Class A_CmsReport

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

public abstract class A_CmsReport
extends Object
implements I_CmsReport

Base report class.

Since:
6.0.0
Version:
$Revision: 1.19 $
Author:
Alexander Kandzior, Thomas Weckert, Jan Baudisch

Field Summary
 
Fields inherited from interface org.opencms.report.I_CmsReport
BUNDLE_NAME, 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 addBundle(String bundleName)
          Adds a bundle specified by it's name to the List of resource bundles.
 void addError(Object obj)
          Adds an error object to the list of errors that occured during the report.
 String formatRuntime()
          Formats the runtime formatted as "hh:mm:ss".
 List getErrors()
          Returns a list of all errors that occured during the report.
 Locale getLocale()
          Returns the locale this report was initialized with.
 long getRuntime()
          Returns the time this report has been running.
 boolean hasError()
          Returns if the report generated an error output.
protected  void init(Locale locale)
          Initializes some member variables for this report.
 String key(String keyName)
          Gets the localized resource string for a given message key.
 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(String value)
          Prints a String to the report.
protected abstract  void print(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(String value)
          Prints a String with line break to the report.
protected  void println(String value, int format)
          Prints a String with line break to the report, using the indicated formatting.
 void printMessageWithParam(CmsMessageContainer container, Object param)
          Prints a localized message followed by a parametera and dots to the report.
 void printMessageWithParam(int m, int n, CmsMessageContainer container, Object param)
          Convenience method to print a localized message, followed by a parameter and dots to the report.
 void resetRuntime()
          Resets the runtime to 0 milliseconds.
 
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

addBundle

public void addBundle(String bundleName)
Description copied from interface: I_CmsReport
Adds a bundle specified by it's name to the List of resource bundles.

Specified by:
addBundle in interface I_CmsReport
Parameters:
bundleName - the name of the resource bundle with localized strings
See Also:
I_CmsReport.addBundle(String)

addError

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

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

formatRuntime

public 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 List getErrors()
Description copied from interface: I_CmsReport
Returns a list of all errors that occured during the report.

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

getLocale

public 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()

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()

key

public String key(String keyName)
Description copied from interface: I_CmsReport
Gets the localized resource string for a given message key.

The internal implementation should be passing the keyName to the class CmsMessages.

Specified by:
key in interface I_CmsReport
Parameters:
keyName - the key for the desired string
Returns:
the resource string for the given key
See Also:
I_CmsReport.key(java.lang.String)

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,
                                  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,
                                  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)

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()

init

protected void init(Locale locale)
Initializes some member variables for this report.

Parameters:
locale - the locale for this report

print

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

Parameters:
value - the String to add

print

protected abstract void print(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(String value)
Prints a String with line break to the report.

Parameters:
value - the message container to add

println

protected void println(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