@Override protected Object convert(Property p) { return p.getValue(); } };
@Override protected Object convert(Property p) { return p.getValue(); } };
@Override protected Object convert(Property p) { return p.getValue(); } };
@Override protected Object convert(Property p) { return p.getValue(); } };
private boolean evaluate(Property property, Object second) { switch (this) { case WITHIN: return ((GeoShape) second).within((GeoShape) property.getValue()); default: throw new IllegalArgumentException("Invalid compare: " + this); } } }
private JSONArray propertiesToJson(Iterable<Property> properties) { JSONArray json = new JSONArray(); for (Property property : properties) { if (property.getValue() instanceof StreamingPropertyValue) { continue; } json.put(propertyToJson(property)); } return json; }
private boolean evaluate(Property property, Object second) { switch (this) { case WITHIN: return ((GeoShape) second).within((GeoShape) property.getValue()); default: throw new IllegalArgumentException("Invalid compare: " + this); } } }
private void saveStreamingProperty(OutputStream out, Property property) throws IOException { StreamingPropertyValue spv = (StreamingPropertyValue) property.getValue(); JSONObject json = propertyToJson(property); json.put("valueType", spv.getValueType().getName()); json.put("searchIndex", spv.isSearchIndex()); json.put("store", spv.isStore()); out.write('D'); out.write(json.toString().getBytes()); out.write('\n'); InputStream in = spv.getInputStream(); byte[] buffer = new byte[10 * 1024]; int read; while ((read = in.read(buffer)) > 0) { out.write(Integer.toString(read).getBytes()); out.write('\n'); out.write(buffer, 0, read); out.write('\n'); } out.write('0'); out.write('\n'); }
protected boolean evaluateQueryString(Element elem, String queryString) { for (Property property : elem.getProperties()) { if (evaluateQueryStringOnValue(property.getValue(), queryString)) { return true; } } return false; }
private void saveStreamingPropertyValues(OutputStream out, Element element) throws IOException { for (Property property : element.getProperties()) { if (property.getValue() instanceof StreamingPropertyValue) { saveStreamingProperty(out, property); } } }
public static JSONObject propertyYoJson(Property property) { JSONObject json = new JSONObject(); json.put("key", property.getKey()); json.put("name", property.getName()); json.put("metadata", propertyMetadataToJson(property.getMetadata())); json.put("visibility", property.getVisibility().toString()); json.put("value", property.getValue().toString()); return json; }
protected boolean evaluateQueryString(Element elem, String queryString) { for (Property property : elem.getProperties()) { if (evaluateQueryStringOnValue(property.getValue(), queryString)) { return true; } } return false; }
private JSONObject propertyToJson(Property property) { JSONObject json = new JSONObject(); json.put("key", property.getKey()); json.put("name", property.getName()); json.put("visibility", property.getVisibility().getVisibilityString()); Object value = property.getValue(); if (!(value instanceof StreamingPropertyValue)) { json.put("value", objectToJsonString(value)); } Metadata metadata = property.getMetadata(); if (metadata != null) { json.put("metadata", metadataToJson(metadata)); } return json; }
private boolean evaluate(Property property, Object second, PropertyDefinition propertyDefinition) { Object first = property.getValue(); if (!canEvaulate(first) || !canEvaulate(second)) { throw new SecureGraphException("Text predicates are only valid for string or GeoPoint fields"); } String firstString = valueToString(first); String secondString = valueToString(second); switch (this) { case CONTAINS: if (propertyDefinition != null && !propertyDefinition.getTextIndexHints().contains(TextIndexHint.FULL_TEXT)) { return false; } return firstString.contains(secondString); default: throw new IllegalArgumentException("Invalid text predicate: " + this); } }
private boolean evaluate(Property property, Object second, PropertyDefinition propertyDefinition) { Object first = property.getValue(); if (!canEvaulate(first) || !canEvaulate(second)) { throw new SecureGraphException("Text predicates are only valid for string or GeoPoint fields"); } String firstString = valueToString(first); String secondString = valueToString(second); switch (this) { case CONTAINS: if (propertyDefinition != null && !propertyDefinition.getTextIndexHints().contains(TextIndexHint.FULL_TEXT)) { return false; } return firstString.contains(secondString); default: throw new IllegalArgumentException("Invalid text predicate: " + this); } }
@Override protected void updatePropertiesInternal(Iterable<Property> properties, Iterable<PropertyRemoveMutation> propertyRemoveMutations) { try { for (Property property : properties) { if (property.getValue() instanceof StreamingPropertyValue) { StreamingPropertyValue value = (StreamingPropertyValue) property.getValue(); byte[] valueData = StreamUtils.toBytes(value.getInputStream()); ((MutableProperty) property).setValue(new InMemoryStreamingPropertyValue(valueData, value.getValueType())); } } super.updatePropertiesInternal(properties, propertyRemoveMutations); } catch (IOException ex) { throw new SecureGraphException(ex); } }
public void addPropertyToMutation(Mutation m, String rowKey, Property property) { Text columnQualifier = getPropertyColumnQualifier(property); ColumnVisibility columnVisibility = visibilityToAccumuloVisibility(property.getVisibility()); Object propertyValue = property.getValue(); if (propertyValue instanceof StreamingPropertyValue) { propertyValue = saveStreamingPropertyValue(rowKey, property, (StreamingPropertyValue) propertyValue); } if (propertyValue instanceof DateOnly) { propertyValue = ((DateOnly) propertyValue).getDate(); } Value value = new Value(valueSerializer.objectToValue(propertyValue)); m.put(AccumuloElement.CF_PROPERTY, columnQualifier, columnVisibility, value); addPropertyMetadataToMutation(m, property); }
void alterElementPropertyVisibilities(InMemoryElement element, List<AlterPropertyVisibility> alterPropertyVisibilities, Authorizations authorizations) { for (AlterPropertyVisibility apv : alterPropertyVisibilities) { Property property = element.getProperty(apv.getKey(), apv.getName(), apv.getExistingVisibility()); if (property == null) { throw new SecureGraphException("Could not find property " + apv.getKey() + ":" + apv.getName()); } Object value = property.getValue(); Metadata metadata = property.getMetadata(); element.removeProperty(apv.getKey(), apv.getName(), authorizations); element.addPropertyValue(apv.getKey(), apv.getName(), value, metadata, apv.getVisibility(), authorizations); } }
public void update(Property property) { if (property.getHiddenVisibilities() != null) { for (Visibility v : property.getHiddenVisibilities()) { addHiddenVisibility(v); } } setValue(property.getValue()); for (Metadata.Entry m : property.getMetadata().entrySet()) { if (m.getValue() == null) { removeMetadata(m.getKey(), m.getVisibility()); } else { addMetadata(m.getKey(), m.getValue(), m.getVisibility()); } } } }
public void update(Property property) { if (property.getHiddenVisibilities() != null) { for (Visibility v : property.getHiddenVisibilities()) { addHiddenVisibility(v); } } setValue(property.getValue()); for (Metadata.Entry m : property.getMetadata().entrySet()) { if (m.getValue() == null) { removeMetadata(m.getKey(), m.getVisibility()); } else { addMetadata(m.getKey(), m.getValue(), m.getVisibility()); } } } }