Search in sources :

Example 1 with TemplateInputDemandResponse

use of com.webank.wedatasphere.qualitis.rule.response.TemplateInputDemandResponse in project Qualitis by WeBankFinTech.

the class RuleTemplateServiceImpl method getMultiSourceTemplateMeta.

@Override
public GeneralResponse<?> getMultiSourceTemplateMeta(Long templateId) throws UnExpectedRequestException {
    // Check existence of template and if multi-table rule template
    Template templateInDb = checkRuleTemplate(templateId);
    if (!templateInDb.getTemplateType().equals(RuleTemplateTypeEnum.MULTI_SOURCE_TEMPLATE.getCode())) {
        throw new UnExpectedRequestException("Template : [" + templateId + "] {&IS_NOT_A_MULTI_TEMPLATE}");
    }
    // return show_sql of template and template output
    TemplateInputDemandResponse templateInputDemandResponse = new TemplateInputDemandResponse(templateInDb, RuleTemplateTypeEnum.MULTI_SOURCE_TEMPLATE.getCode());
    LOGGER.info("Succeed to get the meta of multi_rule_template. rule_template_id: {}", templateId);
    return new GeneralResponse<>("200", "{&GET_META_OF_MULTI_RULE_TEMPLATE_SUCCESSFULLY}", templateInputDemandResponse);
}
Also used : GeneralResponse(com.webank.wedatasphere.qualitis.response.GeneralResponse) UnExpectedRequestException(com.webank.wedatasphere.qualitis.exception.UnExpectedRequestException) TemplateInputDemandResponse(com.webank.wedatasphere.qualitis.rule.response.TemplateInputDemandResponse) Template(com.webank.wedatasphere.qualitis.rule.entity.Template)

Example 2 with TemplateInputDemandResponse

use of com.webank.wedatasphere.qualitis.rule.response.TemplateInputDemandResponse in project Qualitis by WeBankFinTech.

the class RuleTemplateServiceImpl method getRuleTemplateInputMeta.

@Override
public GeneralResponse<TemplateInputDemandResponse> getRuleTemplateInputMeta(Long ruleTemplateId) throws UnExpectedRequestException {
    // Check existence of rule template
    Template templateInDb = ruleTemplateDao.findById(ruleTemplateId);
    if (null == templateInDb) {
        throw new UnExpectedRequestException("rule_template_id {&DOES_NOT_EXIST}");
    }
    TemplateInputDemandResponse templateInputDemandResponse = new TemplateInputDemandResponse(templateInDb, regexpExprMapperRepository);
    LOGGER.info("Succeed to get the input of rule_template. rule_template_id: {}", ruleTemplateId);
    return new GeneralResponse<>("200", "{&GET_TEMPLATE_RULE_DEMAND_SUCCESSFULLY}", templateInputDemandResponse);
}
Also used : GeneralResponse(com.webank.wedatasphere.qualitis.response.GeneralResponse) UnExpectedRequestException(com.webank.wedatasphere.qualitis.exception.UnExpectedRequestException) TemplateInputDemandResponse(com.webank.wedatasphere.qualitis.rule.response.TemplateInputDemandResponse) Template(com.webank.wedatasphere.qualitis.rule.entity.Template)

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 TemplateInputDemandResponse (com.webank.wedatasphere.qualitis.rule.response.TemplateInputDemandResponse)2