Ejemplo n.º 1
0
 private void addPropertyMetadataItemToMutation(
     Mutation m, Property property, Metadata.Entry metadataItem) {
   Text columnQualifier = getPropertyMetadataColumnQualifierText(property, metadataItem);
   ColumnVisibility metadataVisibility =
       visibilityToAccumuloVisibility(metadataItem.getVisibility());
   if (metadataItem.getValue() == null) {
     addPropertyMetadataItemDeleteToMutation(m, columnQualifier, metadataVisibility);
   } else {
     addPropertyMetadataItemAddToMutation(
         m, columnQualifier, metadataVisibility, property.getTimestamp(), metadataItem.getValue());
   }
 }
Ejemplo n.º 2
0
 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);
       ColumnVisibility metadataVisibility =
           visibilityToAccumuloVisibility(metadataItem.getVisibility());
       addPropertyMetadataItemDeleteToMutation(m, columnQualifier, metadataVisibility);
     }
   }
 }
Ejemplo n.º 3
0
 private Text getPropertyMetadataColumnQualifierText(
     Property property, Metadata.Entry metadataItem) {
   final String propertyName = property.getName();
   final String propertyKey = property.getKey();
   final String visibilityString = property.getVisibility().getVisibilityString();
   final String metadataKey = metadataItem.getKey();
   //noinspection StringBufferReplaceableByString - for speed we use StringBuilder
   StringBuilder keyBuilder =
       new StringBuilder(
           propertyName.length()
               + propertyKey.length()
               + visibilityString.length()
               + metadataKey.length());
   keyBuilder.append(getNameSubstitutionStrategy().deflate(propertyName));
   keyBuilder.append(getNameSubstitutionStrategy().deflate(propertyKey));
   keyBuilder.append(visibilityString);
   keyBuilder.append(getNameSubstitutionStrategy().deflate(metadataKey));
   String key = keyBuilder.toString();
   Text r = propertyMetadataColumnQualifierTextCache.peek(key);
   if (r == null) {
     r =
         KeyHelper.getColumnQualifierFromPropertyMetadataColumnQualifier(
             propertyName,
             propertyKey,
             visibilityString,
             metadataKey,
             getNameSubstitutionStrategy());
     propertyMetadataColumnQualifierTextCache.put(key, r);
   }
   return r;
 }
Ejemplo n.º 4
0
 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);
     ColumnVisibility metadataEntryVisibility =
         visibilityToAccumuloVisibility(metadataEntry.getVisibility());
     addPropertyMetadataItemDeleteToMutation(
         m, metadataEntryColumnQualifier, metadataEntryVisibility);
   }
 }
Ejemplo n.º 5
0
 private void addPropertyMetadataItemToKeyValuePairs(
     List<KeyValuePair> results,
     Text vertexRowKey,
     Property property,
     Metadata.Entry metadataItem) {
   Text columnQualifier = getPropertyMetadataColumnQualifierText(property, metadataItem);
   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());
   }
 }