Developing a Cancellation Processor
This topic explains how to extend the out-of-the-box submission processor classes and override the postCancellation method with any type-specific processing.
Solution
Create a custom class that extends an out-of-the-box regulatory submission processor.
Create an xconf entry to register your custom class.
Solution Element
The next table describes the solution element.
Element
Type
Description
postCancellation(RegulatorySubmission regulatorySubmission)
API
Cancels the terminated regulatory submissions.
Default Behavior
The default behavior of the postCancellation method is to change the submission stage of a regulatory submission to Terminated. If Terminated Date is not set for the regulatory submission, the default implementation sets the date to the current date.
The default implementation is intended primarily for demonstrational and instructional purposes. However, it does represent a typical best practice that may be suitable for many Regulatory Submission types. Implementors can create a submission-specific processor that matches the provided documentation, according to their requirements.
Creating Custom Classes
To customize the cancellation processing, create a Java class (your processor) that extends SimpleRegulatorySubmissionProcessor or the appropriate revisable subtype processor, and then override the postCancellation method. The revisable subtype processor can include AERSubmissionProcessor, ERSubmissionProcessor, RPSSubmissionProcessor, or UDISubmissionProcessor.
The next example shows an overriden postCancellation method:
@Override
public RegulatorySubmission postCancellation(RegulatorySubmission regulatorySubmission) throws Exception {
if (!VersionControlHelper.isLatestIteration(regulatorySubmission)) {
Object[] errorMessageObjects = new Object[1];
errorMessageObjects[0] = regulatorySubmission.getDisplayIdentifier();
throw new WTException(vcResource.class.getName(), vcResource.OBJECT_IS_NOT_LATEST, errorMessageObjects);
}
RegulatorySubmissionHelper.setSubmissionStage(regulatorySubmission, getCancellationStage());

// Update terminated date when it is null
if (regulatorySubmission.getTerminatedDate() == null) {
regulatorySubmission = new ConditionalAutoCheckoutRunner<>(regulatorySubmission) {
@Override
public RegulatorySubmission performBusinessProcess(RegulatorySubmission managedObject)
throws Exception {
managedObject.setTerminatedDate(new Timestamp(System.currentTimeMillis()));
return (RegulatorySubmission) PersistenceHelper.manager.save(managedObject);
}
}.invoke();
}
return regulatorySubmission;
}
War dies hilfreich?