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; }
public String getHistory() { Element e = getE(); if (e == null) { return null; } Iterable<HistoricalPropertyValue> historicalValues = e.getHistoricalPropertyValues(getKey(), getName(), getVisibility(), getAuthorizations()); StringWriter out = new StringWriter(); PrintWriter writer = new PrintWriter(out); writer.println("@|bold history:|@"); for (HistoricalPropertyValue historicalValue : historicalValues) { writer.println(" @|bold " + VertexiumScript.timestampToString(historicalValue.getTimestamp()) + ":|@"); writer.println(" @|bold value:|@" + VertexiumScript.valueToString(historicalValue.getValue(), true)); writer.println(" @|bold metadata:|@"); for (Metadata.Entry m : historicalValue.getMetadata().entrySet()) { writer.println(" " + m.getKey() + "[" + m.getVisibility() + "]: " + VertexiumScript.valueToString(m.getValue(), false)); } } return out.toString(); }
@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()); } } }
private static void addVideoFramePropertyToResults( List<ClientApiProperty> clientApiProperties, String propertyKey, Metadata metadata, SandboxStatus sandboxStatus ) { ClientApiProperty clientApiProperty = findProperty( clientApiProperties, MediaVisalloProperties.VIDEO_TRANSCRIPT.getPropertyName(), propertyKey ); if (clientApiProperty == null) { clientApiProperty = new ClientApiProperty(); clientApiProperty.setKey(propertyKey); clientApiProperty.setName(MediaVisalloProperties.VIDEO_TRANSCRIPT.getPropertyName()); clientApiProperty.setSandboxStatus(sandboxStatus); for (Metadata.Entry entry : metadata.entrySet()) { clientApiProperty.getMetadata().put(entry.getKey(), toClientApiValue(entry.getValue())); } clientApiProperty.setStreamingPropertyValue(true); clientApiProperties.add(clientApiProperty); } }
@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 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; }
@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) { 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 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); } }
private void addPropertyMetadataItemToKeyValuePairs(List<KeyValuePair> results, Text vertexRowKey, Property property, Metadata.Entry metadataItem) { Text columnQualifier = getPropertyMetadataColumnQualifierText(property, metadataItem.getKey()); ColumnVisibility metadataVisibility = visibilityToAccumuloVisibility(metadataItem.getVisibility()); if (metadataItem.getValue() == null) { throw new VertexiumException("Property metadata deletes are not supported"); } else { addPropertyMetadataItemAddToKeyValuePairs(results, vertexRowKey, columnQualifier, metadataVisibility, property.getTimestamp(), metadataItem.getValue()); } }
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 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; } }
private void writeMetadataEntryRdfTriple(Element element, Property property, Metadata.Entry entry, OutputStream out) throws IOException { write(new SetMetadataVisalloRdfTriple( element instanceof Vertex ? ElementType.VERTEX : ElementType.EDGE, element.getId(), getVisibilitySource(element), property.getKey(), property.getName(), getVisibilitySource(property), entry.getKey(), entry.getVisibility().toString(), entry.getValue() ), out); }
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() ); } }
private void addPropertyMetadataItemToKeyValuePairs(List<KeyValuePair> results, Text vertexRowKey, Property property, Metadata.Entry metadataItem) { Text columnQualifier = getPropertyMetadataColumnQualifierText(property, metadataItem.getKey()); ColumnVisibility metadataVisibility = visibilityToAccumuloVisibility(metadataItem.getVisibility()); if (metadataItem.getValue() == null) { throw new VertexiumException("Property metadata deletes are not supported"); } else { addPropertyMetadataItemAddToKeyValuePairs(results, vertexRowKey, columnQualifier, metadataVisibility, property.getTimestamp(), metadataItem.getValue()); } }
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 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 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 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 MapMetadata(Metadata copyFromMetadata, FetchHints fetchHints) { this(fetchHints); if (copyFromMetadata != null) { for (Metadata.Entry entry : copyFromMetadata.entrySet()) { add(entry.getKey(), entry.getValue(), entry.getVisibility()); } } }