com.sage.orion.sdata.servlet.accpac
Class ReportService

java.lang.Object
  extended by com.sage.orion.sdata.servlet.BaseServiceOperation
      extended by com.sage.orion.sdata.servlet.accpac.BaseService
          extended by com.sage.orion.sdata.servlet.accpac.ReportService
All Implemented Interfaces:
ServiceOperation
Direct Known Subclasses:
FormlessReportService, SuperviewReportService

public class ReportService
extends BaseService

This class is designed to handle the SData $service operation that generates an Accpac report.

The service's request fields will be created from the report's input parameters. Two fields, reportFile and reportOutput, will be added to the list of request fields. These two fields are optional and, if not provided by the client, the reportFile will be defaulted to the file defined in the xxRpt.ini and the reportOutput will be defaulted to "PREVIEW".

The service's response is an Atom entry containing an element responseURL that tells the client where to get the report.


Nested Class Summary
protected static class ReportService.ReportParamValues
          a structure consisting of reportFile, reportFormat, reportName, a name to value map of report parameters, and selectFormula
 
Nested classes/interfaces inherited from class com.sage.orion.sdata.servlet.BaseServiceOperation
BaseServiceOperation.FieldData, BaseServiceOperation.FieldNames
 
Constructor Summary
ReportService(ApplicationContext applicationContext, ResourceContextImpl resourceContext, Resource resource, Service service, SDataViewSet viewSet)
          Constructor which uses the report object created from the report name defined for this service operation
 
Method Summary
protected  java.util.List<ServiceField> createRequestFields(SDataRequest request)
          Create a list of input fields for Request.
protected  java.util.List<ServiceField> createResponseFields(SDataRequest request)
          Create a list of output fields for Response.
protected  java.util.List<ServiceField> createTemplateFields(SDataRequest request)
          Create a list of fields for Template.
protected  java.util.List<ServiceField> execute(SDataResourceElement payload, SDataRequest request, AsyncStatusListener listener)
          generate the report and then set the value for field "responseURL"
protected  ServiceReport getReport()
           
protected  ServiceField getReportFileField()
          create a service field for the report file.
protected  SDataResourceElement getReportPayload(SDataResourceElement payload, SDataRequest request, AsyncStatusListener listener)
          construct a payload from the input payload for the report by possibly adding/deleting parameter values.
 
Methods inherited from class com.sage.orion.sdata.servlet.accpac.BaseService
getApplicationContext, getName, getOperationName, getPath, getResource, getResourceContext, getService, getViewSet, isForMetaDataInquiry
 
Methods inherited from class com.sage.orion.sdata.servlet.BaseServiceOperation
getDescription, getResponseFields, getSchema, handleRequest, shutdown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReportService

public ReportService(ApplicationContext applicationContext,
                     ResourceContextImpl resourceContext,
                     Resource resource,
                     Service service,
                     SDataViewSet viewSet)
Constructor which uses the report object created from the report name defined for this service operation

Parameters:
applicationContext - the application context in which the service operation will be run
resourceContext - the resource context in which the service operation will be run
resource - the resource on which the service operation will be performed
service - the service operation to be performed
viewSet - the SDataViewSet associated with the resource
Method Detail

createRequestFields

protected java.util.List<ServiceField> createRequestFields(SDataRequest request)
Create a list of input fields for Request.

The list of request fields will include all parameters of the report and each field has been initialized to an empty string.

Two additional fields, reportFile and reportOutput, will be added to the list. These two fields are optional and, if not provided by the client, the reportFile will be defaulted to the file defined in the xxRpt.ini and the reportOutput will be defaulted to "PREVIEW".

Specified by:
createRequestFields in class BaseServiceOperation
Parameters:
request - the SDataRequest
Returns:
a list of service fields for Request. The collection returned silently removes duplicates. Please do not copy the content of the collection, since the duplicates will make service schema invalid. In order to add this functionality, addAll(collection, index) and add(object, index) behavior had to be modified. Now the index is ignored and it does the same as addAll(collection) and add(object). But if you rely on the order of the properties in the schema you are doing something wrong.

createResponseFields

protected java.util.List<ServiceField> createResponseFields(SDataRequest request)
Create a list of output fields for Response.

The list of response fields contains only one element "responseURL" that tells the client where to get the report.

Specified by:
createResponseFields in class BaseServiceOperation
Parameters:
request - the SDataRequest
Returns:
a list of service fields for Response. The collection returned silently removes duplicates. Please do not copy the content of the collection, since the duplicates will make service schema invalid. In order to add this functionality, addAll(collection, index) and add(object, index) behavior had to be modified. Now the index is ignored and it does the same as addAll(collection) and add(object). But if you rely on the order of the properties in the schema you are doing something wrong.

createTemplateFields

protected java.util.List<ServiceField> createTemplateFields(SDataRequest request)
Description copied from class: BaseServiceOperation
Create a list of fields for Template.

The list must be the same as (or a subset of) request fields and each field has been initialized with default value

Specified by:
createTemplateFields in class BaseServiceOperation
Parameters:
request - the SDataRequest
Returns:
a list of service fields for Template, or return null or an empty list if there are no such fields.

execute

protected java.util.List<ServiceField> execute(SDataResourceElement payload,
                                               SDataRequest request,
                                               AsyncStatusListener listener)
generate the report and then set the value for field "responseURL"

Specified by:
execute in class BaseServiceOperation
Parameters:
payload - the request (input) portion of the payload from the original SData request
request - the SDataRequest
listener - the AsyncStatusListener
Returns:
a list of service fields for response.

getReportPayload

protected SDataResourceElement getReportPayload(SDataResourceElement payload,
                                                SDataRequest request,
                                                AsyncStatusListener listener)
construct a payload from the input payload for the report by possibly adding/deleting parameter values. By default, the report uses the input payload as is. It is up to the subclass to override this default behavior.

Parameters:
payload - the request (input) portion of the payload from the original SData request
request - the SDataRequest
listener - the AsyncStatusListener
Returns:
a payload for the report

getReport

protected ServiceReport getReport()
Returns:
the report object

getReportFileField

protected ServiceField getReportFileField()
create a service field for the report file. The service field's value will be defaulted to the report file defined in the xxRpt.ini

Returns:
the service field for the report file


Copyright © 2011 Sage Software, Inc. All rights reserved.