use of com.webank.wedatasphere.qualitis.rule.response.TemplateMetaResponse in project Qualitis by WeBankFinTech.
the class RuleTemplateServiceImpl method getRuleMultiTemplateMeta.
/**
* Get meta data information by template_id
* @param ruleTemplateId
* @return
* @throws UnExpectedRequestException
*/
@Override
public GeneralResponse<TemplateMetaResponse> getRuleMultiTemplateMeta(Long ruleTemplateId) throws UnExpectedRequestException {
// Find rule template by rule template id
Template templateInDb = ruleTemplateDao.findById(ruleTemplateId);
if (null == templateInDb) {
throw new UnExpectedRequestException("rule_template_id {&CAN_NOT_BE_NULL_OR_EMPTY}");
}
// Find meta data of template
List<TemplateOutputMeta> templateOutputMetas = templateOutputMetaDao.findByRuleTemplate(templateInDb);
// Add child template
if (templateInDb.getChildTemplate() != null) {
templateOutputMetas.addAll(templateOutputMetaDao.findByRuleTemplate(templateInDb.getChildTemplate()));
}
List<Integer> types = templateDataSourceTypeDao.findByTemplate(templateInDb).stream().map(TemplateDataSourceType::getDataSourceTypeId).collect(Collectors.toList());
TemplateMetaResponse response = new TemplateMetaResponse(templateInDb, templateOutputMetas, types);
LOGGER.info("Succeed to get rule_template, rule template id: {}", ruleTemplateId);
return new GeneralResponse<>("200", "{&GET_RULE_TEMPLATE_META_SUCCESSFULLY}", response);
}
use of com.webank.wedatasphere.qualitis.rule.response.TemplateMetaResponse in project Qualitis by WeBankFinTech.
the class RuleTemplateServiceImpl method getRuleTemplateMeta.
@Override
public GeneralResponse<TemplateMetaResponse> getRuleTemplateMeta(Long ruleTemplateId) throws UnExpectedRequestException {
// Find rule template by id
Template templateInDb = ruleTemplateDao.findById(ruleTemplateId);
if (null == templateInDb) {
throw new UnExpectedRequestException("rule_template_id {&CAN_NOT_BE_NULL_OR_EMPTY}");
}
// Find input meta data by template
List<TemplateMidTableInputMeta> templateMidTableInputMetas = templateMidTableInputMetaDao.findByRuleTemplate(templateInDb);
List<TemplateOutputMeta> templateOutputMetas = templateOutputMetaDao.findByRuleTemplate(templateInDb);
List<Integer> types = templateDataSourceTypeDao.findByTemplate(templateInDb).stream().map(TemplateDataSourceType::getDataSourceTypeId).collect(Collectors.toList());
TemplateMetaResponse response = new TemplateMetaResponse(templateInDb, templateMidTableInputMetas, templateOutputMetas, types);
LOGGER.info("Succeed to get rule_template. rule_template_id: {}", ruleTemplateId);
return new GeneralResponse<>("200", "{&GET_RULE_TEMPLATE_META_SUCCESSFULLY}", response);
}
Aggregations