use of com.webank.wedatasphere.qualitis.rule.response.CustomRuleDetailResponse in project Qualitis by WeBankFinTech.
the class CustomRuleServiceImpl method getCustomRuleDetail.
@Override
public GeneralResponse<CustomRuleDetailResponse> getCustomRuleDetail(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.CUSTOM_RULE.getCode())) {
throw new UnExpectedRequestException("rule(id: [" + ruleId + "]) {&IS_NOT_A_CUSTOM_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());
CustomRuleDetailResponse response = new CustomRuleDetailResponse(ruleInDb);
LOGGER.info("Succeed to get custom rule detail. response: {}", response);
return new GeneralResponse<>("200", "{&SUCCEED_TO_GET_CUSTOM_RULE_DETAIL}", response);
}
Aggregations