private void addPropertyMetadataToKeyValuePairs(List<KeyValuePair> results, Text vertexRowKey, Property property) { Metadata metadata = property.getMetadata(); for (Metadata.Entry metadataItem : metadata.entrySet()) { addPropertyMetadataItemToKeyValuePairs(results, vertexRowKey, property, metadataItem); } }
private void addPropertyMetadataToKeyValuePairs(List<KeyValuePair> results, Text vertexRowKey, Property property) { Metadata metadata = property.getMetadata(); for (Metadata.Entry metadataItem : metadata.entrySet()) { addPropertyMetadataItemToKeyValuePairs(results, vertexRowKey, property, metadataItem); } }
public static JSONObject toJsonProperty(Property property) { checkNotNull(property, "property cannot be null"); JSONObject result = new JSONObject(); result.put("key", property.getKey()); result.put("name", property.getName()); Object propertyValue = property.getValue(); if (propertyValue instanceof StreamingPropertyValue) { result.put("streamingPropertyValue", true); } else { result.put("value", toJsonValue(propertyValue)); } for (Metadata.Entry metadataEntry : property.getMetadata().entrySet()) { result.put(metadataEntry.getKey(), toJsonValue(metadataEntry.getValue())); } return result; }
private boolean isIncludedByAuthorizations(Element element, EnumSet<ElementFilter> filters, String authorizationToMatch) { if (filters.contains(ElementFilter.PROPERTY) || filters.contains(ElementFilter.PROPERTY_METADATA)) { for (Property property : element.getProperties()) { if (filters.contains(ElementFilter.PROPERTY)) { if (property.getVisibility().hasAuthorization(authorizationToMatch)) { return true; } } if (filters.contains(ElementFilter.PROPERTY_METADATA)) { for (Metadata.Entry entry : property.getMetadata().entrySet()) { if (entry.getVisibility().hasAuthorization(authorizationToMatch)) { return true; } } } } } return false; }
private boolean isIncludedByAuthorizations(Element element, EnumSet<ElementFilter> filters, String authorizationToMatch) { if (filters.contains(ElementFilter.PROPERTY) || filters.contains(ElementFilter.PROPERTY_METADATA)) { for (Property property : element.getProperties()) { if (filters.contains(ElementFilter.PROPERTY)) { if (property.getVisibility().hasAuthorization(authorizationToMatch)) { return true; } } if (filters.contains(ElementFilter.PROPERTY_METADATA)) { for (Metadata.Entry entry : property.getMetadata().entrySet()) { if (entry.getVisibility().hasAuthorization(authorizationToMatch)) { return true; } } } } } return false; }
public MapMetadata(Metadata copyFromMetadata, FetchHints fetchHints) { this(fetchHints); if (copyFromMetadata != null) { for (Metadata.Entry entry : copyFromMetadata.entrySet()) { add(entry.getKey(), entry.getValue(), entry.getVisibility()); } } }
public MapMetadata(Metadata copyFromMetadata, FetchHints fetchHints) { this(fetchHints); if (copyFromMetadata != null) { for (Metadata.Entry entry : copyFromMetadata.entrySet()) { add(entry.getKey(), entry.getValue(), entry.getVisibility()); } } }
@Override protected void updateMetadata(Property property) { Collection<Metadata.Entry> entries = new ArrayList<>(property.getMetadata().entrySet()); this.metadata.clear(); for (Metadata.Entry metadataEntry : entries) { this.metadata.add(metadataEntry.getKey(), metadataEntry.getValue(), metadataEntry.getVisibility()); } } }
@Override protected void updateMetadata(Property property) { Collection<Metadata.Entry> entries = new ArrayList<>(property.getMetadata().entrySet()); this.metadata.clear(); for (Metadata.Entry metadataEntry : entries) { this.metadata.add(metadataEntry.getKey(), metadataEntry.getValue(), metadataEntry.getVisibility()); } } }
public void addPropertyMetadataToMutation(Mutation m, Property property) { Metadata metadata = property.getMetadata(); for (Metadata.Entry metadataItem : metadata.entrySet()) { addPropertyMetadataItemToMutation( m, property, metadataItem.getKey(), metadataItem.getValue(), metadataItem.getVisibility() ); } }
public void addPropertyMetadataToMutation(Mutation m, Property property) { Metadata metadata = property.getMetadata(); for (Metadata.Entry metadataItem : metadata.entrySet()) { addPropertyMetadataItemToMutation( m, property, metadataItem.getKey(), metadataItem.getValue(), metadataItem.getVisibility() ); } }
public static Metadata mergeMetadata(Metadata... metadatas) { Metadata mergedMetadata = new Metadata(); for (Metadata metadata : metadatas) { for (Metadata.Entry entry : metadata.entrySet()) { mergedMetadata.add(entry.getKey(), entry.getValue(), entry.getVisibility()); } } return mergedMetadata; } }
@Override protected void updateMetadata(Property property) { this.cachedMetadata = null; if (property instanceof LazyMutableProperty) { this.metadataRef = ((LazyMutableProperty) property).metadataRef; } else { Collection<Metadata.Entry> entries = new ArrayList<>(property.getMetadata().entrySet()); this.metadataRef = null; if (getFetchHints().isIncludePropertyAndMetadata(propertyName)) { for (Metadata.Entry metadataEntry : entries) { getMetadata().add(metadataEntry.getKey(), metadataEntry.getValue(), metadataEntry.getVisibility()); } } } }
@Override protected void updateMetadata(Property property) { this.cachedMetadata = null; if (property instanceof LazyMutableProperty) { this.metadataRef = ((LazyMutableProperty) property).metadataRef; } else { Collection<Metadata.Entry> entries = new ArrayList<>(property.getMetadata().entrySet()); this.metadataRef = null; if (getFetchHints().isIncludePropertyAndMetadata(propertyName)) { for (Metadata.Entry metadataEntry : entries) { getMetadata().add(metadataEntry.getKey(), metadataEntry.getValue(), metadataEntry.getVisibility()); } } } }
public void addPropertyDeleteMetadataToMutation(Mutation m, PropertyDeleteMutation propertyDeleteMutation) { if (propertyDeleteMutation instanceof PropertyPropertyDeleteMutation) { Property property = ((PropertyPropertyDeleteMutation) propertyDeleteMutation).getProperty(); Metadata metadata = property.getMetadata(); for (Metadata.Entry metadataItem : metadata.entrySet()) { Text columnQualifier = getPropertyMetadataColumnQualifierText(property, metadataItem.getKey()); ColumnVisibility metadataVisibility = visibilityToAccumuloVisibility(metadataItem.getVisibility()); addPropertyMetadataItemDeleteToMutation(m, columnQualifier, metadataVisibility); } } }
public void addPropertyDeleteMetadataToMutation(Mutation m, PropertyDeleteMutation propertyDeleteMutation) { if (propertyDeleteMutation instanceof PropertyPropertyDeleteMutation) { Property property = ((PropertyPropertyDeleteMutation) propertyDeleteMutation).getProperty(); Metadata metadata = property.getMetadata(); for (Metadata.Entry metadataItem : metadata.entrySet()) { Text columnQualifier = getPropertyMetadataColumnQualifierText(property, metadataItem.getKey()); ColumnVisibility metadataVisibility = visibilityToAccumuloVisibility(metadataItem.getVisibility()); addPropertyMetadataItemDeleteToMutation(m, columnQualifier, metadataVisibility); } } }
public static ClientApiProperty toClientApiProperty(Property property) { ClientApiProperty clientApiProperty = new ClientApiProperty(); clientApiProperty.setKey(property.getKey()); clientApiProperty.setName(property.getName()); Object propertyValue = property.getValue(); if (propertyValue instanceof StreamingPropertyValue) { clientApiProperty.setStreamingPropertyValue(true); } else { clientApiProperty.setValue(toClientApiValue(propertyValue)); } for (Metadata.Entry entry : property.getMetadata().entrySet()) { clientApiProperty.getMetadata().put(entry.getKey(), toClientApiValue(entry.getValue())); } return clientApiProperty; }
private void writePropertyRdfTriples(Element element, Property property, OutputStream out) throws IOException { SetPropertyVisalloRdfTriple setPropertyVisalloRdfTriple = new SetPropertyVisalloRdfTriple( element instanceof Vertex ? ElementType.VERTEX : ElementType.EDGE, element.getId(), getVisibilitySource(element), property.getKey(), property.getName(), getVisibilitySource(property), property.getValue()); write(setPropertyVisalloRdfTriple, out); if (setPropertyVisalloRdfTriple.getValueRdfString() != null) { for (Metadata.Entry entry : property.getMetadata().entrySet()) { writeMetadataEntryRdfTriple(element, property, entry, out); } } }
public void addPropertyDeleteToMutation(Mutation m, Property property) { Preconditions.checkNotNull(m, "mutation cannot be null"); Preconditions.checkNotNull(property, "property cannot be null"); Text columnQualifier = KeyHelper.getColumnQualifierFromPropertyColumnQualifier(property, getNameSubstitutionStrategy()); ColumnVisibility columnVisibility = visibilityToAccumuloVisibility(property.getVisibility()); m.putDelete(AccumuloElement.CF_PROPERTY, columnQualifier, columnVisibility, currentTimeMillis()); for (Metadata.Entry metadataEntry : property.getMetadata().entrySet()) { Text metadataEntryColumnQualifier = getPropertyMetadataColumnQualifierText(property, metadataEntry.getKey()); ColumnVisibility metadataEntryVisibility = visibilityToAccumuloVisibility(metadataEntry.getVisibility()); addPropertyMetadataItemDeleteToMutation(m, metadataEntryColumnQualifier, metadataEntryVisibility); } }
public void addPropertyDeleteToMutation(Mutation m, Property property) { Preconditions.checkNotNull(m, "mutation cannot be null"); Preconditions.checkNotNull(property, "property cannot be null"); Text columnQualifier = KeyHelper.getColumnQualifierFromPropertyColumnQualifier(property, getNameSubstitutionStrategy()); ColumnVisibility columnVisibility = visibilityToAccumuloVisibility(property.getVisibility()); m.putDelete(AccumuloElement.CF_PROPERTY, columnQualifier, columnVisibility, currentTimeMillis()); for (Metadata.Entry metadataEntry : property.getMetadata().entrySet()) { Text metadataEntryColumnQualifier = getPropertyMetadataColumnQualifierText(property, metadataEntry.getKey()); ColumnVisibility metadataEntryVisibility = visibilityToAccumuloVisibility(metadataEntry.getVisibility()); addPropertyMetadataItemDeleteToMutation(m, metadataEntryColumnQualifier, metadataEntryVisibility); } }