use of com.webank.wedatasphere.qualitis.rule.response.RuleDetailResponse 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.rule.response.RuleDetailResponse in project Qualitis by WeBankFinTech.
the class FileRuleServiceImpl 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.FILE_TEMPLATE_RULE.getCode())) {
throw new UnExpectedRequestException("rule(id: [" + ruleId + "]) {&IS_NOT_A_FILE_RULE}");
}
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", "{&SUCCEED_TO_GET_FILE_RULE_DETAIL}", response);
}
Aggregations