Java Code Examples for com.tinkerpop.blueprints.util.StringFactory

The following examples show how to use com.tinkerpop.blueprints.util.StringFactory. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: AccumuloGraph   Source File: AccumuloElement.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public <T> T removeProperty(String key) {
  if (StringFactory.LABEL.equals(key) ||
      Constants.LABEL.equals(key)) {
    throw new AccumuloGraphException("Cannot remove the " + StringFactory.LABEL + " property.");
  }

  makeCache();
  T value = getProperty(key);
  if (value != null) {
    globals.getElementWrapper(type).clearProperty(this, key);
    globals.checkedFlush();
  }
  globals.getKeyIndexTableWrapper(type).removePropertyFromIndex(this, key, value);
  // MDL 31 Dec 2014:  AccumuloGraph.removeProperty
  //   calls getProperty which populates the cache.
  //   So the order here is important (for now).
  removePropertyInMemory(key);
  return value;
}
 
Example 2
Source Project: AccumuloGraph   Source File: ElementTableWrapper.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Read the given property from the backing table
 * for the given element id.
 * @param id
 * @param key
 * @return
 */
public <V> V readProperty(Element element, String key) {
  Scanner s = getScanner();

  s.setRange(new Range(element.getId().toString()));

  Text colf = StringFactory.LABEL.equals(key)
      ? new Text(Constants.LABEL) : new Text(key);
  s.fetchColumnFamily(colf);

  V value = null;

  Iterator<Entry<Key, Value>> iter = s.iterator();
  if (iter.hasNext()) {
    value = AccumuloByteSerializer.deserialize(iter.next().getValue().get());
  }
  s.close();

  return value;
}
 
Example 3
Source Project: AccumuloGraph   Source File: AccumuloEdge.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public String getLabel() {
  // TODO less special treatment for "LABEL" property...
  if (label != null) {
    return label;
  }
  return getProperty(StringFactory.LABEL);
}
 
Example 4
Source Project: AccumuloGraph   Source File: AccumuloGraphUtils.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Ensure that the given key/value don't conflict with
 * Blueprints reserved words.
 * @param key
 * @param value
 */
public static void validateProperty(String key, Object value) {
  nullCheckProperty(key, value);
  if (key.equals(StringFactory.ID)) {
    throw ExceptionFactory.propertyKeyIdIsReserved();
  } else if (key.equals(StringFactory.LABEL)) {
    throw ExceptionFactory.propertyKeyLabelIsReservedForEdges();
  } else if (value == null) {
    throw ExceptionFactory.propertyValueCanNotBeNull();
  }
}
 
Example 5
Source Project: AccumuloGraph   Source File: AccumuloGraphUtils.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Disallow null keys/values and throw appropriate
 * Blueprints exceptions.
 * @param key
 * @param value
 */
public static void nullCheckProperty(String key, Object value) {
  if (key == null) {
    throw ExceptionFactory.propertyKeyCanNotBeNull();
  } else if (value == null) {
    throw ExceptionFactory.propertyValueCanNotBeNull();
  } else if (key.trim().equals(StringFactory.EMPTY_STRING)) {
    throw ExceptionFactory.propertyKeyCanNotBeEmpty();
  }
}
 
Example 6
Source Project: bjoern   Source File: BjoernGraph.java    License: GNU General Public License v3.0 4 votes vote down vote up
public String toString()
{
	return StringFactory.graphString(this, this.baseGraph.toString());
}
 
Example 7
@Override
public String toString() {
    return StringFactory.indexString(this);
}
 
Example 8
Source Project: org.openntf.domino   Source File: ReadOnlyGraph.java    License: Apache License 2.0 4 votes vote down vote up
public String toString() {
    return StringFactory.graphString(this, this.baseGraph.toString());
}
 
Example 9
Source Project: org.openntf.domino   Source File: ReadOnlyIndex.java    License: Apache License 2.0 4 votes vote down vote up
public String toString() {
    return StringFactory.indexString(this);
}
 
Example 10
Source Project: org.openntf.domino   Source File: PartitionGraph.java    License: Apache License 2.0 4 votes vote down vote up
public String toString() {
    return StringFactory.graphString(this, this.baseGraph.toString());
}
 
Example 11
Source Project: org.openntf.domino   Source File: PartitionIndex.java    License: Apache License 2.0 4 votes vote down vote up
public String toString() {
    return StringFactory.indexString(this);
}
 
Example 12
Source Project: org.openntf.domino   Source File: IdGraph.java    License: Apache License 2.0 4 votes vote down vote up
public String toString() {
    return StringFactory.graphString(this, this.baseGraph.toString());
}
 
Example 13
Source Project: org.openntf.domino   Source File: IdEdge.java    License: Apache License 2.0 4 votes vote down vote up
public String toString() {
    return StringFactory.edgeString(this);
}
 
Example 14
Source Project: org.openntf.domino   Source File: IdVertex.java    License: Apache License 2.0 4 votes vote down vote up
public String toString() {
    return StringFactory.vertexString(this);
}
 
Example 15
Source Project: org.openntf.domino   Source File: EventIndex.java    License: Apache License 2.0 4 votes vote down vote up
public String toString() {
    return StringFactory.indexString(this);
}
 
Example 16
Source Project: org.openntf.domino   Source File: EventGraph.java    License: Apache License 2.0 4 votes vote down vote up
public String toString() {
    return StringFactory.graphString(this, this.baseGraph.toString());
}
 
Example 17
Source Project: org.openntf.domino   Source File: WrappedIndex.java    License: Apache License 2.0 4 votes vote down vote up
public String toString() {
    return StringFactory.indexString(this);
}
 
Example 18
Source Project: org.openntf.domino   Source File: WrappedGraph.java    License: Apache License 2.0 4 votes vote down vote up
public String toString() {
    return StringFactory.graphString(this, this.baseGraph.toString());
}
 
Example 19
Source Project: org.openntf.domino   Source File: FramedGraph.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public String toString() {
	return StringFactory.graphString(this, this.baseGraph.toString());
}