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

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


  private static Pair<Type<?>, PropertyValue> createPropertyValue(Object value) {
    if (value == null) {
      return Pair.of(null, null);
    }
    PropertyValue newValue = new PropertyValue();
    Type<?> type = getType(value.getClass());
    type.setPropertyValue(newValue, value);
    return new Pair<Type<?>, PropertyValue>(type, newValue);
  }
View Full Code Here


  }

  private static Property buildImplicitKeyProperty(EntityProto proto) {
    Property keyProp = new Property();
    keyProp.setName(Entity.KEY_RESERVED_PROPERTY);
    PropertyValue propVal = new PropertyValue();
    ReferenceType.setPropertyValue(propVal, proto.getKey());
    keyProp.setValue(propVal);
    return keyProp;
  }
View Full Code Here

   *
   * @param property a not {@code null} property
   * @return {@code null} if no value was set for {@code property}
   */
  public static Object getPropertyValue(Property property) {
    PropertyValue value = property.getValue();
    for (Type<?> type : typeMap.values()) {
      if (type.hasPropertyValue(value) &&
          type.getMeaning() == property.getMeaningEnum()) {
        return type.getPropertyValue(value);
      }
View Full Code Here

   *
   * @param property a not {@code null} property
   * @return {@code null} if no value was set for {@code property}
   */
  public static Comparable<Object> getComparablePropertyValue(Property property) {
    PropertyValue value = property.getValue();
    Meaning meaning = property.getMeaningEnum();
    for (Type<?> type : typeMap.values()) {
      if (type.hasPropertyValue(value) &&
          (meaning == Meaning.INDEX_VALUE || meaning == type.getMeaning()) &&
          type.getComparableFunction() != null) {
View Full Code Here

    public Key asComparable(Object value) {
      return (Key) value;
    }

    private static ReferenceValue toReferenceValue(Reference keyRef) {
      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());
        }
        if (element.hasId()) {
          newElement.setId(element.getId());
        }
        refValue.addPathElement(newElement);
      }

      return refValue;
    }
View Full Code Here

    @Override
    public Key getPropertyValue(PropertyValue propertyValue) {

      Reference reference = new Reference();
      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());
        }
View Full Code Here

      Reference keyRef = KeyTranslator.convertToPb((Key) value);
      setPropertyValue(propertyValue, keyRef);
    }

    private static void setPropertyValue(PropertyValue propertyValue, Reference keyRef) {
      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());
        }
        if (element.hasId()) {
          newElement.setId(element.getId());
        }
        refValue.addPathElement(newElement);
      }

      propertyValue.setReferenceValue(refValue);
    }
View Full Code Here

      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());
        }
        if (element.hasId()) {
          newElement.setId(element.getId());
        }
        refValue.addPathElement(newElement);
      }

      return refValue;
View Full Code Here

      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());
        }
        if (element.hasId()) {
          newElement.setId(element.getId());
        }
        refValue.addPathElement(newElement);
      }

      propertyValue.setReferenceValue(refValue);
View Full Code Here

    }

    @Override
    public boolean toV3Value(Object value, PropertyValue propertyValue) {
      User user = (User) value;
      UserValue userValue = new UserValue();
      userValue.setEmail(user.getEmail());
      userValue.setAuthDomain(user.getAuthDomain());
      if (user.getUserId() != null) {
        userValue.setObfuscatedGaiaid(user.getUserId());
      }
      userValue.setGaiaid(0);
      propertyValue.setUserValue(userValue);
      return true;
    }
View Full Code Here

TOP

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

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.