Developing a Submission Processor
This topic explains how to extend the out-of-the-box regulatory submission processor classes and override the submit regulatory submission method with the agency-specific processing method. This topic also explains how to configure the content to be transmitted to a regulatory agency.
Solution
Create a custom class that extends an out-of-the-box regulatory submission processor.
Create a custom regulatory submission processor class that overrides the getTransmissionPayloadCategory() method.
Implement custom payload generation. See the example for a new custom class with the overriden getTransmissionPayloadCategory() method.
Create an xconf entry to register your custom class.
Create a services.xconf entry to register your custom class.
Solution Elements
The next table describes the various solution elements.
Element
Type
Description
submitRegulatorySubmission(RegulatorySubmission regulatorySubmission)
API
Submits the regulatory submission using the regulatory transmission delegate that is registered for the regulatory submission type.
postSubmissionProcessing(Regulatory Submission regulatorySubmission)
API
Modifies any regulatory submission attributes that are required after transmission.
getTransmissionPayloadCategory()
API
Determines the content to be transmitted to the regulatory agency.
Default Behavior
The default behavior of the submitRegulatorySubmission method is to get the regulatory transmission delegate registered for the regulatory submission type, call the transmit method of the delegate, and then call the postSubmissionProcessing for the regulatory submission processor being used. The default postSubmissionProcessing method in the AbstractRegulatorySubmissionProcessor class sets the submittedDate to the current date and the submissionStage to the submitted stage that is returned by the getSubmittedStage() method. This method returns SubmissionStage.SUBMITTED in the AbstractRegulatorySubmissionProcessor class.
The default implementation sends the regulatory submission payload content for the AER, ER, RPS, and UDI regulatory submissions.
Creating Custom Classes
To customize the transmit processing, create a Java class (your processor) that extends the SimpleRegulatorySubmissionProcessor or the appropriate revisable subtype processor, and then override the submitRegulatorySubmission method. The revisable subtype processor can include the AERSubmissionProcessor, ERSubmissionProcessor, RPSSubmissionProcessor, or UDISubmissionProcessor.
The following example shows the default submitRegulatorySubmission and postSubmissionProcessing methods:
@Override
public RegulatorySubmission submitRegulatorySubmission(RegulatorySubmission regulatorySubmission) throws Exception {
if (!AccessControlHelper.manager.hasAccess(regulatorySubmission, AccessPermission.MODIFY)) {
throw new WTException(accessResource.class.getName(), accessResource.NOT_AUTHORIZED_EXCEPTION, null);
}
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);
}
ContentItem regulatoryContent = RegulatoryContentHelper.getService().getRegulatoryContent(
regulatorySubmission,
RegulatoryContentCategory.REGULATORY_SUBMISSION_PAYLOAD);
if (regulatoryContent == null) {
Object[] errorMessageObjects = new Object[2];
errorMessageObjects[0] = RegulatoryContentCategory.REGULATORY_SUBMISSION_PAYLOAD;
errorMessageObjects[1] = regulatorySubmission.getDisplayIdentifier();
throw new WTException(regmstrResource.class.getName(), regmstrResource.NO_CONTENT_FOR_CATEGORY,
errorMessageObjects);
}
try {
RegulatoryTransmissionDelegateInterface delegate = getTransmissionDelegate(regulatorySubmission);
delegate.transmit(regulatorySubmission);
} catch (WTException e) {
throw e;
} catch (Exception exp) {
throw new WTException(exp);
}
return postSubmissionProcessing(regulatorySubmission);
}
@Override
public RegulatorySubmission postSubmissionProcessing(RegulatorySubmission regulatorySubmission) throws Exception {
return new TransactionRunner<RegulatorySubmission>() {
@Override
public RegulatorySubmission performBusinessProcess() throws Exception {

return new ConditionalAutoCheckoutRunner<RegulatorySubmission>(regulatorySubmission) {
@Override
public RegulatorySubmission performBusinessProcess(RegulatorySubmission regulatorySubmission)
throws Exception {

regulatorySubmission.setSubmittedDate(new Timestamp(System.currentTimeMillis()));
regulatorySubmission.setSubmissionStage(getSubmittedStage());
return regulatorySubmission = (RegulatorySubmission) PersistenceHelper.manager
.save(regulatorySubmission);
};
}.invoke();
}
}.invoke();
}
To customize the content sent to the regulatory agency, override the getTransmissionPayloadCategory() method. This method returns the internal name of a RegulatoryContentCategory or the value of the of the constant USE_PRIMARY_CONTENT_AS_TRANSMISSION_PAYLOAD.
The next example shows a new custom class with the overriden getTransmissionPayloadCategory() method:
@Override
public String getTransmissionPayloadCategory() {
return RegulatoryContentCategory.REGULATORY_SUBMISSION_PAYLOAD.getValue();
}
這是否有幫助?