Developing a Completion Processor
This topic explains how to extend the out-of-the-box regulatory submission processor classes and override the postComplete method with the agency-specific processing method.
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 Elements
The next table describes the solution element.
Element
Type
Description
postComplete(RegulatorySubmission regulatorySubmission)
API
Processes the regulatory submission after successful completion of the submission process.
Default Behavior
The default implementation sets the submission stage attribute to Active. If a predecessor version exists, the submission stage on this version is set to Historical. If Approval Date is not set for a regulatory submission, the default implementation sets the approval date for a completed regulatory submission 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 acknowledgement processing, create a Java class (your processor) that extends the SimpleRegulatorySubmissionProcessor or the appropriate revisable subtype processor, and then override the postComplete method. The revisable subtype processor can include AERSubmissionProcessor, ERSubmissionProcessor, RPSSubmissionProcessor, or UDISubmissionProcessor.
The following example shows an overriden postComplete method:
@Override
public RegulatorySubmission postComplete(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);
}
regulatorySubmission = RegulatorySubmissionHelper.setSubmissionStage(regulatorySubmission, getCompleteStage());

// Update approval date when it is null
if (regulatorySubmission.getApprovalDate() == null) {
regulatorySubmission = new ConditionalAutoCheckoutRunner><(regulatorySubmission) {
@Override
public RegulatorySubmission performBusinessProcess(RegulatorySubmission managedObject)
throws Exception {
managedObject.setApprovalDate(new Timestamp(System.currentTimeMillis()));
return (RegulatorySubmission) PersistenceHelper.manager.save(managedObject);
}
}.invoke();
}

// Set the Submission Stage on the previous Revision (RegSub2) or Iteration (Simple RegSub) to Historical
RegulatorySubmission previousVersion = null;
if (regulatorySubmission instanceof RegSubmission2) {
// Find previous Revision
String regSubVersion = ((RegSubmission2) regulatorySubmission).getVersionIdentifier().getValue();
QueryResult qr = VersionControlHelper.service.allVersionsOf((RegSubmission2) regulatorySubmission);
while (qr.hasMoreElements()) {
Versioned next = (Versioned) qr.nextElement();
if (next.getVersionIdentifier().getValue().equals(regSubVersion)) {
previousVersion = qr.hasMoreElements() ? (RegulatorySubmission) qr.nextElement() : null;
break;
}
}
} else {
// Find previous Iteration
previousVersion = (RegulatorySubmission) VersionControlHelper.getPredecessor(regulatorySubmission).getObject();
}
if (previousVersion != null) {
previousVersion = RegulatorySubmissionHelper.setSubmissionStage(previousVersion, getHistoryStage());
}

return regulatorySubmission;
}
Was this helpful?