use of com.webank.wedatasphere.qualitis.response.GeneralResponse in project Qualitis by WeBankFinTech.
the class RuleServiceImpl method getRuleDetail.
@Override
public GeneralResponse<RuleDetailResponse> getRuleDetail(Long ruleId) throws UnExpectedRequestException {
// Check existence of rule
Rule ruleInDb = ruleDao.findById(ruleId);
if (ruleInDb == null) {
throw new UnExpectedRequestException("rule_id [" + ruleId + "] {&DOES_NOT_EXIST}");
}
if (!ruleInDb.getRuleType().equals(RuleTypeEnum.SINGLE_TEMPLATE_RULE.getCode())) {
throw new UnExpectedRequestException("rule(id: [" + ruleId + "]) {&IS_NOT_A_RULE_WITH_TEMPLATE}");
}
Long projectInDbId = ruleInDb.getProject().getId();
String loginUser = HttpUtils.getUserName(httpServletRequest);
projectService.checkProjectExistence(projectInDbId, loginUser);
LOGGER.info("Succeed to find rule. rule_id: {}", ruleInDb.getId());
RuleDetailResponse response = new RuleDetailResponse(ruleInDb);
LOGGER.info("Succeed to get rule detail. rule_id: {}", ruleId);
return new GeneralResponse<>("200", "{&GET_RULE_DETAIL_SUCCESSFULLY}", response);
}
use of com.webank.wedatasphere.qualitis.response.GeneralResponse 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);
}
use of com.webank.wedatasphere.qualitis.response.GeneralResponse 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.response.GeneralResponse in project Qualitis by WeBankFinTech.
the class OuterExecutionServiceImpl method getApplicationStatus.
@Override
public GeneralResponse<?> getApplicationStatus(String applicationId) throws UnExpectedRequestException {
// Find application by applicationId
Application application = applicationDao.findById(applicationId);
if (application == null) {
throw new UnExpectedRequestException("Application_id {&DOES_NOT_EXIST}");
}
LOGGER.info("Succeed to find application. application: {}", application);
List<Task> tasks = taskDao.findByApplication(application);
ApplicationTaskResponse response = new ApplicationTaskResponse(application, tasks);
LOGGER.info("Succeed to get application status. response: {}", response);
return new GeneralResponse<>("200", "{&SUCCEED_TO_GET_APPLICATION_STATUS}", response);
}
use of com.webank.wedatasphere.qualitis.response.GeneralResponse in project Qualitis by WeBankFinTech.
the class OuterExecutionServiceImpl method getApplicationDynamicStatus.
@Override
public GeneralResponse<?> getApplicationDynamicStatus(String applicationId) throws UnExpectedRequestException {
// Find application by applicationId
Application application = applicationDao.findById(applicationId);
if (application == null) {
throw new UnExpectedRequestException("Application_id {&DOES_NOT_EXIST}");
}
LOGGER.info("Succeed to find application. application: {}", application);
return new GeneralResponse<>("200", "{&SUCCEED_TO_GET_APPLICATION_STATUS}", new ApplicationTaskResponse(application));
}
Aggregations