Package com.google.storage.onestore.v3.OnestoreEntity

Examples of com.google.storage.onestore.v3.OnestoreEntity.Path


  public Cursor reverse() {
    CompiledCursor clone = compiledCursor.clone();
    if (clone.hasPosition()) {
      clone.getPosition().setStartInclusive(!clone.getPosition().isStartInclusive());
    } else if (clone.hasPostfixPosition()) {
      IndexPostfix postfixPosition = clone.getPostfixPosition();
      postfixPosition.setBefore(!postfixPosition.isBefore());
    } else if (clone.hasAbsolutePosition()) {
      IndexPosition absolutePosition = clone.getAbsolutePosition();
      absolutePosition.setBefore(!absolutePosition.isBefore());
    }
    return new Cursor(clone);
View Full Code Here


*/
class KeyTranslator {

  public static Key createFromPb(Reference reference) {
    Key parentKey = null;
    Path path = reference.getPath();
    List<Element> elements = path.elements();
    if (elements.isEmpty()) {
      throw new IllegalArgumentException("Invalid Key PB: no elements.");
    }

    AppIdNamespace appIdNamespace = new AppIdNamespace(reference.getApp(),
View Full Code Here

    String nameSpace = key.getNamespace();
    if (!nameSpace.isEmpty()) {
      reference.setNameSpace(nameSpace);
    }

    Path path = reference.getMutablePath();
    while (key != null) {
      Element pathElement = new Element();
      pathElement.setType(key.getKind());
      if (key.getName() != null) {
        pathElement.setName(key.getName());
      } else if (key.getId() != Key.NOT_ASSIGNED) {
        pathElement.setId(key.getId());
      }
      path.addElement(pathElement);
      key = key.getParent();
    }
    Collections.reverse(path.mutableElements());
    return reference;
  }
View Full Code Here

  }

  public static void updateKey(Reference reference, Key key) {

    if (key.getName() == null) {
      Path path = reference.getPath();
      key.setId(path.getElement(path.elementSize() - 1).getId());
    }
  }
View Full Code Here

      ReferenceValue refValue = new ReferenceValue();
      refValue.setApp(keyRef.getApp());
      if (keyRef.hasNameSpace()) {
        refValue.setNameSpace(keyRef.getNameSpace());
      }
      Path path = keyRef.getPath();
      for (Element element : path.elements()) {
        ReferenceValuePathElement newElement = new ReferenceValuePathElement();
        newElement.setType(element.getType());
        if (element.hasName()) {
          newElement.setName(element.getName());
        }
View Full Code Here

      Reference reference = new Reference();
      reference.setApp(refValue.getApp());
      if (refValue.hasNameSpace()) {
        reference.setNameSpace(refValue.getNameSpace());
      }
      Path path = new Path();
      for (ReferenceValuePathElement element : refValue.pathElements()) {
        Element newElement = new Element();
        newElement.setType(element.getType());
        if (element.hasName()) {
          newElement.setName(element.getName());
        }
        if (element.hasId()) {
          newElement.setId(element.getId());
        }
        path.addElement(newElement);
      }
      reference.setPath(path);
      return reference;
    }
View Full Code Here

    Reference reference = KeyTranslator.convertToPb(entity.getKey());

    EntityProto proto = new EntityProto();
    proto.setKey(reference);

    Path entityGroup = proto.getMutableEntityGroup();
    Key key = entity.getKey();
    if (key.isComplete()) {
      entityGroup.addElement(reference.getPath().elements().get(0));
    }

    DataTypeTranslator.addPropertiesToPb(entity.getPropertyMap(), proto);
    return proto;
  }
View Full Code Here

      ReferenceValue refValue = new ReferenceValue();
      refValue.setApp(keyRef.getApp());
      if (keyRef.hasNameSpace()) {
        refValue.setNameSpace(keyRef.getNameSpace());
      }
      Path path = keyRef.getPath();
      for (Element element : path.elements()) {
        ReferenceValuePathElement newElement = new ReferenceValuePathElement();
        newElement.setType(element.getType());
        if (element.hasName()) {
          newElement.setName(element.getName());
        }
View Full Code Here

      ReferenceValue refValue = propertyValue.getReferenceValue();
      reference.setApp(refValue.getApp());
      if (refValue.hasNameSpace()) {
        reference.setNameSpace(refValue.getNameSpace());
      }
      Path path = new Path();
      for (ReferenceValuePathElement element : refValue.pathElements()) {
        Element newElement = new Element();
        newElement.setType(element.getType());
        if (element.hasName()) {
          newElement.setName(element.getName());
        }
        if (element.hasId()) {
          newElement.setId(element.getId());
        }
        path.addElement(newElement);
      }
      reference.setPath(path);

      return KeyTranslator.createFromPb(reference);
    }
View Full Code Here

      Exception exception = new Exception();
      exception.fillInStackTrace();
      StackTraceElement[] stackTrace = exception.getStackTrace();
      HashSet<String> types = new HashSet<String>();
      for (EntityProto p : entitys) {
        Path entityGroup = p.getEntityGroup();
        List<Element> elements = entityGroup.elements();
        for (Element e : elements) {
          types.add(e.getType());
        }
      }
      this.cost = calculateCosts(putRequest);
View Full Code Here

TOP

Related Classes of com.google.storage.onestore.v3.OnestoreEntity.Path

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.