Package com.avoka.fc.core.service
Class AbstractRenderReceiptService
- java.lang.Object
-
- com.avoka.fc.core.service.BaseService
-
- com.avoka.fc.core.service.CayenneService
-
- com.avoka.fc.core.service.AbstractRenderReceiptService
-
- All Implemented Interfaces:
IRenderReceiptService
,IServiceDefinitionAware
- Direct Known Subclasses:
AcroFormRenderReceiptService
,LocalProcessRenderReceiptService
,PhantomJSRenderReceiptService
public abstract class AbstractRenderReceiptService extends CayenneService implements IRenderReceiptService, IServiceDefinitionAware
Provides an abstract PDF receipt rendering service for subclasses to implement.- Since:
- 4.0.0
-
-
Field Summary
Fields Modifier and Type Field Description static String
CONTENT_TYPE_PDF
The PDF content type header value.
-
Constructor Summary
Constructors Constructor Description AbstractRenderReceiptService()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Integer
getMaxProcesses()
Return the maximum number of concurrent processes.protected abstract DataDocument
getReceiptDocument(Submission submission, HttpServletRequest request, RequestLog requestLog, String receiptMode)
Return the PDF Receipt DataDocument for the submission, request and requestLog.ServiceDefinition
getServiceDefinition()
Return the service definition for the service.protected boolean
hasSignatureReceiptTemplate(Submission submission)
Return true if submission has a signature templateprotected boolean
isSignatureReceiptRequest(HttpServletRequest request)
Return true if this is a request for a signature receipt.byte[]
renderReceipt(Submission submission, String mode)
Return a PDF Receipt byte array rendered from the submission.void
renderReceipt(Submission submission, HttpServletRequest request, HttpServletResponse response, RequestLog requestLog)
Render the PDF Receipt given the submission.void
setMaxProcesses(Integer value)
Set the maximum number of concurrent processes.void
setServiceDefinition(ServiceDefinition serviceDefinition)
Set the service definition for the service.void
setTestMode(boolean testMode)
Specify whether running in test mode an render receipt changes should not be committed to database.protected String
updateReceiptMode(String xmlData, TemplateVersion templateVersion, HttpServletRequest request)
Return the updated form submission XML data with the correct receipt mode for the receipt rendering context.protected String
updateReceiptMode(String xmlData, TemplateVersion templateVersion, HttpServletRequest request, String mode)
Return the updated form submission XML data with the correct receipt mode for the receipt rendering context.-
Methods inherited from class com.avoka.fc.core.service.CayenneService
commitChanges, deleteObject, deleteObjects, findObject, getDataContext, getDataDomain, getObjectForPK, getObjectStore, newObject, performNamedQuery, performNamedQuery, performNamedQuery, performNonSelectingQuery, performNonSelectingQuery, performNonSelectingQuery, performNonSelectingQuery, performQuery, performQuery, refetchEntity, refetchObject, registerNewObject, rollbackChanges, toMap, toMap
-
Methods inherited from class com.avoka.fc.core.service.BaseService
getLogger
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.avoka.fc.core.service.IRenderReceiptService
requiresLiveCycle
-
-
-
-
Field Detail
-
CONTENT_TYPE_PDF
public static final String CONTENT_TYPE_PDF
The PDF content type header value.- See Also:
- Constant Field Values
-
-
Method Detail
-
getReceiptDocument
protected abstract DataDocument getReceiptDocument(Submission submission, HttpServletRequest request, RequestLog requestLog, String receiptMode) throws ApplicationException
Return the PDF Receipt DataDocument for the submission, request and requestLog.- Parameters:
submission
- the form submissionrequest
- the servlet requestrequestLog
- the request logreceiptMode
- receipt mode in [ Web | Email | Delivery ]- Returns:
- the PDF Receipt DataDocument for the submission, request and requestLog
- Throws:
ApplicationException
-
renderReceipt
public void renderReceipt(Submission submission, HttpServletRequest request, HttpServletResponse response, RequestLog requestLog) throws ApplicationException
Render the PDF Receipt given the submission.- Specified by:
renderReceipt
in interfaceIRenderReceiptService
- Parameters:
submission
- the submissionrequest
- - the users Http servlet requestresponse
- - the Http servlet response to render torequestLog
- - the request log parameter- Throws:
ApplicationException
- if an error occurs at runtime- See Also:
IRenderReceiptService.renderReceipt(Submission, HttpServletRequest, HttpServletResponse, RequestLog)
-
renderReceipt
public byte[] renderReceipt(Submission submission, String mode) throws ApplicationException
Return a PDF Receipt byte array rendered from the submission.- Specified by:
renderReceipt
in interfaceIRenderReceiptService
- Parameters:
submission
- the submissionmode
- receipt mode in [ Web | Email | Delivery ]- Returns:
- the receipt data in PDF
- Throws:
ApplicationException
- if an error occurs at runtime- See Also:
IRenderReceiptService.renderReceipt(Submission, String)
-
setTestMode
public void setTestMode(boolean testMode)
Specify whether running in test mode an render receipt changes should not be committed to database.- Specified by:
setTestMode
in interfaceIRenderReceiptService
- Parameters:
testMode
- Specify whether running in test mode an render receipt changes should not be committed to database- Since:
- 4.1.15
- See Also:
IRenderReceiptService.setTestMode(boolean)
-
setMaxProcesses
public void setMaxProcesses(Integer value)
Set the maximum number of concurrent processes.- Specified by:
setMaxProcesses
in interfaceIRenderReceiptService
- Parameters:
value
- the maximum number of concurrent processes- Since:
- 5.0.3
- See Also:
IRenderReceiptService.setMaxProcesses(Integer)
-
getMaxProcesses
public Integer getMaxProcesses()
Return the maximum number of concurrent processes.- Returns:
- the maximum number of concurrent processes
- Since:
- 5.0.3
-
setServiceDefinition
public void setServiceDefinition(ServiceDefinition serviceDefinition)
Set the service definition for the service.- Specified by:
setServiceDefinition
in interfaceIServiceDefinitionAware
- Parameters:
serviceDefinition
- the service definition for the service- See Also:
IServiceDefinitionAware.setServiceDefinition(ServiceDefinition)
-
getServiceDefinition
public ServiceDefinition getServiceDefinition()
Return the service definition for the service.- Specified by:
getServiceDefinition
in interfaceIServiceDefinitionAware
- Returns:
- the service definition for the service
- See Also:
IServiceDefinitionAware.getServiceDefinition()
-
isSignatureReceiptRequest
protected boolean isSignatureReceiptRequest(HttpServletRequest request)
Return true if this is a request for a signature receipt.- Parameters:
request
- the servlet request- Returns:
- true if this is a request for a signature receipt
- Since:
- 3.6.0
-
hasSignatureReceiptTemplate
protected boolean hasSignatureReceiptTemplate(Submission submission)
Return true if submission has a signature template- Parameters:
submission
- the form submission- Returns:
- true if submission has a signature template
- Since:
- 3.6.0
-
updateReceiptMode
protected String updateReceiptMode(String xmlData, TemplateVersion templateVersion, HttpServletRequest request)
Return the updated form submission XML data with the correct receipt mode for the receipt rendering context.- Parameters:
xmlData
- the form submission XML datatemplateVersion
- the form template versionrequest
- the servlet request- Returns:
- the updated form submission XML data with the correct receipt mode for the receipt rendering context
- Since:
- 4.0.0
-
updateReceiptMode
protected String updateReceiptMode(String xmlData, TemplateVersion templateVersion, HttpServletRequest request, String mode)
Return the updated form submission XML data with the correct receipt mode for the receipt rendering context.- Parameters:
xmlData
- the form submission XML datatemplateVersion
- the form template versionrequest
- the servlet requestmode
- the receipt mode- Returns:
- the updated form submission XML data with the correct receipt mode for the receipt rendering context
-
-