Search in sources :

Example 1 with GraphMetadataEntry

use of org.vertexium.GraphMetadataEntry in project vertexium by visallo.

the class MetadataTablePropertyNameVisibilitiesStore method getHashes.

public Collection<String> getHashes(Graph graph, String propertyName, Authorizations authorizations) {
    List<String> results = new ArrayList<>();
    String prefix = getPropertyNameVisibilityToHashPrefix(propertyName);
    for (GraphMetadataEntry metadata : graph.getMetadataWithPrefix(prefix)) {
        String visibilityString = metadata.getKey().substring(prefix.length());
        Visibility visibility = getVisibility(visibilityString);
        if (authorizations.canRead(visibility)) {
            String hash = (String) metadata.getValue();
            results.add(hash);
        }
    }
    return results;
}
Also used : GraphMetadataEntry(org.vertexium.GraphMetadataEntry) Visibility(org.vertexium.Visibility)

Example 2 with GraphMetadataEntry

use of org.vertexium.GraphMetadataEntry in project vertexium by visallo.

the class MetadataTablePropertyNameVisibilitiesStore method getHashesWithAuthorization.

public Collection<String> getHashesWithAuthorization(Graph graph, String authorization, Authorizations authorizations) {
    List<String> hashes = new ArrayList<>();
    for (GraphMetadataEntry metadata : graph.getMetadataWithPrefix(HASH_TO_VISIBILITY)) {
        Visibility visibility = getVisibility((String) metadata.getValue());
        if (authorizations.canRead(visibility) && visibility.hasAuthorization(authorization)) {
            String hash = metadata.getKey().substring(HASH_TO_VISIBILITY.length());
            hashes.add(hash);
        }
    }
    return hashes;
}
Also used : GraphMetadataEntry(org.vertexium.GraphMetadataEntry) Visibility(org.vertexium.Visibility)

Aggregations

GraphMetadataEntry (org.vertexium.GraphMetadataEntry)2 Visibility (org.vertexium.Visibility)2