protected void processConstraint(QueryTransformer transformer, ConstraintData constraint, String entityName) {
String join = constraint.getJoin();
String where = constraint.getWhereClause();
try {
if (StringUtils.isBlank(join)) {
if (!StringUtils.isBlank(where)) {
transformer.addWhere(where);
}
} else {
transformer.addJoinAndWhere(join, where);
}
} catch (JpqlSyntaxException e) {
log.error("Syntax errors found in constraint's JPQL expressions. Entity [{}]. Constraint ID [{}].",
entityName, constraint.getId(), e);
throw new RowLevelSecurityException(
"Syntax errors found in constraint's JPQL expressions. Please see the logs.", entityName);
} catch (Exception e) {
log.error("An error occurred when applying security constraint. Entity [{}]. Constraint ID [{}].",
entityName, constraint.getId(), e);
throw new RowLevelSecurityException(
"An error occurred when applying security constraint. Please see the logs.", entityName);
}
}