use of com.webank.wedatasphere.qualitis.rule.request.TemplateOutputMetaRequest in project Qualitis by WeBankFinTech.
the class RuleTemplateServiceImpl method createAndSaveTemplateInfo.
private void createAndSaveTemplateInfo(Template savedTemplate, AddRuleTemplateRequest request) {
// Save template output meta.
Set<TemplateOutputMeta> templateOutputMetas = new HashSet<>();
for (TemplateOutputMetaRequest templateOutputMetaRequest : request.getTemplateOutputMetaRequests()) {
templateOutputMetas.addAll(templateOutputMetaService.getAndSaveTemplateOutputMeta(templateOutputMetaRequest.getOutputName(), FunctionTypeEnum.getFunctionTypeByName(templateOutputMetaRequest.getFieldName()), request.getSaveMidTable(), savedTemplate));
}
savedTemplate.setTemplateOutputMetas(templateOutputMetas);
LOGGER.info("Success to save template output meta. TemplateOutputMetas: {}", savedTemplate.getTemplateOutputMetas());
// Save template mid_table input meta
List<TemplateMidTableInputMeta> templateMidTableInputMetas = new ArrayList<>();
for (TemplateMidTableInputMetaRequest templateMidTableInputMetaRequest : request.getTemplateMidTableInputMetaRequests()) {
TemplateMidTableInputMeta templateMidTableInputMeta = new TemplateMidTableInputMeta();
templateMidTableInputMeta.setName(templateMidTableInputMetaRequest.getName());
templateMidTableInputMeta.setFieldType(templateMidTableInputMetaRequest.getFieldType());
templateMidTableInputMeta.setInputType(templateMidTableInputMetaRequest.getInputType());
templateMidTableInputMeta.setPlaceholder(templateMidTableInputMetaRequest.getPlaceholder());
templateMidTableInputMeta.setPlaceholderDescription(templateMidTableInputMetaRequest.getPlaceholderDescription());
templateMidTableInputMeta.setRegexpType(templateMidTableInputMetaRequest.getRegexpType());
templateMidTableInputMeta.setReplaceByRequest(templateMidTableInputMetaRequest.getReplaceByRequest());
templateMidTableInputMeta.setTemplate(savedTemplate);
templateMidTableInputMetas.add(templateMidTableInputMeta);
}
savedTemplate.setTemplateMidTableInputMetas(templateMidTableInputMetaService.saveAll(templateMidTableInputMetas));
LOGGER.info("Success to save template mid_table input meta. TemplateMidTableInputMetas: {}", savedTemplate.getTemplateMidTableInputMetas());
// Save template statistics input meta
List<TemplateStatisticsInputMeta> templateStatisticsInputMetas = new ArrayList<>();
for (TemplateStatisticsInputMetaRequest templateStatisticsInputMetaRequest : request.getTemplateStatisticsInputMetaRequests()) {
TemplateStatisticsInputMeta templateStatisticsInputMeta = new TemplateStatisticsInputMeta();
templateStatisticsInputMeta.setName(templateStatisticsInputMetaRequest.getName());
templateStatisticsInputMeta.setFuncName(templateStatisticsInputMetaRequest.getFuncName());
templateStatisticsInputMeta.setResultType(templateStatisticsInputMetaRequest.getResultType());
templateStatisticsInputMeta.setValue(templateStatisticsInputMetaRequest.getValue());
templateStatisticsInputMeta.setValueType(templateStatisticsInputMetaRequest.getValueType());
templateStatisticsInputMeta.setTemplate(savedTemplate);
templateStatisticsInputMetas.add(templateStatisticsInputMeta);
}
savedTemplate.setStatisticAction(templateStatisticsInputMetaService.saveAll(templateStatisticsInputMetas));
LOGGER.info("Success to save template statistics input meta. templateStatisticsInputMetas: {}", savedTemplate.getStatisticAction());
}
Aggregations