Search in sources :

Example 11 with PermissionDeniedRequestException

use of com.webank.wedatasphere.qualitis.exception.PermissionDeniedRequestException in project Qualitis by WeBankFinTech.

the class RuleMetricServiceImpl method download.

@Override
public GeneralResponse<?> download(DownloadRuleMetricRequest request, HttpServletResponse response) throws UnExpectedRequestException, IOException, WriteExcelException, PermissionDeniedRequestException {
    // Check rule metric IDs permission.
    PageRequest pageRequest = new PageRequest(0, Integer.MAX_VALUE);
    List<RuleMetricResponse> ownRuleMetric = getAllRuleMetric(pageRequest).getData().getData().stream().collect(Collectors.toList());
    if (ownRuleMetric.size() <= 0 || ownRuleMetric.size() >= MAX_RULE_METRIC_COUNT) {
        throw new UnExpectedRequestException("The number of metrics is illegal");
    }
    List<Long> downloadIds = request.getRuleMetricIds();
    List<Long> ownIds = ownRuleMetric.stream().map(RuleMetricResponse::getId).collect(Collectors.toList());
    if (ownIds.containsAll(downloadIds)) {
        List<RuleMetricResponse> downloadRuleMetric = ownRuleMetric.stream().filter(ruleMetricResponse -> downloadIds.contains(ruleMetricResponse.getId())).collect(Collectors.toList());
        List<ExcelRuleMetric> excelRuleMetrics = new ArrayList<>(downloadRuleMetric.size());
        for (RuleMetricResponse ruleMetricResponse : downloadRuleMetric) {
            ExcelRuleMetric excelRuleMetric = new ExcelRuleMetric();
            excelRuleMetric.setName(ruleMetricResponse.getName());
            excelRuleMetric.setChName(ruleMetricResponse.getCnName());
            excelRuleMetric.setMetricDesc(ruleMetricResponse.getMetricDesc());
            int bussCode = ruleMetricResponse.getBussCode();
            excelRuleMetric.setDimension(bussCode + "");
            if (RuleMetricBussCodeEnum.SUBSYSTEM.getCode().equals(bussCode)) {
                excelRuleMetric.setFullCnName(ruleMetricResponse.getFullCnName());
                excelRuleMetric.setSubSystemName(ruleMetricResponse.getSubSystemName());
                excelRuleMetric.setSubSystemId(String.valueOf(ruleMetricResponse.getSubSystemId()));
            } else if (RuleMetricBussCodeEnum.PRODUCT.getCode().equals(bussCode)) {
                excelRuleMetric.setProductId(ruleMetricResponse.getProductId());
                excelRuleMetric.setProductName(ruleMetricResponse.getProductName());
            } else if (RuleMetricBussCodeEnum.CUSTOM.getCode().equals(bussCode)) {
                excelRuleMetric.setBussCustom(ruleMetricResponse.getBussCustom());
            }
            excelRuleMetric.setFrequency(String.valueOf(ruleMetricResponse.getFrequency()));
            excelRuleMetric.setDevDepartmentName(ruleMetricResponse.getDevDepartmentName());
            excelRuleMetric.setOpsDepartmentName(ruleMetricResponse.getOpsDepartmentName());
            excelRuleMetric.setDepartmentCode(ruleMetricResponse.getDepartmentCode());
            excelRuleMetric.setDepartmentName(ruleMetricResponse.getDepartmentName());
            excelRuleMetric.setAvailable(ruleMetricResponse.getAvailable());
            excelRuleMetric.setEnCode(ruleMetricResponse.getEnCode());
            excelRuleMetric.setType(ruleMetricResponse.getType());
            excelRuleMetrics.add(excelRuleMetric);
        }
        String fileName = "batch_metrics_export_" + FILE_DATE_FORMATTER.format(new Date());
        fileName = URLEncoder.encode(fileName, "UTF-8");
        response.setContentType("application/octet-stream");
        response.addHeader("Content-Disposition", "attachment;filename*=UTF-8''" + fileName);
        response.addHeader("Access-Control-Expose-Headers", "Content-Disposition");
        OutputStream outputStream = response.getOutputStream();
        writeExcelToOutput(excelRuleMetrics, outputStream);
        outputStream.flush();
    } else {
        throw new PermissionDeniedRequestException("HAS_NO_PERMISSION_TO_ACCESS", 403);
    }
    LOGGER.info("Succeed to download all rule metrics in type of excel");
    return null;
}
Also used : StringUtils(org.apache.commons.lang.StringUtils) FormDataContentDisposition(org.glassfish.jersey.media.multipart.FormDataContentDisposition) Date(java.util.Date) LoggerFactory(org.slf4j.LoggerFactory) Autowired(org.springframework.beans.factory.annotation.Autowired) PermissionDeniedRequestException(com.webank.wedatasphere.qualitis.exception.PermissionDeniedRequestException) HiveRuleDetail(com.webank.wedatasphere.qualitis.project.response.HiveRuleDetail) RuleMetricValueResponse(com.webank.wedatasphere.qualitis.response.RuleMetricValueResponse) GeneralResponse(com.webank.wedatasphere.qualitis.response.GeneralResponse) AlarmConfig(com.webank.wedatasphere.qualitis.rule.entity.AlarmConfig) RuleMetricDao(com.webank.wedatasphere.qualitis.dao.RuleMetricDao) HttpUtils(com.webank.wedatasphere.qualitis.util.HttpUtils) GetAllResponse(com.webank.wedatasphere.qualitis.response.GetAllResponse) RuleMetricBussCodeEnum(com.webank.wedatasphere.qualitis.constant.RuleMetricBussCodeEnum) Context(javax.ws.rs.core.Context) ExcelReader(com.alibaba.excel.ExcelReader) PageRequest(com.webank.wedatasphere.qualitis.request.PageRequest) ModifyRuleMetricRequest(com.webank.wedatasphere.qualitis.request.ModifyRuleMetricRequest) Department(com.webank.wedatasphere.qualitis.entity.Department) Set(java.util.Set) RuleMetricDepartmentUser(com.webank.wedatasphere.qualitis.entity.RuleMetricDepartmentUser) Collectors(java.util.stream.Collectors) ExecutionManagerImpl(com.webank.wedatasphere.qualitis.submitter.impl.ExecutionManagerImpl) ExcelTypeEnum(com.alibaba.excel.support.ExcelTypeEnum) List(java.util.List) RuleMetricResponse(com.webank.wedatasphere.qualitis.response.RuleMetricResponse) Sheet(com.alibaba.excel.metadata.Sheet) CommonChecker(com.webank.wedatasphere.qualitis.project.request.CommonChecker) UnExpectedRequestException(com.webank.wedatasphere.qualitis.exception.UnExpectedRequestException) RoleDefaultTypeEnum(com.webank.wedatasphere.qualitis.rule.constant.RoleDefaultTypeEnum) UserRole(com.webank.wedatasphere.qualitis.entity.UserRole) FastDateFormat(org.apache.commons.lang.time.FastDateFormat) RuleMetricTypeConfigDao(com.webank.wedatasphere.qualitis.dao.RuleMetricTypeConfigDao) RuleMetricQueryRequest(com.webank.wedatasphere.qualitis.request.RuleMetricQueryRequest) UserRoleDao(com.webank.wedatasphere.qualitis.dao.UserRoleDao) Rule(com.webank.wedatasphere.qualitis.rule.entity.Rule) ArrayList(java.util.ArrayList) ExcelWriter(com.alibaba.excel.ExcelWriter) RuleMetricConditionResponse(com.webank.wedatasphere.qualitis.response.RuleMetricConditionResponse) RuleMetricLevelEnum(com.webank.wedatasphere.qualitis.constant.RuleMetricLevelEnum) HttpServletRequest(javax.servlet.http.HttpServletRequest) User(com.webank.wedatasphere.qualitis.entity.User) ExcelRuleMetricListener(com.webank.wedatasphere.qualitis.excel.ExcelRuleMetricListener) ExcelRuleMetric(com.webank.wedatasphere.qualitis.project.excel.ExcelRuleMetric) CollectionUtils(org.apache.commons.collections.CollectionUtils) Propagation(org.springframework.transaction.annotation.Propagation) Service(org.springframework.stereotype.Service) RuleMetricService(com.webank.wedatasphere.qualitis.service.RuleMetricService) TaskResult(com.webank.wedatasphere.qualitis.entity.TaskResult) DownloadRuleMetricRequest(com.webank.wedatasphere.qualitis.request.DownloadRuleMetricRequest) RoleService(com.webank.wedatasphere.qualitis.service.RoleService) OutputStream(java.io.OutputStream) Logger(org.slf4j.Logger) RuleMetric(com.webank.wedatasphere.qualitis.entity.RuleMetric) HttpServletResponse(javax.servlet.http.HttpServletResponse) RuleMetricTypeConfig(com.webank.wedatasphere.qualitis.entity.RuleMetricTypeConfig) IOException(java.io.IOException) AddRuleMetricRequest(com.webank.wedatasphere.qualitis.request.AddRuleMetricRequest) DataInfo(com.webank.wedatasphere.qualitis.metadata.response.DataInfo) URLEncoder(java.net.URLEncoder) ExcelSheetName(com.webank.wedatasphere.qualitis.project.constant.ExcelSheetName) RuleDao(com.webank.wedatasphere.qualitis.rule.dao.RuleDao) RuleMetricDepartmentUserDao(com.webank.wedatasphere.qualitis.dao.RuleMetricDepartmentUserDao) UserDao(com.webank.wedatasphere.qualitis.dao.UserDao) TaskResultDao(com.webank.wedatasphere.qualitis.dao.TaskResultDao) WriteExcelException(com.webank.wedatasphere.qualitis.rule.exception.WriteExcelException) InputStream(java.io.InputStream) Transactional(org.springframework.transaction.annotation.Transactional) ExcelRuleMetric(com.webank.wedatasphere.qualitis.project.excel.ExcelRuleMetric) UnExpectedRequestException(com.webank.wedatasphere.qualitis.exception.UnExpectedRequestException) PermissionDeniedRequestException(com.webank.wedatasphere.qualitis.exception.PermissionDeniedRequestException) OutputStream(java.io.OutputStream) ArrayList(java.util.ArrayList) Date(java.util.Date) RuleMetricResponse(com.webank.wedatasphere.qualitis.response.RuleMetricResponse) PageRequest(com.webank.wedatasphere.qualitis.request.PageRequest)

Example 12 with PermissionDeniedRequestException

use of com.webank.wedatasphere.qualitis.exception.PermissionDeniedRequestException in project Qualitis by WeBankFinTech.

the class RuleMetricServiceImpl method deleteRuleMetric.

@Override
@Transactional(rollbackFor = { Exception.class, RuntimeException.class, UnExpectedRequestException.class })
public GeneralResponse<RuleMetricResponse> deleteRuleMetric(long id) throws UnExpectedRequestException, PermissionDeniedRequestException {
    if (id <= 0) {
        throw new UnExpectedRequestException("{&REQUEST_CAN_NOT_BE_NULL}");
    }
    // Check rule metric existence.
    RuleMetric ruleMetricInDb = ruleMetricDao.findById(id);
    if (ruleMetricInDb == null) {
        throw new UnExpectedRequestException("Rule Metric ID [" + id + "] {&DOES_NOT_EXIST}");
    }
    String userName = HttpUtils.getUserName(httpServletRequest);
    LOGGER.info("Start to delete rule metric, rule metric ID: [{}], user: [{}]", id, userName);
    User loginUser = userDao.findByUsername(userName);
    List<UserRole> userRoles = userRoleDao.findByUser(loginUser);
    Integer roleType = roleService.getRoleType(userRoles);
    if (roleType.equals(RoleDefaultTypeEnum.ADMIN.getCode())) {
        LOGGER.info("SYS_ADMIN will delete rule metric.");
        RuleMetricDepartmentUser ruleMetricDepartmentUser = ruleMetricDepartmentUserDao.findByRuleMetric(ruleMetricInDb);
        if (ruleMetricDepartmentUser != null) {
            LOGGER.info("Rule metric[{}] will be delete.", ruleMetricInDb.toString());
            ruleMetricDepartmentUserDao.delete(ruleMetricDepartmentUser);
        }
    } else if (roleType.equals(RoleDefaultTypeEnum.DEPARTMENT_ADMIN.getCode())) {
        LOGGER.info("DEPARTMENT_ADMIN will delete rule metric.");
        if (ruleMetricInDb.getLevel().equals(RuleMetricLevelEnum.DEFAULT_METRIC.getCode())) {
            throw new PermissionDeniedRequestException("User {&HAS_NO_PERMISSION_TO_ACCESS}", 403);
        }
        List<Department> managedDepartment = new ArrayList<>();
        for (UserRole userRole : userRoles) {
            Department department = userRole.getRole().getDepartment();
            if (department != null) {
                managedDepartment.add(department);
            }
        }
        RuleMetricDepartmentUser ruleMetricDepartmentUser = ruleMetricDepartmentUserDao.findByRuleMetric(ruleMetricInDb);
        if (ruleMetricDepartmentUser != null && managedDepartment.contains(ruleMetricDepartmentUser.getDepartment())) {
            LOGGER.info("Rule metric[{}] will be delete.", ruleMetricInDb.toString());
            ruleMetricDepartmentUserDao.delete(ruleMetricDepartmentUser);
        } else {
            throw new PermissionDeniedRequestException("User {&HAS_NO_PERMISSION_TO_ACCESS}", 403);
        }
    } else {
        LOGGER.info("PROJECTOR will delete rule metric.");
        if (!ruleMetricInDb.getLevel().equals(RuleMetricLevelEnum.PERSONAL_METRIC.getCode()) || !ruleMetricInDb.getCreateUser().equals(loginUser.getUserName())) {
            throw new PermissionDeniedRequestException("User {&HAS_NO_PERMISSION_TO_ACCESS}", 403);
        }
        RuleMetricDepartmentUser ruleMetricDepartmentUser = ruleMetricDepartmentUserDao.findByRuleMetric(ruleMetricInDb);
        if (ruleMetricDepartmentUser != null) {
            LOGGER.info("Rule metric[{}] will be delete.", ruleMetricInDb.toString());
            ruleMetricDepartmentUserDao.delete(ruleMetricDepartmentUser);
        } else {
            throw new PermissionDeniedRequestException("User {&HAS_NO_PERMISSION_TO_ACCESS}", 403);
        }
    }
    ruleMetricDao.delete(ruleMetricInDb);
    return new GeneralResponse<>("200", "{&DELETE_RULE_METRIC_SUCCESSFULLY}", null);
}
Also used : ExcelRuleMetric(com.webank.wedatasphere.qualitis.project.excel.ExcelRuleMetric) RuleMetric(com.webank.wedatasphere.qualitis.entity.RuleMetric) RuleMetricDepartmentUser(com.webank.wedatasphere.qualitis.entity.RuleMetricDepartmentUser) UnExpectedRequestException(com.webank.wedatasphere.qualitis.exception.UnExpectedRequestException) PermissionDeniedRequestException(com.webank.wedatasphere.qualitis.exception.PermissionDeniedRequestException) RuleMetricDepartmentUser(com.webank.wedatasphere.qualitis.entity.RuleMetricDepartmentUser) User(com.webank.wedatasphere.qualitis.entity.User) GeneralResponse(com.webank.wedatasphere.qualitis.response.GeneralResponse) Department(com.webank.wedatasphere.qualitis.entity.Department) UserRole(com.webank.wedatasphere.qualitis.entity.UserRole) List(java.util.List) ArrayList(java.util.ArrayList) Transactional(org.springframework.transaction.annotation.Transactional)

Example 13 with PermissionDeniedRequestException

use of com.webank.wedatasphere.qualitis.exception.PermissionDeniedRequestException in project Qualitis by WeBankFinTech.

the class OuterExecutionServiceImpl method groupExecution.

@Override
public GeneralResponse<?> groupExecution(GroupExecutionRequest request, Integer invokeCode) throws UnExpectedRequestException, PermissionDeniedRequestException {
    LOGGER.info("Execute application by group. group_id: {}", request.getGroupId());
    LOGGER.info("Execute application by nodename. nodename: {}", request.getNodeName());
    // Check Arguments
    GroupExecutionRequest.checkRequest(request);
    String loginUser = getLoginUser(httpServletRequest, request.getCreateUser(), request.getAsync());
    // Check existence of project
    RuleGroup ruleGroupInDb = ruleGroupDao.findById(request.getGroupId());
    if (null == ruleGroupInDb) {
        throw new UnExpectedRequestException("Group_id " + request.getGroupId() + " {&DOES_NOT_EXIST}");
    }
    LOGGER.info("Succeed to find rule group. group_id: {}", ruleGroupInDb.getId());
    Project projectInDb = projectDao.findById(ruleGroupInDb.getProjectId());
    // Check permissions of project
    List<Integer> permissions = new ArrayList<>();
    permissions.add(ProjectUserPermissionEnum.OPERATOR.getCode());
    projectService.checkProjectPermission(projectInDb, loginUser, permissions);
    checkPermissionCreateUserProxyExecuteUser(request.getCreateUser(), request.getExecutionUser());
    // Find all rules
    List<Rule> rules = ruleDao.findByRuleGroup(ruleGroupInDb);
    if (CollectionUtils.isEmpty(rules)) {
        throw new UnExpectedRequestException("{&NO_RULE_CAN_BE_EXECUTED}");
    }
    List<Long> ruleIds = rules.stream().map(Rule::getId).collect(Collectors.toList());
    StringBuffer runDate = new StringBuffer();
    StringBuffer partition = new StringBuffer();
    Map<String, String> execParamMap = new HashMap<>(5);
    parseExecParams(partition, runDate, request.getExecutionParam(), execParamMap);
    List<ApplicationSubmitRequest> applicationSubmitRequests = new ArrayList<>();
    // Construct dynamic partition.
    try {
        submitRulesWithDynamicPartition(applicationSubmitRequests, projectInDb.getId(), ruleGroupInDb.getId(), rules, ruleIds, request.getExecutionUser(), request.getDyNamicPartition(), request.getClusterName(), partition, request.getDyNamicPartitionPrefix());
    } catch (ResourceAccessException e) {
        generateAbnormalApplicationInfo(projectInDb.getId(), request.getGroupId(), request.getCreateUser(), request.getExecutionUser(), new Date(), invokeCode, partition.toString(), request.getStartupParamName(), request.getExecutionParam(), e, ApplicationCommentEnum.METADATA_ISSUES.getCode(), ApplicationStatusEnum.TASK_SUBMIT_FAILED.getCode(), rules);
        LOGGER.error("One group execution[id={}] of the project execution start failed!", request.getGroupId());
    } catch (NoPartitionException e) {
        generateAbnormalApplicationInfo(projectInDb.getId(), request.getGroupId(), request.getCreateUser(), request.getExecutionUser(), new Date(), invokeCode, partition.toString(), request.getStartupParamName(), request.getExecutionParam(), e, ApplicationCommentEnum.METADATA_ISSUES.getCode(), ApplicationStatusEnum.TASK_SUBMIT_FAILED.getCode(), rules);
        LOGGER.error("One group execution[id={}] of the project execution start failed!", request.getGroupId());
    } catch (Exception e) {
        generateAbnormalApplicationInfo(projectInDb.getId(), request.getGroupId(), request.getCreateUser(), request.getExecutionUser(), new Date(), invokeCode, partition.toString(), request.getStartupParamName(), request.getExecutionParam(), e, ApplicationCommentEnum.UNKNOWN_ERROR_ISSUES.getCode(), ApplicationStatusEnum.TASK_SUBMIT_FAILED.getCode(), rules);
        LOGGER.error("One group execution[id={}] of the project execution start failed!", request.getGroupId());
    }
    if (CollectionUtils.isEmpty(ruleIds)) {
        return new GeneralResponse<>("200", "{&SUCCEED_TO_DISPATCH_TASK}", null);
    }
    GeneralResponse<ApplicationTaskSimpleResponse> generalResponse = (GeneralResponse<ApplicationTaskSimpleResponse>) outerExecutionService.submitRules(ruleIds, partition, loginUser, request.getExecutionUser(), request.getNodeName(), projectInDb.getId(), ruleGroupInDb.getId(), request.getStartupParamName(), request.getClusterName(), request.getSetFlag(), execParamMap, request.getExecutionParam(), runDate, invokeCode);
    // Record project event.
    projectEventService.record(projectInDb.getId(), loginUser, "submit group execution", "group[name=" + ruleGroupInDb.getRuleGroupName() + "].", EventTypeEnum.SUBMIT_PROJECT.getCode());
    return generalResponse;
}
Also used : ApplicationSubmitRequest(com.webank.wedatasphere.qualitis.request.ApplicationSubmitRequest) UnExpectedRequestException(com.webank.wedatasphere.qualitis.exception.UnExpectedRequestException) ApplicationTaskSimpleResponse(com.webank.wedatasphere.qualitis.response.ApplicationTaskSimpleResponse) LinkedHashMap(java.util.LinkedHashMap) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) RuleGroup(com.webank.wedatasphere.qualitis.rule.entity.RuleGroup) ResourceAccessException(org.springframework.web.client.ResourceAccessException) Date(java.util.Date) ClusterInfoNotConfigException(com.webank.wedatasphere.qualitis.exception.ClusterInfoNotConfigException) DataSourceOverSizeException(com.webank.wedatasphere.qualitis.exception.DataSourceOverSizeException) JobSubmitException(com.webank.wedatasphere.qualitis.exception.JobSubmitException) ConvertException(com.webank.wedatasphere.qualitis.exception.ConvertException) LeftNullDatasourceException(com.webank.wedatasphere.qualitis.exception.LeftNullDatasourceException) JobKillException(com.webank.wedatasphere.qualitis.exception.JobKillException) TaskTypeException(com.webank.wedatasphere.qualitis.exception.TaskTypeException) ArgumentException(com.webank.wedatasphere.qualitis.exception.ArgumentException) BothNullDatasourceException(com.webank.wedatasphere.qualitis.exception.BothNullDatasourceException) IOException(java.io.IOException) TaskNotExistException(com.webank.wedatasphere.qualitis.exception.TaskNotExistException) SemanticException(org.apache.hadoop.hive.ql.parse.SemanticException) PermissionDeniedRequestException(com.webank.wedatasphere.qualitis.exception.PermissionDeniedRequestException) ParseException(org.apache.hadoop.hive.ql.parse.ParseException) SystemConfigException(com.webank.wedatasphere.qualitis.exception.SystemConfigException) RuleVariableNotSupportException(com.webank.wedatasphere.qualitis.exception.RuleVariableNotSupportException) MetaDataAcquireFailedException(com.webank.wedatasphere.qualitis.metadata.exception.MetaDataAcquireFailedException) UnExpectedRequestException(com.webank.wedatasphere.qualitis.exception.UnExpectedRequestException) LogPartialException(com.webank.wedatasphere.qualitis.exception.LogPartialException) DataQualityTaskException(com.webank.wedatasphere.qualitis.exception.DataQualityTaskException) RuleVariableNotFoundException(com.webank.wedatasphere.qualitis.exception.RuleVariableNotFoundException) DataSourceMoveException(com.webank.wedatasphere.qualitis.exception.DataSourceMoveException) ResourceAccessException(org.springframework.web.client.ResourceAccessException) RightNullDatasourceException(com.webank.wedatasphere.qualitis.exception.RightNullDatasourceException) NoPartitionException(com.webank.wedatasphere.qualitis.exception.NoPartitionException) GeneralResponse(com.webank.wedatasphere.qualitis.response.GeneralResponse) Project(com.webank.wedatasphere.qualitis.project.entity.Project) NoPartitionException(com.webank.wedatasphere.qualitis.exception.NoPartitionException) Rule(com.webank.wedatasphere.qualitis.rule.entity.Rule)

Example 14 with PermissionDeniedRequestException

use of com.webank.wedatasphere.qualitis.exception.PermissionDeniedRequestException in project Qualitis by WeBankFinTech.

the class OuterExecutionServiceImpl method projectExecution.

@Override
@Transactional(rollbackFor = { RuntimeException.class, UnExpectedRequestException.class })
public GeneralResponse<?> projectExecution(ProjectExecutionRequest request, Integer invokeCode) throws UnExpectedRequestException, PermissionDeniedRequestException {
    LOGGER.info("Execute application by project. project_id: {}", request.getProjectId());
    // Check Arguments
    ProjectExecutionRequest.checkRequest(request);
    String executionUser = request.getExecutionUser();
    String loginUser = getLoginUser(httpServletRequest, request.getCreateUser(), request.getAsync());
    LOGGER.info("Qualitis execution user: {}", executionUser);
    LOGGER.info("Qualitis login or create user: {}", loginUser);
    // Check existence of project
    Project projectInDb = projectDao.findById(request.getProjectId());
    if (null == projectInDb) {
        throw new UnExpectedRequestException("Project_id " + request.getProjectId() + " {&DOES_NOT_EXIST}");
    }
    // Check permissions of project
    List<Integer> permissions = new ArrayList<>();
    permissions.add(ProjectUserPermissionEnum.OPERATOR.getCode());
    projectService.checkProjectPermission(projectInDb, loginUser, permissions);
    checkPermissionCreateUserProxyExecuteUser(request.getCreateUser(), request.getExecutionUser());
    // Find all rule group
    List<RuleGroup> ruleGroups = ruleGroupDao.findByProjectId(projectInDb.getId());
    if (CollectionUtils.isEmpty(ruleGroups)) {
        throw new UnExpectedRequestException("{&NO_RULE_CAN_BE_EXECUTED}");
    }
    LOGGER.info("Succeed to find rule group list from project[id={}], rule group[{}]", projectInDb.getId(), Arrays.toString(ruleGroups.toArray()));
    // Parse partition and run date from execution parameters.
    StringBuffer partition = new StringBuffer();
    StringBuffer runDate = new StringBuffer();
    Map<String, String> execParamMap = new HashMap<>(5);
    parseExecParams(partition, runDate, request.getExecutionParam(), execParamMap);
    ApplicationProjectResponse applicationProjectResponse = new ApplicationProjectResponse();
    List<ApplicationSubmitRequest> applicationSubmitRequests = new ArrayList<>(ruleGroups.size());
    for (RuleGroup ruleGroup : ruleGroups) {
        // Find all rules
        List<Rule> rules = ruleDao.findByRuleGroup(ruleGroup);
        if (CollectionUtils.isEmpty(rules)) {
            ruleGroupDao.delete(ruleGroup);
            continue;
        }
        LOGGER.info("Succeed to get rules from rule group[id={}].", ruleGroup.getId());
        List<Long> ruleIds = rules.stream().map(Rule::getId).collect(Collectors.toList());
        try {
            // Dynamic partition.
            submitRulesWithDynamicPartition(applicationSubmitRequests, projectInDb.getId(), ruleGroup.getId(), rules, ruleIds, executionUser, request.getDyNamicPartition(), request.getClusterName(), partition, request.getDyNamicPartitionPrefix());
            if (CollectionUtils.isEmpty(ruleIds)) {
                continue;
            }
        } catch (ResourceAccessException e) {
            generateAbnormalApplicationInfo(request.getProjectId(), ruleGroup.getId(), request.getCreateUser(), executionUser, new Date(), invokeCode, partition.toString(), request.getStartupParamName(), request.getExecutionParam(), e, ApplicationCommentEnum.METADATA_ISSUES.getCode(), ApplicationStatusEnum.TASK_SUBMIT_FAILED.getCode(), rules);
            LOGGER.error("One group execution[id={}] of the project execution start failed!", ruleGroup.getId());
        } catch (NoPartitionException e) {
            generateAbnormalApplicationInfo(request.getProjectId(), ruleGroup.getId(), request.getCreateUser(), executionUser, new Date(), invokeCode, partition.toString(), request.getStartupParamName(), request.getExecutionParam(), e, ApplicationCommentEnum.METADATA_ISSUES.getCode(), ApplicationStatusEnum.TASK_SUBMIT_FAILED.getCode(), rules);
            LOGGER.error("One group execution[id={}] of the project execution start failed!", ruleGroup.getId());
        } catch (Exception e) {
            generateAbnormalApplicationInfo(request.getProjectId(), ruleGroup.getId(), request.getCreateUser(), executionUser, new Date(), invokeCode, partition.toString(), request.getStartupParamName(), request.getExecutionParam(), e, ApplicationCommentEnum.UNKNOWN_ERROR_ISSUES.getCode(), ApplicationStatusEnum.TASK_SUBMIT_FAILED.getCode(), rules);
            LOGGER.error("One group execution[id={}] of the project execution start failed!", ruleGroup.getId());
        }
        applicationSubmitRequests.add(new ApplicationSubmitRequest(projectInDb.getId(), ruleGroup.getId(), ruleIds, partition));
    }
    for (ApplicationSubmitRequest applicationSubmitRequest : applicationSubmitRequests) {
        GeneralResponse<?> generalResponse = outerExecutionService.submitRules(applicationSubmitRequest.getRuleIds(), applicationSubmitRequest.getPartition(), loginUser, executionUser, DEFAULT_NODE_NAME, projectInDb.getId(), applicationSubmitRequest.getRuleGroupId(), request.getStartupParamName(), request.getClusterName(), request.getSetFlag(), execParamMap, request.getExecutionParam(), runDate, invokeCode);
        applicationProjectResponse.getApplicationTaskSimpleResponses().add((ApplicationTaskSimpleResponse) generalResponse.getData());
    }
    // Record project event.
    projectEventService.record(projectInDb.getId(), loginUser, "submit project execution", ".", EventTypeEnum.SUBMIT_PROJECT.getCode());
    return new GeneralResponse<>("200", "{&SUCCEED_TO_DISPATCH_TASK}", applicationProjectResponse);
}
Also used : ApplicationSubmitRequest(com.webank.wedatasphere.qualitis.request.ApplicationSubmitRequest) UnExpectedRequestException(com.webank.wedatasphere.qualitis.exception.UnExpectedRequestException) LinkedHashMap(java.util.LinkedHashMap) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) RuleGroup(com.webank.wedatasphere.qualitis.rule.entity.RuleGroup) ApplicationProjectResponse(com.webank.wedatasphere.qualitis.response.ApplicationProjectResponse) ResourceAccessException(org.springframework.web.client.ResourceAccessException) Date(java.util.Date) ClusterInfoNotConfigException(com.webank.wedatasphere.qualitis.exception.ClusterInfoNotConfigException) DataSourceOverSizeException(com.webank.wedatasphere.qualitis.exception.DataSourceOverSizeException) JobSubmitException(com.webank.wedatasphere.qualitis.exception.JobSubmitException) ConvertException(com.webank.wedatasphere.qualitis.exception.ConvertException) LeftNullDatasourceException(com.webank.wedatasphere.qualitis.exception.LeftNullDatasourceException) JobKillException(com.webank.wedatasphere.qualitis.exception.JobKillException) TaskTypeException(com.webank.wedatasphere.qualitis.exception.TaskTypeException) ArgumentException(com.webank.wedatasphere.qualitis.exception.ArgumentException) BothNullDatasourceException(com.webank.wedatasphere.qualitis.exception.BothNullDatasourceException) IOException(java.io.IOException) TaskNotExistException(com.webank.wedatasphere.qualitis.exception.TaskNotExistException) SemanticException(org.apache.hadoop.hive.ql.parse.SemanticException) PermissionDeniedRequestException(com.webank.wedatasphere.qualitis.exception.PermissionDeniedRequestException) ParseException(org.apache.hadoop.hive.ql.parse.ParseException) SystemConfigException(com.webank.wedatasphere.qualitis.exception.SystemConfigException) RuleVariableNotSupportException(com.webank.wedatasphere.qualitis.exception.RuleVariableNotSupportException) MetaDataAcquireFailedException(com.webank.wedatasphere.qualitis.metadata.exception.MetaDataAcquireFailedException) UnExpectedRequestException(com.webank.wedatasphere.qualitis.exception.UnExpectedRequestException) LogPartialException(com.webank.wedatasphere.qualitis.exception.LogPartialException) DataQualityTaskException(com.webank.wedatasphere.qualitis.exception.DataQualityTaskException) RuleVariableNotFoundException(com.webank.wedatasphere.qualitis.exception.RuleVariableNotFoundException) DataSourceMoveException(com.webank.wedatasphere.qualitis.exception.DataSourceMoveException) ResourceAccessException(org.springframework.web.client.ResourceAccessException) RightNullDatasourceException(com.webank.wedatasphere.qualitis.exception.RightNullDatasourceException) NoPartitionException(com.webank.wedatasphere.qualitis.exception.NoPartitionException) GeneralResponse(com.webank.wedatasphere.qualitis.response.GeneralResponse) Project(com.webank.wedatasphere.qualitis.project.entity.Project) NoPartitionException(com.webank.wedatasphere.qualitis.exception.NoPartitionException) Rule(com.webank.wedatasphere.qualitis.rule.entity.Rule) Transactional(org.springframework.transaction.annotation.Transactional)

Example 15 with PermissionDeniedRequestException

use of com.webank.wedatasphere.qualitis.exception.PermissionDeniedRequestException in project Qualitis by WeBankFinTech.

the class OuterExecutionServiceImpl method dataSourceExecution.

@Override
public GeneralResponse<?> dataSourceExecution(DataSourceExecutionRequest request) throws UnExpectedRequestException, PermissionDeniedRequestException {
    LOGGER.info("Execute application by datasource. cluster: {}, database: {}, table: {}", request.getCluster(), request.getDatabase(), request.getTable());
    // Check Arguments.
    DataSourceExecutionRequest.checkRequest(request);
    String loginUser = getLoginUser(httpServletRequest, request.getCreateUser(), request.getAsync());
    // Find all rule datasources by user.
    List<RuleDataSource> ruleDataSources = new ArrayList<>();
    ruleDataSources.addAll(ruleDataSourceDao.findDatasourcesByUser(loginUser, request.getCluster(), request.getDatabase(), request.getTable()));
    List<Rule> rules = ruleDataSources.stream().filter(r -> r.getClusterName().equals(request.getCluster()) && r.getDbName().equals(request.getDatabase()) && r.getTableName().equals(request.getTable())).map(RuleDataSource::getRule).distinct().filter(rule -> {
        if (!request.getCrossTable()) {
            return rule.getRuleDataSources().size() == 1;
        }
        return true;
    }).collect(Collectors.toList());
    if (CollectionUtils.isEmpty(rules)) {
        throw new UnExpectedRequestException("{&NO_RULE_CAN_BE_EXECUTED}");
    }
    checkPermissionCreateUserProxyExecuteUser(request.getCreateUser(), request.getExecutionUser());
    ApplicationProjectResponse applicationProjectResponse = new ApplicationProjectResponse();
    List<ApplicationSubmitRequest> applicationSubmitRequests = new ArrayList<>();
    StringBuffer partition = new StringBuffer();
    StringBuffer runDate = new StringBuffer();
    Map<String, String> execParamMap = new HashMap<>(5);
    parseExecParams(partition, runDate, request.getExecutionParam(), execParamMap);
    List<Project> projects = rules.stream().map(Rule::getProject).distinct().collect(Collectors.toList());
    for (Project projectInDb : projects) {
        // Check permissions of project
        List<Integer> permissions = new ArrayList<>();
        permissions.add(ProjectUserPermissionEnum.OPERATOR.getCode());
        projectService.checkProjectPermission(projectInDb, loginUser, permissions);
        List<Rule> currentRules = rules.stream().filter(rule -> rule.getProject().getId().equals(projectInDb.getId())).collect(Collectors.toList());
        List<RuleGroup> currentRuleGroups = currentRules.stream().map(Rule::getRuleGroup).distinct().collect(Collectors.toList());
        for (RuleGroup ruleGroup : currentRuleGroups) {
            List<Rule> currentRulesOfGroup = currentRules.stream().filter(rule -> rule.getRuleGroup().getRuleGroupName().equals(ruleGroup.getRuleGroupName())).distinct().collect(Collectors.toList());
            List<Long> currentRuleIds = currentRulesOfGroup.stream().map(Rule::getId).distinct().collect(Collectors.toList());
            LOGGER.info("Succeed to find current rules of one group with datasource. rule_id: {}", currentRuleIds);
            // Dynamic partition.
            try {
                submitRulesWithDynamicPartition(applicationSubmitRequests, projectInDb.getId(), ruleGroup.getId(), rules, currentRuleIds, request.getExecutionUser(), request.getDyNamicPartition(), request.getClusterName(), partition, request.getDyNamicPartitionPrefix());
            } catch (ResourceAccessException e) {
                // Record submit failed applicatoin.
                generateAbnormalApplicationInfo(projectInDb.getId(), ruleGroup.getId(), request.getCreateUser(), request.getExecutionUser(), new Date(), InvokeTypeEnum.BDP_CLIENT_API_INVOKE.getCode(), partition.toString(), request.getStartupParamName(), request.getExecutionParam(), e, ApplicationCommentEnum.METADATA_ISSUES.getCode(), ApplicationStatusEnum.TASK_SUBMIT_FAILED.getCode(), rules);
                LOGGER.error("One group execution[id={}] of the datasource execution start failed!", ruleGroup.getId());
            } catch (NoPartitionException e) {
                // Record submit failed applicatoin.
                generateAbnormalApplicationInfo(projectInDb.getId(), ruleGroup.getId(), request.getCreateUser(), request.getExecutionUser(), new Date(), InvokeTypeEnum.BDP_CLIENT_API_INVOKE.getCode(), partition.toString(), request.getStartupParamName(), request.getExecutionParam(), e, ApplicationCommentEnum.METADATA_ISSUES.getCode(), ApplicationStatusEnum.TASK_SUBMIT_FAILED.getCode(), rules);
                LOGGER.error("One group execution[id={}] of the datasource execution start failed!", ruleGroup.getId());
            } catch (Exception e) {
                // Record submit failed applicatoin.
                generateAbnormalApplicationInfo(projectInDb.getId(), ruleGroup.getId(), request.getCreateUser(), request.getExecutionUser(), new Date(), InvokeTypeEnum.BDP_CLIENT_API_INVOKE.getCode(), partition.toString(), request.getStartupParamName(), request.getExecutionParam(), e, ApplicationCommentEnum.UNKNOWN_ERROR_ISSUES.getCode(), ApplicationStatusEnum.TASK_SUBMIT_FAILED.getCode(), rules);
                LOGGER.error("One group execution[id={}] of the datasource execution start failed!", ruleGroup.getId());
            }
            if (CollectionUtils.isNotEmpty(currentRuleIds)) {
                applicationSubmitRequests.add(new ApplicationSubmitRequest(request.getJobId(), projectInDb.getId(), ruleGroup.getId(), currentRuleIds, partition));
            }
        }
        projectEventService.record(projectInDb.getId(), loginUser, "submit datasource execution", "rule name[" + Arrays.toString(rules.stream().filter(rule -> rule.getProject().getId().equals(projectInDb.getId())).toArray()) + "].", EventTypeEnum.SUBMIT_PROJECT.getCode());
    }
    GeneralResponse<ApplicationTaskSimpleResponse> generalResponse;
    for (ApplicationSubmitRequest applicationSubmitRequest : applicationSubmitRequests) {
        if (StringUtils.isNotBlank(request.getJobId())) {
            applicationSubmitRequest.setJobId(request.getJobId());
        }
        generalResponse = (GeneralResponse<ApplicationTaskSimpleResponse>) outerExecutionService.submitRules(applicationSubmitRequest.getRuleIds(), applicationSubmitRequest.getPartition(), loginUser, request.getExecutionUser(), DEFAULT_NODE_NAME, applicationSubmitRequest.getProjectId(), applicationSubmitRequest.getRuleGroupId(), request.getStartupParamName(), request.getClusterName(), request.getSetFlag(), execParamMap, request.getExecutionParam(), runDate, InvokeTypeEnum.BDP_CLIENT_API_INVOKE.getCode());
        applicationProjectResponse.getApplicationTaskSimpleResponses().add(generalResponse.getData());
    }
    return new GeneralResponse<>("200", "{&SUCCEED_TO_DISPATCH_TASK}", applicationProjectResponse);
}
Also used : AlarmConfigStatusEnum(com.webank.wedatasphere.qualitis.constant.AlarmConfigStatusEnum) Arrays(java.util.Arrays) StringUtils(org.apache.commons.lang.StringUtils) ClusterInfoNotConfigException(com.webank.wedatasphere.qualitis.exception.ClusterInfoNotConfigException) Autowired(org.springframework.beans.factory.annotation.Autowired) GeneralResponse(com.webank.wedatasphere.qualitis.response.GeneralResponse) AlarmConfig(com.webank.wedatasphere.qualitis.rule.entity.AlarmConfig) ApplicationTaskSimpleResponse(com.webank.wedatasphere.qualitis.response.ApplicationTaskSimpleResponse) DataSourceOverSizeException(com.webank.wedatasphere.qualitis.exception.DataSourceOverSizeException) GroupExecutionRequest(com.webank.wedatasphere.qualitis.request.GroupExecutionRequest) HttpUtils(com.webank.wedatasphere.qualitis.util.HttpUtils) Map(java.util.Map) LocaleParser(com.webank.wedatasphere.qualitis.parser.LocaleParser) JobSubmitException(com.webank.wedatasphere.qualitis.exception.JobSubmitException) ConvertException(com.webank.wedatasphere.qualitis.exception.ConvertException) MonitorManager(com.webank.wedatasphere.qualitis.job.MonitorManager) ProjectUserPermissionEnum(com.webank.wedatasphere.qualitis.project.constant.ProjectUserPermissionEnum) Set(java.util.Set) RuleConstraintEnum(com.webank.wedatasphere.qualitis.metadata.constant.RuleConstraintEnum) UserProxyUser(com.webank.wedatasphere.qualitis.entity.UserProxyUser) TableStat(com.alibaba.druid.stat.TableStat) InvokeTypeEnum(com.webank.wedatasphere.qualitis.constant.InvokeTypeEnum) LeftNullDatasourceException(com.webank.wedatasphere.qualitis.exception.LeftNullDatasourceException) MetaDataClient(com.webank.wedatasphere.qualitis.metadata.client.MetaDataClient) DbType(com.alibaba.druid.DbType) GeneralExecutionRequest(com.webank.wedatasphere.qualitis.request.GeneralExecutionRequest) Project(com.webank.wedatasphere.qualitis.project.entity.Project) TaskStatusEnum(com.webank.wedatasphere.qualitis.constant.TaskStatusEnum) JobKillException(com.webank.wedatasphere.qualitis.exception.JobKillException) RuleDataSourceDao(com.webank.wedatasphere.qualitis.rule.dao.RuleDataSourceDao) Rule(com.webank.wedatasphere.qualitis.rule.entity.Rule) ProjectDao(com.webank.wedatasphere.qualitis.project.dao.ProjectDao) ApplicationTaskResponse(com.webank.wedatasphere.qualitis.response.ApplicationTaskResponse) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) HttpServletRequest(javax.servlet.http.HttpServletRequest) RuleListExecutionRequest(com.webank.wedatasphere.qualitis.request.RuleListExecutionRequest) TaskDao(com.webank.wedatasphere.qualitis.dao.TaskDao) ApplicationResultResponse(com.webank.wedatasphere.qualitis.response.ApplicationResultResponse) Service(org.springframework.stereotype.Service) TaskTypeException(com.webank.wedatasphere.qualitis.exception.TaskTypeException) TaskResult(com.webank.wedatasphere.qualitis.entity.TaskResult) ArgumentException(com.webank.wedatasphere.qualitis.exception.ArgumentException) GetTaskLogRequest(com.webank.wedatasphere.qualitis.request.GetTaskLogRequest) CsTableInfoDetail(com.webank.wedatasphere.qualitis.metadata.response.table.CsTableInfoDetail) MySqlSchemaStatVisitor(com.alibaba.druid.sql.dialect.mysql.visitor.MySqlSchemaStatVisitor) SystemConfigDao(com.webank.wedatasphere.qualitis.dao.SystemConfigDao) ExceptionUtils(org.apache.commons.lang.exception.ExceptionUtils) TaskRuleSimpleRepository(com.webank.wedatasphere.qualitis.dao.repository.TaskRuleSimpleRepository) BothNullDatasourceException(com.webank.wedatasphere.qualitis.exception.BothNullDatasourceException) IOException(java.io.IOException) TaskRuleSimple(com.webank.wedatasphere.qualitis.entity.TaskRuleSimple) DataInfo(com.webank.wedatasphere.qualitis.metadata.response.DataInfo) SystemKeyConfig(com.webank.wedatasphere.qualitis.config.SystemKeyConfig) SQLStatement(com.alibaba.druid.sql.ast.SQLStatement) UserDao(com.webank.wedatasphere.qualitis.dao.UserDao) UnitTransfer(com.webank.wedatasphere.qualitis.rule.util.UnitTransfer) LogResult(com.webank.wedatasphere.qualitis.bean.LogResult) TaskDataSource(com.webank.wedatasphere.qualitis.entity.TaskDataSource) Date(java.util.Date) LinkisConfig(com.webank.wedatasphere.qualitis.config.LinkisConfig) LoggerFactory(org.slf4j.LoggerFactory) GetUserColumnByCsRequest(com.webank.wedatasphere.qualitis.metadata.request.GetUserColumnByCsRequest) Application(com.webank.wedatasphere.qualitis.entity.Application) TaskNotExistException(com.webank.wedatasphere.qualitis.exception.TaskNotExistException) SemanticException(org.apache.hadoop.hive.ql.parse.SemanticException) ProjectUserDao(com.webank.wedatasphere.qualitis.project.dao.ProjectUserDao) DataSourceExecutionRequest(com.webank.wedatasphere.qualitis.request.DataSourceExecutionRequest) PermissionDeniedRequestException(com.webank.wedatasphere.qualitis.exception.PermissionDeniedRequestException) ApplicationCommentEnum(com.webank.wedatasphere.qualitis.constant.ApplicationCommentEnum) EventTypeEnum(com.webank.wedatasphere.qualitis.project.constant.EventTypeEnum) RuleDataSource(com.webank.wedatasphere.qualitis.rule.entity.RuleDataSource) DateExprReplaceUtil(com.webank.wedatasphere.qualitis.util.DateExprReplaceUtil) ClusterInfoDao(com.webank.wedatasphere.qualitis.dao.ClusterInfoDao) ParseException(org.apache.hadoop.hive.ql.parse.ParseException) Task(com.webank.wedatasphere.qualitis.entity.Task) OuterExecutionService(com.webank.wedatasphere.qualitis.service.OuterExecutionService) RuleGroupDao(com.webank.wedatasphere.qualitis.rule.dao.RuleGroupDao) TaskRuleAlarmConfig(com.webank.wedatasphere.qualitis.entity.TaskRuleAlarmConfig) SystemConfigException(com.webank.wedatasphere.qualitis.exception.SystemConfigException) ProjectService(com.webank.wedatasphere.qualitis.project.service.ProjectService) RuleVariableNotSupportException(com.webank.wedatasphere.qualitis.exception.RuleVariableNotSupportException) ProjectEventService(com.webank.wedatasphere.qualitis.project.service.ProjectEventService) ExecutionManager(com.webank.wedatasphere.qualitis.submitter.ExecutionManager) PartitionStatisticsInfo(com.webank.wedatasphere.qualitis.metadata.response.table.PartitionStatisticsInfo) Context(javax.ws.rs.core.Context) UuidGenerator(com.webank.wedatasphere.qualitis.util.UuidGenerator) Collectors(java.util.stream.Collectors) RuleDataSourceMapping(com.webank.wedatasphere.qualitis.rule.entity.RuleDataSourceMapping) MetaDataAcquireFailedException(com.webank.wedatasphere.qualitis.metadata.exception.MetaDataAcquireFailedException) ApplicationProjectResponse(com.webank.wedatasphere.qualitis.response.ApplicationProjectResponse) ExecutionManagerImpl(com.webank.wedatasphere.qualitis.submitter.impl.ExecutionManagerImpl) List(java.util.List) ClusterInfo(com.webank.wedatasphere.qualitis.entity.ClusterInfo) JdbcConstants(com.alibaba.druid.util.JdbcConstants) ApplicationSubmitRequest(com.webank.wedatasphere.qualitis.request.ApplicationSubmitRequest) SystemConfig(com.webank.wedatasphere.qualitis.entity.SystemConfig) UnExpectedRequestException(com.webank.wedatasphere.qualitis.exception.UnExpectedRequestException) LogPartialException(com.webank.wedatasphere.qualitis.exception.LogPartialException) BeanUtils(org.springframework.beans.BeanUtils) RuleGroup(com.webank.wedatasphere.qualitis.rule.entity.RuleGroup) SpecCharEnum(com.webank.wedatasphere.qualitis.constant.SpecCharEnum) HashMap(java.util.HashMap) HashSet(java.util.HashSet) User(com.webank.wedatasphere.qualitis.entity.User) CollectionUtils(org.apache.commons.collections.CollectionUtils) Propagation(org.springframework.transaction.annotation.Propagation) Name(com.alibaba.druid.stat.TableStat.Name) TaskSubmitResult(com.webank.wedatasphere.qualitis.bean.TaskSubmitResult) DataQualityTaskException(com.webank.wedatasphere.qualitis.exception.DataQualityTaskException) ApplicationStatusEnum(com.webank.wedatasphere.qualitis.constant.ApplicationStatusEnum) TaskDataSourceRepository(com.webank.wedatasphere.qualitis.dao.repository.TaskDataSourceRepository) GetUserTableByCsIdRequest(com.webank.wedatasphere.qualitis.metadata.request.GetUserTableByCsIdRequest) RuleVariableNotFoundException(com.webank.wedatasphere.qualitis.exception.RuleVariableNotFoundException) DataSourceMoveException(com.webank.wedatasphere.qualitis.exception.DataSourceMoveException) SQLUtils(com.alibaba.druid.sql.SQLUtils) Logger(org.slf4j.Logger) Iterator(java.util.Iterator) RuleMetric(com.webank.wedatasphere.qualitis.entity.RuleMetric) ResourceAccessException(org.springframework.web.client.ResourceAccessException) ColumnInfoDetail(com.webank.wedatasphere.qualitis.metadata.response.column.ColumnInfoDetail) FastDateFormat(org.apache.commons.lang3.time.FastDateFormat) TableStatisticsInfo(com.webank.wedatasphere.qualitis.metadata.response.table.TableStatisticsInfo) RuleTypeEnum(com.webank.wedatasphere.qualitis.rule.constant.RuleTypeEnum) ProjectExecutionRequest(com.webank.wedatasphere.qualitis.request.ProjectExecutionRequest) RightNullDatasourceException(com.webank.wedatasphere.qualitis.exception.RightNullDatasourceException) RuleDao(com.webank.wedatasphere.qualitis.rule.dao.RuleDao) ApplicationDao(com.webank.wedatasphere.qualitis.dao.ApplicationDao) NoPartitionException(com.webank.wedatasphere.qualitis.exception.NoPartitionException) TaskResultDao(com.webank.wedatasphere.qualitis.dao.TaskResultDao) HiveSqlParser(com.webank.wedatasphere.qualitis.parser.HiveSqlParser) Transactional(org.springframework.transaction.annotation.Transactional) ApplicationSubmitRequest(com.webank.wedatasphere.qualitis.request.ApplicationSubmitRequest) LinkedHashMap(java.util.LinkedHashMap) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) UnExpectedRequestException(com.webank.wedatasphere.qualitis.exception.UnExpectedRequestException) RuleDataSource(com.webank.wedatasphere.qualitis.rule.entity.RuleDataSource) ApplicationTaskSimpleResponse(com.webank.wedatasphere.qualitis.response.ApplicationTaskSimpleResponse) ApplicationProjectResponse(com.webank.wedatasphere.qualitis.response.ApplicationProjectResponse) RuleGroup(com.webank.wedatasphere.qualitis.rule.entity.RuleGroup) ResourceAccessException(org.springframework.web.client.ResourceAccessException) Date(java.util.Date) ClusterInfoNotConfigException(com.webank.wedatasphere.qualitis.exception.ClusterInfoNotConfigException) DataSourceOverSizeException(com.webank.wedatasphere.qualitis.exception.DataSourceOverSizeException) JobSubmitException(com.webank.wedatasphere.qualitis.exception.JobSubmitException) ConvertException(com.webank.wedatasphere.qualitis.exception.ConvertException) LeftNullDatasourceException(com.webank.wedatasphere.qualitis.exception.LeftNullDatasourceException) JobKillException(com.webank.wedatasphere.qualitis.exception.JobKillException) TaskTypeException(com.webank.wedatasphere.qualitis.exception.TaskTypeException) ArgumentException(com.webank.wedatasphere.qualitis.exception.ArgumentException) BothNullDatasourceException(com.webank.wedatasphere.qualitis.exception.BothNullDatasourceException) IOException(java.io.IOException) TaskNotExistException(com.webank.wedatasphere.qualitis.exception.TaskNotExistException) SemanticException(org.apache.hadoop.hive.ql.parse.SemanticException) PermissionDeniedRequestException(com.webank.wedatasphere.qualitis.exception.PermissionDeniedRequestException) ParseException(org.apache.hadoop.hive.ql.parse.ParseException) SystemConfigException(com.webank.wedatasphere.qualitis.exception.SystemConfigException) RuleVariableNotSupportException(com.webank.wedatasphere.qualitis.exception.RuleVariableNotSupportException) MetaDataAcquireFailedException(com.webank.wedatasphere.qualitis.metadata.exception.MetaDataAcquireFailedException) UnExpectedRequestException(com.webank.wedatasphere.qualitis.exception.UnExpectedRequestException) LogPartialException(com.webank.wedatasphere.qualitis.exception.LogPartialException) DataQualityTaskException(com.webank.wedatasphere.qualitis.exception.DataQualityTaskException) RuleVariableNotFoundException(com.webank.wedatasphere.qualitis.exception.RuleVariableNotFoundException) DataSourceMoveException(com.webank.wedatasphere.qualitis.exception.DataSourceMoveException) ResourceAccessException(org.springframework.web.client.ResourceAccessException) RightNullDatasourceException(com.webank.wedatasphere.qualitis.exception.RightNullDatasourceException) NoPartitionException(com.webank.wedatasphere.qualitis.exception.NoPartitionException) GeneralResponse(com.webank.wedatasphere.qualitis.response.GeneralResponse) Project(com.webank.wedatasphere.qualitis.project.entity.Project) NoPartitionException(com.webank.wedatasphere.qualitis.exception.NoPartitionException) Rule(com.webank.wedatasphere.qualitis.rule.entity.Rule)

Aggregations

PermissionDeniedRequestException (com.webank.wedatasphere.qualitis.exception.PermissionDeniedRequestException)17 UnExpectedRequestException (com.webank.wedatasphere.qualitis.exception.UnExpectedRequestException)15 User (com.webank.wedatasphere.qualitis.entity.User)14 GeneralResponse (com.webank.wedatasphere.qualitis.response.GeneralResponse)14 ArrayList (java.util.ArrayList)13 Transactional (org.springframework.transaction.annotation.Transactional)11 Project (com.webank.wedatasphere.qualitis.project.entity.Project)10 RuleMetric (com.webank.wedatasphere.qualitis.entity.RuleMetric)9 List (java.util.List)9 UserRole (com.webank.wedatasphere.qualitis.entity.UserRole)8 IOException (java.io.IOException)7 Date (java.util.Date)7 Rule (com.webank.wedatasphere.qualitis.rule.entity.Rule)6 UserDao (com.webank.wedatasphere.qualitis.dao.UserDao)5 ClusterInfoNotConfigException (com.webank.wedatasphere.qualitis.exception.ClusterInfoNotConfigException)5 TaskNotExistException (com.webank.wedatasphere.qualitis.exception.TaskNotExistException)5 MetaDataAcquireFailedException (com.webank.wedatasphere.qualitis.metadata.exception.MetaDataAcquireFailedException)5 Department (com.webank.wedatasphere.qualitis.entity.Department)4 RuleMetricDepartmentUser (com.webank.wedatasphere.qualitis.entity.RuleMetricDepartmentUser)4 ArgumentException (com.webank.wedatasphere.qualitis.exception.ArgumentException)4