Search in sources :

Example 1 with TemplateMetaResponse

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);
}
Also used : GeneralResponse(com.webank.wedatasphere.qualitis.response.GeneralResponse) UnExpectedRequestException(com.webank.wedatasphere.qualitis.exception.UnExpectedRequestException) TemplateOutputMeta(com.webank.wedatasphere.qualitis.rule.entity.TemplateOutputMeta) Template(com.webank.wedatasphere.qualitis.rule.entity.Template) TemplateMetaResponse(com.webank.wedatasphere.qualitis.rule.response.TemplateMetaResponse)

Example 2 with TemplateMetaResponse

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);
}
Also used : GeneralResponse(com.webank.wedatasphere.qualitis.response.GeneralResponse) UnExpectedRequestException(com.webank.wedatasphere.qualitis.exception.UnExpectedRequestException) TemplateMidTableInputMeta(com.webank.wedatasphere.qualitis.rule.entity.TemplateMidTableInputMeta) TemplateOutputMeta(com.webank.wedatasphere.qualitis.rule.entity.TemplateOutputMeta) Template(com.webank.wedatasphere.qualitis.rule.entity.Template) TemplateMetaResponse(com.webank.wedatasphere.qualitis.rule.response.TemplateMetaResponse)

Aggregations

UnExpectedRequestException (com.webank.wedatasphere.qualitis.exception.UnExpectedRequestException)2 GeneralResponse (com.webank.wedatasphere.qualitis.response.GeneralResponse)2 Template (com.webank.wedatasphere.qualitis.rule.entity.Template)2 TemplateOutputMeta (com.webank.wedatasphere.qualitis.rule.entity.TemplateOutputMeta)2 TemplateMetaResponse (com.webank.wedatasphere.qualitis.rule.response.TemplateMetaResponse)2 TemplateMidTableInputMeta (com.webank.wedatasphere.qualitis.rule.entity.TemplateMidTableInputMeta)1