开发完成处理器
本主题介绍如何扩展预设监管提交处理器类,以及如何使用监管部门特定的处理方法来改写 postComplete 方法。
解决方案
创建一个自定义类来扩展预设监管提交处理器。
创建一个 xconf 条目来注册自定义类。
解决方案元素
下一张表格介绍解决方案元素:
元素
类型
说明
postComplete(RegulatorySubmission regulatorySubmission)
API
成功完成提交进程后,处理监管提交。
默认行为
默认实施将“提交阶段”属性设置为“启用中”。如果前置任务版本存在,则将此版本上的“提交阶段”属性设置为“历史记录”。如果没有为监管提交设置“批准日期”,则默认实施会将已完成的监管提交的批准日期设置为当前日期。
默认实施主要用于演示和教学目的。但该实施确实代表了一种典型的最佳做法,可能适用于多种监管提交类型。实施者可根据需求创建与所提供的文档相匹配的提交特定处理器。
创建自定义类
要自定义确认处理,首先创建一个用于扩展 SimpleRegulatorySubmissionProcessor 的 Java 类 (您的处理器),或相应的可修订子类型处理器,然后改写 postComplete 方法。可修订子类型处理器可以是 AERSubmissionProcessorERSubmissionProcessorRPSSubmissionProcessorUDISubmissionProcessor
以下示例显示了已改写的 postComplete 方法:
@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;
}
相关主题
这对您有帮助吗?