com.tinkerpop.blueprints.util.StringFactory Java Examples

The following examples show how to use com.tinkerpop.blueprints.util.StringFactory. 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 File: AccumuloElement.java    From AccumuloGraph with 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 File: ElementTableWrapper.java    From AccumuloGraph with 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 File: AccumuloEdge.java    From AccumuloGraph with 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 File: AccumuloGraphUtils.java    From AccumuloGraph with 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 File: AccumuloGraphUtils.java    From AccumuloGraph with 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 File: FramedGraph.java    From org.openntf.domino with Apache License 2.0 4 votes vote down vote up
@Override
public String toString() {
	return StringFactory.graphString(this, this.baseGraph.toString());
}
 
Example #7
Source File: BjoernGraph.java    From bjoern with GNU General Public License v3.0 4 votes vote down vote up
public String toString()
{
	return StringFactory.graphString(this, this.baseGraph.toString());
}
 
Example #8
Source File: WrappedGraph.java    From org.openntf.domino with Apache License 2.0 4 votes vote down vote up
public String toString() {
    return StringFactory.graphString(this, this.baseGraph.toString());
}
 
Example #9
Source File: WrappedIndex.java    From org.openntf.domino with Apache License 2.0 4 votes vote down vote up
public String toString() {
    return StringFactory.indexString(this);
}
 
Example #10
Source File: EventGraph.java    From org.openntf.domino with Apache License 2.0 4 votes vote down vote up
public String toString() {
    return StringFactory.graphString(this, this.baseGraph.toString());
}
 
Example #11
Source File: EventIndex.java    From org.openntf.domino with Apache License 2.0 4 votes vote down vote up
public String toString() {
    return StringFactory.indexString(this);
}
 
Example #12
Source File: IdVertex.java    From org.openntf.domino with Apache License 2.0 4 votes vote down vote up
public String toString() {
    return StringFactory.vertexString(this);
}
 
Example #13
Source File: IdEdge.java    From org.openntf.domino with Apache License 2.0 4 votes vote down vote up
public String toString() {
    return StringFactory.edgeString(this);
}
 
Example #14
Source File: IdGraph.java    From org.openntf.domino with Apache License 2.0 4 votes vote down vote up
public String toString() {
    return StringFactory.graphString(this, this.baseGraph.toString());
}
 
Example #15
Source File: PartitionIndex.java    From org.openntf.domino with Apache License 2.0 4 votes vote down vote up
public String toString() {
    return StringFactory.indexString(this);
}
 
Example #16
Source File: PartitionGraph.java    From org.openntf.domino with Apache License 2.0 4 votes vote down vote up
public String toString() {
    return StringFactory.graphString(this, this.baseGraph.toString());
}
 
Example #17
Source File: ReadOnlyIndex.java    From org.openntf.domino with Apache License 2.0 4 votes vote down vote up
public String toString() {
    return StringFactory.indexString(this);
}
 
Example #18
Source File: ReadOnlyGraph.java    From org.openntf.domino with Apache License 2.0 4 votes vote down vote up
public String toString() {
    return StringFactory.graphString(this, this.baseGraph.toString());
}
 
Example #19
Source File: ActiveVersionedIndex.java    From antiquity with GNU General Public License v3.0 4 votes vote down vote up
@Override
public String toString() {
    return StringFactory.indexString(this);
}