jet.server.api
Interface UserTask


public interface UserTask

UserTask is an interface that is used to help you to perform customized tasks.


Method Summary
 java.lang.String getErrorMsg()
          Gets the error message.
 boolean hasError()
          Checks if error occurs during the task running process.
 void initReportProperties(java.util.Properties rptProp)
          Initializes the task using the provided task properties.
 void initUserTaskProperties(java.util.Properties userTaskProp)
          Initializes the task using the provided customer task properties.
 void run()
          Performances the task running .
 void stopExec()
          Forces the task to stop executing.
 

Method Detail

initReportProperties

void initReportProperties(java.util.Properties rptProp)
Initializes the task using the provided task properties.

Parameters:
rptProp - the properties containing the task information of a schedule. For example, in demo APIDemoDynamic ExportTaskrptProp properties contains APIConst.TAG_REPORT = "/SampleReports/Coffee Sales.wls" APIConst.TAG_RPT_VERSION = 1 APIConst.TAG_CATALOG = "/SampleReports/SampleReports.cat" APIConst.TAG_CAT_VERSION = 1 Please see the document for the instructions of the scheduled task properties. Note: the value of jrs.task_class property should be the custom task class name, which must have implemented this interface. Please refer to API example APIDemoDynamicExportTask. It is a demo showing how to use UserTask and export reports to multiple formatted result.

initUserTaskProperties

void initUserTaskProperties(java.util.Properties userTaskProp)
Initializes the task using the provided customer task properties.

Parameters:
userTaskProp - the properties containing the customer task information of a schedule. For example, in demo APIDemoDynamicExportTask the userTaskProp contains jrs.rst=result_rtf jrs.pdf=true jrs.text=true jrs.excel=true jrs.ps=true jrs.html=result_html

run

void run()
Performances the task running . This method will be called when the task runs.


stopExec

void stopExec()
Forces the task to stop executing. This method will be called just after the task runs or to force the task to stop during the running process.


hasError

boolean hasError()
Checks if error occurs during the task running process. By calling this method, JReport Server gets the information about whether a task has been processed successfully or not. After that, the server uses it as the value of the isSuccessful column of the Completed table. If the task has been set to send notification after running, depending on the returned value of this method, the server decides whether to send a successful notification or a failure notification to the specified E-mail address.

Returns:
true if there is an error, otherwise return false.

getErrorMsg

java.lang.String getErrorMsg()
Gets the error message. This method will be called to get detailed error information, when there are some errors during the task running process.

Returns:
the error message.