开发到期处理器
本主题将介绍如何扩展出厂设置到期处理器类,以及如何将监管提交标记为已到期。
解决方案
• 创建一个自定义类来扩展预设监管提交处理器。
• 创建一个 xconf 条目来注册自定义类。
解决方案元素
下一张表格介绍解决方案元素:
元素
|
类型
|
说明
|
expireRegulatorySubmission(RegulatorySubmission regulatorySubmission)
|
API
|
用于将监管提交标记为已到期。
|
默认行为
expireRegulatorySubmission 方法的默认行为是将监管提交标记为已到期,将其提交阶段更改为已到期,然后调用 RegulatoryMasterServiceEvent AUTO_EXPIRED 事件。此外,如果工作副本不可用,则 expireRegulatorySubmission 方法会检出可修订的监管提交,然后再将其检入。此方法不会将已检出的可修订监管提交标记为已到期。
创建自定义类
要自定义到期处理,首先创建一个用于扩展 SimpleRegulatorySubmissionProcessor 的 Java 类 (您的处理器),或相应的可修订子类型处理器,然后改写 expireRegulatorySubmission 方法。可修订子类型处理器可以是 AERSubmissionProcessor、ERSubmissionProcessor、RPSSubmissionProcessor 或 UDISubmissionProcessor。
以下示例显示了已改写的 expireRegulatorySubmission 方法:
@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;
}