use of uk.gov.gchq.gaffer.commonutil.elementvisibilityutil.exception.VisibilityParseException in project Gaffer by gchq.
the class GetElementsUtil method isVisible.
private static boolean isVisible(final Element e, final String visibilityProperty, final Authorisations authorisations) {
if (e.getProperty(visibilityProperty) != null) {
final VisibilityEvaluator visibilityEvaluator = new VisibilityEvaluator(authorisations);
final ElementVisibility elementVisibility = new ElementVisibility((String) e.getProperty(visibilityProperty));
try {
return visibilityEvaluator.evaluate(elementVisibility);
} catch (final VisibilityParseException visibilityParseException) {
LOGGER.warn("Unable to parse element visibility: {}. Received exception: {}", elementVisibility, visibilityParseException.getMessage());
return false;
}
} else {
e.putProperty(visibilityProperty, new String());
return true;
}
}
Aggregations