예제 #1
0
  public static List<String> getTraitNames(Vertex entityVertex) {
    ArrayList<String> traits = new ArrayList<>();
    for (TitanProperty property :
        ((TitanVertex) entityVertex).getProperties(Constants.TRAIT_NAMES_PROPERTY_KEY)) {
      traits.add((String) property.getValue());
    }

    return traits;
  }
예제 #2
0
 private static void writeAttribute(DataOutput out, TitanProperty property) {
   Object attribute = property.getAttribute();
   TitanKey key = (TitanKey) property.getType();
   assert attribute != null;
   assert key.getDataType().isInstance(attribute);
   if (hasGenericDataType(key)) {
     out.writeClassAndObject(attribute);
   } else {
     out.writeObjectNotNull(attribute);
   }
 }
예제 #3
0
 private void lockKeyedProperty(TitanProperty prop, StoreMutator mutator) throws StorageException {
   TitanKey pt = prop.getPropertyKey();
   assert pt.isSimple();
   if (pt.hasIndex() && pt.isUnique()) {
     if (prop.isNew()) {
       mutator.acquireIndexLock(getIndexKey(prop.getAttribute()), getKeyedIndexColumn(pt), null);
     } else {
       assert prop.isRemoved();
       mutator.acquireIndexLock(
           getIndexKey(prop.getAttribute()), getKeyedIndexColumn(pt), getIndexValue(prop));
     }
   }
 }
예제 #4
0
 private void addIndexEntry(TitanProperty prop, StoreMutator mutator) throws StorageException {
   TitanKey pt = prop.getPropertyKey();
   assert pt.isSimple();
   if (pt.hasIndex()) {
     if (pt.isUnique()) {
       mutator.mutateIndex(
           getIndexKey(prop.getAttribute()),
           Lists.newArrayList(new Entry(getKeyedIndexColumn(pt), getIndexValue(prop))),
           null);
     } else {
       mutator.mutateIndex(
           getIndexKey(prop.getAttribute()),
           Lists.newArrayList(new Entry(getIndexColumn(pt, prop.getID()), getIndexValue(prop))),
           null);
     }
   }
 }
예제 #5
0
 private ByteBuffer getIndexValue(TitanProperty prop) {
   assert prop.getType().isSimple();
   return VariableLong.positiveByteBuffer(prop.getVertex().getID());
 }