use of org.vertexium.property.MutableProperty in project vertexium by visallo.
the class AccumuloGraph method alterElementPropertyVisibilities.
void alterElementPropertyVisibilities(AccumuloElement element, List<AlterPropertyVisibility> alterPropertyVisibilities) {
if (alterPropertyVisibilities.size() == 0) {
return;
}
String elementRowKey = element.getId();
Mutation m = new Mutation(elementRowKey);
List<PropertyDescriptor> propertyList = Lists.newArrayList();
for (AlterPropertyVisibility apv : alterPropertyVisibilities) {
MutableProperty property = (MutableProperty) element.getProperty(apv.getKey(), apv.getName(), apv.getExistingVisibility());
if (property == null) {
throw new VertexiumException("Could not find property " + apv.getKey() + ":" + apv.getName());
}
if (property.getVisibility().equals(apv.getVisibility())) {
continue;
}
if (apv.getExistingVisibility() == null) {
apv.setExistingVisibility(property.getVisibility());
}
elementMutationBuilder.addPropertySoftDeleteToMutation(m, property);
property.setVisibility(apv.getVisibility());
property.setTimestamp(apv.getTimestamp());
elementMutationBuilder.addPropertyToMutation(this, m, elementRowKey, property);
// Keep track of properties that need to be removed from indices
propertyList.add(PropertyDescriptor.from(apv.getKey(), apv.getName(), apv.getExistingVisibility()));
}
if (!propertyList.isEmpty()) {
addMutations(element, m);
}
}
use of org.vertexium.property.MutableProperty in project vertexium by visallo.
the class AccumuloElement method addPropertyInternal.
protected void addPropertyInternal(Property property) {
if (property.getKey() == null) {
throw new IllegalArgumentException("key is required for property");
}
Object propertyValue = property.getValue();
if (propertyValue instanceof PropertyValue && !((PropertyValue) propertyValue).isStore()) {
return;
}
Property existingProperty = getProperty(property.getKey(), property.getName(), property.getVisibility());
if (existingProperty == null) {
this.properties.addProperty(property);
} else {
if (existingProperty instanceof MutableProperty) {
((MutableProperty) existingProperty).update(property);
} else {
throw new VertexiumException("Could not update property of type: " + existingProperty.getClass().getName());
}
}
}
Aggregations