Developing an Expiration Processor
This topic explains how to extend the out-of-the-box expiration processor classes and mark a regulatory submission as expired.
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
|
expireRegulatorySubmission(RegulatorySubmission regulatorySubmission)
|
API
|
Used to mark a regulatory submission as expired.
|
Default Behavior
The default behavior of the expireRegulatorySubmission method is to mark a regulatory submission as expired, change its submission stage to expired, and then invoke the RegulatoryMasterServiceEvent AUTO_EXPIRED event. Additionally, if a working copy is not available, the expireRegulatorySubmission method checks out and then checks in a revisable regulatory submission. This method does not mark a checked-out revisable regulatory submission as expired.
Creating Custom Classes
To customize expiration processing, create a Java class (your processor) that extends SimpleRegulatorySubmissionProcessor or the appropriate revisable subtype processor, and then override the expireRegulatorySubmission method. The revisable subtype processor can include AERSubmissionProcessor, ERSubmissionProcessor, RPSSubmissionProcessor, or UDISubmissionProcessor.
The following example shows an overriden expireRegulatorySubmission method:
@Override
public RegulatorySubmission expireRegulatorySubmission(RegulatorySubmission submission)
throws WTException, IllegalArgumentException {
if (submission == null) {
throw new IllegalArgumentException(WTMessage.getLocalizedMessage(regmstrResource.class.getName(),
regmstrResource.NULL_REGULATORY_SUBMISSION_EXPIRATION));
}
if (submission instanceof RegSubmission2
&& (WorkInProgressHelper.isWorkingCopy((Workable) submission)
|| WorkInProgressHelper.isCheckedOut((Workable) submission))) {
throw new WTException(WTMessage.getLocalizedMessage(regmstrResource.class.getName(),
regmstrResource.CHECKED_OUT_NO_EXPIRATION));
}
if (!submission.isExpired()) {
try {
submission = new ConditionalAutoCheckoutRunner<>(submission) {
@Override
public RegulatorySubmission performBusinessProcess(RegulatorySubmission managedObject)
throws Exception {
managedObject.setExpired(true);
managedObject.setSubmissionStage(SubmissionStage.EXPIRED);
PersistenceHelper.manager.save(managedObject);
return managedObject;
}
}.invoke();
RegulatorySubmissionHelper.service
.dispatchRegulatorySubmissionEvent(RegulatoryMasterServiceEvent.AUTO_EXPIRED,
submission);
} catch (WTException e) {
throw e;
} catch (Exception e) {
throw new WTException(e);
}
}
return submission;
}