public <T> T getProperty(final String key) { if (propertyBased && key.equals(IdGraph.ID)) { return null; } else { return baseElement.getProperty(key); } }
public void debug(Element element) { System.out.println("---"); for (String key : element.getPropertyKeys()) { System.out.println(key + " : " + element.getProperty(key)); } System.out.println("---"); }
protected E processNextStart() { while (true) { Element e = this.starts.next(); E value = (E) e.getProperty(this.key); if (this.allowNull || value != null) return value; } }
static public <T> Optional<T> getProperty(Element container, String property, Class<T> type) { Optional<T> value = Optional.<T>empty(); if (container.getPropertyKeys().contains(property)) { value = Optional.<T>of(type.cast(container.getProperty(property))); } return value; }
public Object getId() { return propertyBased ? baseElement.getProperty(IdGraph.ID) : baseElement.getId(); }
static public <T> Collection<T> getProperties(Element container, String property, Class<T> type) { List<T> list = new ArrayList<>(); if (container.getPropertyKeys().contains(property)) { return getPropertiesAsSet(container.getProperty(property), type); } return list; }
public <T> T getProperty(final String key) { if (key.equals(this.graph.getPartitionKey())) return null; return this.baseElement.getProperty(key); }
private void writeProperties(final Writer writer, final Element e) throws IOException { for (String key : e.getPropertyKeys()) { if (!this.strict || regex.matcher(key).matches()) { final Object property = e.getProperty(key); writeKey(writer, key); writeProperty(writer, property, 0); } } }
public boolean isInPartition(final Element element) { final String writePartition; if (element instanceof PartitionElement) writePartition = ((PartitionElement) element).getPartition(); else writePartition = element.getProperty(this.partitionKey); return (null == writePartition || this.readPartitions.contains(writePartition)); }
public static void dumpProperties(Element container) { for (String key: container.getPropertyKeys()) { System.out.println(key + ": " + container.getProperty(key)); } }
@Override public Class<?> resolve(final Element element) { final String typeResolutionName = element.getProperty(this.typeResolutionKey); if (typeResolutionName == null) return null; return this.reflectionCache.forName(typeResolutionName); }
protected S processNextStart() { while (true) { final S element = this.starts.next(); if (this.predicate.evaluate(element.getProperty(this.key), this.value)) { return element; } } }
@Override public Object getId() { if (graph.isNaturalIds()) { if (rawElement instanceof Vertex) { return rawElement.getProperty(VEProps.NATURAL_VERTEX_ID_PROP_KEY); } else { return rawElement.getProperty(VEProps.NATURAL_EDGE_ID_PROP_KEY); } } else { return rawElement.getId(); } }
/** * Copies all {@code propertyKeys} from the {@code source} to the {@code target}. * * @param source the source element * @param target the target element * @param propertyKeys the property keys to copy */ private void copyProperties(Element source, Element target, Set<String> propertyKeys) { propertyKeys.forEach(k -> target.setProperty(k, source.getProperty(k))); }
public S processNextStart() { while (true) { final S s = this.starts.next(); final Object value = s.getProperty(key); if (null == value) continue; else { if (Compare.GREATER_THAN_EQUAL.evaluate(value, this.startValue) && Compare.LESS_THAN.evaluate(value, this.endValue)) return s; } } }
private Class<?> resolve(Element e, Class<?> defaultType) { Class<?> typeHoldingTypeField = typeRegistry.getTypeHoldingTypeField(defaultType); if (typeHoldingTypeField != null) { String value = e.getProperty(typeHoldingTypeField.getAnnotation(TypeField.class).value()); Class<?> type = value == null ? null : typeRegistry.getType(typeHoldingTypeField, value); if (type != null) { return type; } } return defaultType; }
private Class<?> resolve(Element e, Class<?> defaultType) { Class<?> typeHoldingTypeField = typeRegistry.getTypeHoldingTypeField(defaultType); if (typeHoldingTypeField != null) { String value = e.getProperty(typeHoldingTypeField.getAnnotation(TypeField.class).value()); Class<?> type = value == null ? null : typeRegistry.getType(typeHoldingTypeField, value); if (type != null) { return type; } } return defaultType; }
public boolean isLegal(final Element element) { if (this.key.equals(StringFactory.ID)) { return this.predicate.evaluate(element.getId(), this.value); } else if (this.key.equals(StringFactory.LABEL) && element instanceof Edge) { return this.predicate.evaluate(((Edge) element).getLabel(), this.value); } else { return this.predicate.evaluate(element.getProperty(this.key), this.value); } } }
/** * Raises a vertexPropertyRemoved or edgePropertyChanged event. */ public void setProperty(final String key, final Object value) { final Object oldValue = this.baseElement.getProperty(key); this.baseElement.setProperty(key, value); if (this instanceof Vertex) { this.onVertexPropertyChanged((Vertex) this, key, oldValue, value); } else if (this instanceof Edge) { this.onEdgePropertyChanged((Edge) this, key, oldValue, value); } }
@Override public String getElementVersion(Element element) { if (element instanceof WrappedVertex) { element = ((WrappedVertex) element).getBaseElement(); } OrientElement e = (OrientElement) element; String uuid = element.getProperty("uuid"); return ETag.hash(uuid + e.getRecord().getVersion()); }