使用仿真传输委派
将仿真传输委派配置为监管传输委派界面的默认传输委派。如果监管传输委派未针对某一类型的监管提交进行注册,则默认情况下,仿真传输委派将用于该类型的监管提交。仿真传输委派不执行任何初始化功能。它将执行可在测试中使用的示例传输功能。生产实施应始终为一个监管提交类型注册一个传输委派。仿真传输委派具有一个空的 void initialize () 方法和一个 boolean transmit(RegulatorySubmission regulatorySubmission) 方法。boolean transmit(RegulatorySubmission regulatorySubmission) 会记录指示该方法已被调用的错误,还会记录监管提交有效载荷的内容。
仿真传输委派代码
以下示例显示仿真传输委派中的两种方法:
@Override
public void initialize() throws Exception {
// Do nothing
}
@Override
public boolean transmit(RegulatorySubmission regulatorySubmission) throws Exception {
// Do nothing this is a simulator but log to prove it did something
if (logger.isErrorEnabled()) {
logger.error("Entering SimulateTransmissionDelegate ok if Dev");
ContentItem regulatoryContent = RegulatoryContentHelper.getService().getRegulatoryContent(
regulatorySubmission,
RegulatoryContentCategory.REGULATORY_SUBMISSION_PAYLOAD);
if (regulatoryContent instanceof ApplicationData) {
InputStream payloadStream = ContentServerHelper.service
.findContentStream((ApplicationData) regulatoryContent);
String payloadString = new String(payloadStream.readAllBytes(), StandardCharsets.UTF_8);
logger.error("Using SimulateTransmissionDelegate ok if Dev\r\n" + payloadString);
}
}
return true;
}