use of uk.gov.gchq.gaffer.commonutil.elementvisibilityutil.ElementVisibility in project Gaffer by gchq.
the class RetrieveElementsFromFile method isVisible.
private Boolean isVisible(final Element e) throws VisibilityParseException {
if (e.getProperty(visibility) != null) {
final VisibilityEvaluator visibilityEvaluator = new VisibilityEvaluator(auths);
final ElementVisibility elementVisibility = new ElementVisibility((String) e.getProperty(visibility));
return visibilityEvaluator.evaluate(elementVisibility);
} else {
e.putProperty(visibility, new String());
return true;
}
}
use of uk.gov.gchq.gaffer.commonutil.elementvisibilityutil.ElementVisibility 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