use of io.vertigo.account.authorization.metamodel.rulemodel.RuleMultiExpression in project vertigo by KleeGroup.
the class CriteriaSecurityRuleTranslator method toCriteria.
private Criteria<E> toCriteria(final RuleMultiExpression multiExpression) {
if (multiExpression.isAlwaysTrue()) {
return Criterions.alwaysTrue();
}
Criteria<E> mainCriteria = null;
for (final RuleExpression expression : multiExpression.getExpressions()) {
if (multiExpression.getBoolOperator() == BoolOperator.AND) {
mainCriteria = andCriteria(mainCriteria, toCriteria(expression));
} else {
mainCriteria = orCriteria(mainCriteria, toCriteria(expression));
}
}
for (final RuleMultiExpression expression : multiExpression.getMultiExpressions()) {
if (multiExpression.getBoolOperator() == BoolOperator.AND) {
mainCriteria = andCriteria(mainCriteria, toCriteria(expression));
} else {
mainCriteria = orCriteria(mainCriteria, toCriteria(expression));
}
}
// can be null ?
Assertion.checkNotNull(mainCriteria);
return mainCriteria;
}
use of io.vertigo.account.authorization.metamodel.rulemodel.RuleMultiExpression in project vertigo by KleeGroup.
the class CriteriaSecurityRuleTranslator method toCriteria.
/**
* @return This security rule as search Query
*/
public Criteria<E> toCriteria() {
Criteria<E> mainCriteria = null;
for (final RuleMultiExpression expression : getMultiExpressions()) {
mainCriteria = orCriteria(mainCriteria, toCriteria(expression));
}
// can't be null
Assertion.checkNotNull(mainCriteria);
return mainCriteria;
}
use of io.vertigo.account.authorization.metamodel.rulemodel.RuleMultiExpression in project vertigo by KleeGroup.
the class SearchSecurityRuleTranslator method buildQueryString.
private String buildQueryString() {
final StringBuilder query = new StringBuilder();
String sep = "";
for (final RuleMultiExpression multiExpressionDefinition : getMultiExpressions()) {
// On ajoute cette parenthèse car le premier niveau de multiExpression est en OR
query.append(sep).append('(');
appendMultiExpression(query, multiExpressionDefinition);
query.append(')');
sep = DEFAULT_BOOL_SEP;
}
return query.toString().replaceAll("^\\s+", // replace whitespaces at beginning of a line
"").replaceAll("\\s+$", // replace whitespaces at end of a line
"").replaceAll("\\s+", // replace multiple whitespaces by space
" ").replaceAll("^\\(\\)$", // replace empty query to all
"(*:*)");
}
use of io.vertigo.account.authorization.metamodel.rulemodel.RuleMultiExpression in project vertigo by KleeGroup.
the class SqlSecurityRuleTranslator method buildQueryString.
private String buildQueryString() {
final StringBuilder query = new StringBuilder();
String sep = "";
for (final RuleMultiExpression multiExpressionDefinition : getMultiExpressions()) {
query.append(sep);
appendMultiExpression(query, multiExpressionDefinition);
sep = DEFAULT_BOOL_SEP;
}
return query.toString().replaceAll("^\\s+", // replace whitespaces at beginning of a line
"").replaceAll("\\s+$", // replace whitespaces at end of a line
"").replaceAll("\\s+", // replace multiple whitespaces by space
" ");
}
Aggregations