use of com.webank.wedatasphere.qualitis.rule.response.TemplateMidTableInputMetaResponse in project Qualitis by WeBankFinTech.
the class RuleTemplateServiceImpl method getModifyRuleTemplateDetail.
@Override
public RuleTemplateResponse getModifyRuleTemplateDetail(Long templateId) throws UnExpectedRequestException {
// Check template existence
Template templateInDb = checkRuleTemplate(templateId);
RuleTemplateResponse response = new RuleTemplateResponse(templateInDb);
response.setClusterNum(templateInDb.getClusterNum());
response.setDbNum(templateInDb.getDbNum());
response.setTableNum(templateInDb.getTableNum());
response.setFieldNum(templateInDb.getFieldNum());
List<TemplateDataSourceType> templateDataSourceTypes = templateDataSourceTypeDao.findByTemplate(templateInDb);
response.setDatasourceType(templateDataSourceTypes.stream().map(TemplateDataSourceType::getDataSourceTypeId).collect(Collectors.toList()));
response.setActionType(templateInDb.getActionType());
response.setMidTableAction(templateInDb.getMidTableAction());
response.setSaveMidTable(templateInDb.getSaveMidTable());
List<TemplateOutputMetaResponse> outputMetaResponses = new ArrayList<>(1);
List<TemplateMidTableInputMetaResponse> midTableInputMetaResponses = new ArrayList<>(2);
List<TemplateStatisticsInputMetaResponse> statisticsInputMetaResponses = new ArrayList<>(1);
for (TemplateOutputMeta templateOutputMeta : templateInDb.getTemplateOutputMetas()) {
TemplateOutputMetaResponse templateOutputMetaResponse = new TemplateOutputMetaResponse();
templateOutputMetaResponse.setOutputName(templateOutputMeta.getOutputName());
outputMetaResponses.add(templateOutputMetaResponse);
}
response.setTemplateOutputMetaResponses(outputMetaResponses);
for (TemplateMidTableInputMeta templateMidTableInputMeta : templateInDb.getTemplateMidTableInputMetas()) {
TemplateMidTableInputMetaResponse templateMidTableInputMetaResponse = new TemplateMidTableInputMetaResponse();
templateMidTableInputMetaResponse.setName(templateMidTableInputMeta.getName());
templateMidTableInputMetaResponse.setPlaceholder(templateMidTableInputMeta.getPlaceholder());
templateMidTableInputMetaResponse.setPlaceholderDescription(templateMidTableInputMeta.getPlaceholderDescription());
templateMidTableInputMetaResponse.setInputType(templateMidTableInputMeta.getInputType());
midTableInputMetaResponses.add(templateMidTableInputMetaResponse);
}
response.setTemplateMidTableInputMetaResponses(midTableInputMetaResponses);
for (TemplateStatisticsInputMeta templateStatisticsInputMeta : templateInDb.getStatisticAction()) {
TemplateStatisticsInputMetaResponse templateStatisticsInputMetaResponse = new TemplateStatisticsInputMetaResponse();
templateStatisticsInputMetaResponse.setName(templateStatisticsInputMeta.getName());
templateStatisticsInputMetaResponse.setFuncName(templateStatisticsInputMeta.getFuncName());
templateStatisticsInputMetaResponse.setValue(templateStatisticsInputMeta.getValue());
templateStatisticsInputMetaResponse.setValueType(templateStatisticsInputMeta.getValueType());
statisticsInputMetaResponses.add(templateStatisticsInputMetaResponse);
}
response.setTemplateStatisticsInputMetaResponses(statisticsInputMetaResponses);
return response;
}
Aggregations