private ValidationErrors validateConflicts()

in src/main/java/com/epam/digital/data/platform/liquibase/extension/change/core/DdmRbacChange.java [53:84]


    private ValidationErrors validateConflicts() {
        ValidationErrors validationErrors = new ValidationErrors();

        List<DdmPair> rolesTables = new ArrayList<>();
        for (DdmRoleConfig role : getRoles()) {
            for (DdmTableConfig table : role.getTables()) {
                DdmPair roleTable = new DdmPair(role.getName(), table.getName());

                if (rolesTables.contains(roleTable)) {
                    validationErrors.addError("There are doubled values: role=" + role.getName() +
                        ", table=" + table.getName());
                } else {
                    rolesTables.add(roleTable);
                }

                for (DdmColumnConfig column : table.getColumns()) {
                    if (table.getRoleCanRead() != null && column.getRoleCanRead() != null) {
                        validationErrors.addError("Values for read are ambiguous: role=" + role.getName() +
                            ", table=" + table.getName() +
                            ", column=" + column.getName());
                    }

                    if (table.getRoleCanUpdate() != null && column.getRoleCanUpdate() != null) {
                        validationErrors.addError("Values for update are ambiguous: role - " + role.getName() +
                            ", table - " + table.getName() +
                            ", column - " + column.getName());
                    }
                }
            }
        }
        return validationErrors;
    }