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

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


      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


     */
    @Test
    public void refereceToKeyForId() throws Exception {
        Key key = KeyFactory.createKey("Hoge", 1);
        Reference reference = new Reference();
        Path path = new Path();
        reference.setPath(path);
        Element element = path.addElement();
        element.setType("Hoge");
        element.setId(1);
        assertThat(DatastoreUtil.referenceToKey(reference), is(key));
    }
View Full Code Here

     */
    @Test
    public void refereceToKeyForMinusId() throws Exception {
        Key key = KeyFactory.createKey("Hoge", -1);
        Reference reference = new Reference();
        Path path = new Path();
        reference.setPath(path);
        Element element = path.addElement();
        element.setType("Hoge");
        element.setId(-1);
        assertThat(DatastoreUtil.referenceToKey(reference), is(key));
    }
View Full Code Here

     */
    @Test
    public void refereceToKeyForName() throws Exception {
        Key key = KeyFactory.createKey("Hoge", "aaa");
        Reference reference = new Reference();
        Path path = new Path();
        reference.setPath(path);
        Element element = path.addElement();
        element.setType("Hoge");
        element.setName("aaa");
        assertThat(DatastoreUtil.referenceToKey(reference), is(key));
    }
View Full Code Here

    @Test
    public void refereceToKeyForParent() throws Exception {
        Key parentKey = KeyFactory.createKey("Parent", 1);
        Key childKey = KeyFactory.createKey(parentKey, "Child", 1);
        Reference reference = new Reference();
        Path path = new Path();
        reference.setPath(path);
        Element element = path.addElement();
        element.setType("Parent");
        element.setId(1);
        element = path.addElement();
        element.setType("Child");
        element.setId(1);
        assertThat(DatastoreUtil.referenceToKey(reference), is(childKey));
    }
View Full Code Here

      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());
View Full Code Here

      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

      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);
View Full Code Here

    public void refereceToKeyForId() throws Exception {
        Key key = KeyFactory.createKey("Hoge", 1);
        Reference reference = new Reference();
        Path path = new Path();
        reference.setPath(path);
        Element element = path.addElement();
        element.setType("Hoge");
        element.setId(1);
        assertThat(DatastoreUtil.referenceToKey(reference), is(key));
    }
View Full Code Here

    public void refereceToKeyForMinusId() throws Exception {
        Key key = KeyFactory.createKey("Hoge", -1);
        Reference reference = new Reference();
        Path path = new Path();
        reference.setPath(path);
        Element element = path.addElement();
        element.setType("Hoge");
        element.setId(-1);
        assertThat(DatastoreUtil.referenceToKey(reference), is(key));
    }
View Full Code Here

TOP

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

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.