Search in sources :

Example 1 with MutablePropertyImpl

use of org.vertexium.property.MutablePropertyImpl in project vertexium by visallo.

the class ElementBase method getEdgeLabelProperty.

protected Property getEdgeLabelProperty() {
    if (edgeLabelProperty == null && this instanceof Edge) {
        String edgeLabel = ((Edge) this).getLabel();
        edgeLabelProperty = new MutablePropertyImpl(ElementMutation.DEFAULT_KEY, Edge.LABEL_PROPERTY_NAME, edgeLabel, null, getTimestamp(), null, null, getFetchHints());
    }
    return edgeLabelProperty;
}
Also used : MutablePropertyImpl(org.vertexium.property.MutablePropertyImpl)

Example 2 with MutablePropertyImpl

use of org.vertexium.property.MutablePropertyImpl in project vertexium by visallo.

the class ExistingElementMutationImplTest method testHasChangesDeleteProperty.

@Test
public void testHasChangesDeleteProperty() {
    mutation.deleteProperty(new MutablePropertyImpl("key1", "name1", "value", null, null, null, new Visibility(""), FetchHints.ALL));
    assertTrue("should have changes", mutation.hasChanges());
}
Also used : MutablePropertyImpl(org.vertexium.property.MutablePropertyImpl) Visibility(org.vertexium.Visibility) Test(org.junit.Test)

Example 3 with MutablePropertyImpl

use of org.vertexium.property.MutablePropertyImpl in project vertexium by visallo.

the class ExistingElementMutationImplTest method testHasChangesSoftDeleteProperty.

@Test
public void testHasChangesSoftDeleteProperty() {
    mutation.softDeleteProperty(new MutablePropertyImpl("key1", "name1", "value", null, null, null, new Visibility(""), FetchHints.ALL));
    assertTrue("should have changes", mutation.hasChanges());
}
Also used : MutablePropertyImpl(org.vertexium.property.MutablePropertyImpl) Visibility(org.vertexium.Visibility) Test(org.junit.Test)

Example 4 with MutablePropertyImpl

use of org.vertexium.property.MutablePropertyImpl in project vertexium by visallo.

the class AccumuloGraphTestBase method addLegacySPVData.

// need to add it manually because the key format changed
private void addLegacySPVData(String vertexId, long timestamp, String propertyKey, String propertyName, String propertyValue) throws MutationsRejectedException {
    String dataRowKey = new DataTableRowKey(vertexId, propertyKey, propertyName).getRowKey() + VALUE_SEPARATOR + timestamp;
    Mutation addPropertyMutation = new Mutation(vertexId);
    byte[] data = propertyValue.getBytes();
    StreamingPropertyValue spv = StreamingPropertyValue.create(propertyValue);
    StreamingPropertyValueTableRef spvValue = new StreamingPropertyValueTableRef(dataRowKey, spv, data);
    Metadata metadata = new Metadata();
    Property property = new MutablePropertyImpl(propertyKey, propertyName, spvValue, metadata, timestamp, new HashSet<>(), new Visibility(""), FetchHints.ALL);
    Text columnQualifier = KeyHelper.getColumnQualifierFromPropertyColumnQualifier(property, getGraph().getNameSubstitutionStrategy());
    addPropertyMutation.put(AccumuloElement.CF_PROPERTY, columnQualifier, new Value(getGraph().getVertexiumSerializer().objectToBytes(spvValue)));
    getGraph().getVerticesWriter().addMutation(addPropertyMutation);
    Mutation addDataMutation = new Mutation(dataRowKey);
    addDataMutation.put(EMPTY_TEXT, EMPTY_TEXT, timestamp - 1000, new Value(data));
    getGraph().getDataWriter().addMutation(addDataMutation);
    getGraph().flush();
}
Also used : StreamingPropertyValue(org.vertexium.property.StreamingPropertyValue) Text(org.apache.hadoop.io.Text) DataTableRowKey(org.vertexium.accumulo.keys.DataTableRowKey) MutablePropertyImpl(org.vertexium.property.MutablePropertyImpl) Value(org.apache.accumulo.core.data.Value) StreamingPropertyValue(org.vertexium.property.StreamingPropertyValue) Mutation(org.apache.accumulo.core.data.Mutation)

Example 5 with MutablePropertyImpl

use of org.vertexium.property.MutablePropertyImpl in project vertexium by visallo.

the class ExistingElementMutationImpl method addPropertyValue.

@Override
public ElementMutation<T> addPropertyValue(String key, String name, Object value, Metadata metadata, Long timestamp, Visibility visibility) {
    Preconditions.checkNotNull(name, "property name cannot be null for property: " + name + ":" + key);
    Preconditions.checkNotNull(value, "property value cannot be null for property: " + name + ":" + key);
    properties.add(new MutablePropertyImpl(key, name, value, metadata, timestamp, null, visibility, FetchHints.ALL_INCLUDING_HIDDEN));
    return this;
}
Also used : MutablePropertyImpl(org.vertexium.property.MutablePropertyImpl)

Aggregations

MutablePropertyImpl (org.vertexium.property.MutablePropertyImpl)5 Test (org.junit.Test)2 Visibility (org.vertexium.Visibility)2 Mutation (org.apache.accumulo.core.data.Mutation)1 Value (org.apache.accumulo.core.data.Value)1 Text (org.apache.hadoop.io.Text)1 DataTableRowKey (org.vertexium.accumulo.keys.DataTableRowKey)1 StreamingPropertyValue (org.vertexium.property.StreamingPropertyValue)1