Package org.odata4j.edm

Examples of org.odata4j.edm.EdmType


    return containsProp;
  }

  private void applyProperties(Entity e, List<OProperty<?>> properties) {
    for (OProperty<?> prop : properties) {
      EdmType type = prop.getType();
      if (!SUPPORTED_TYPES.contains(type)) {
        throw new NotImplementedException("EdmType not supported: " + type);
      }

      Object value = prop.getValue();
      if (type.equals(EdmSimpleType.STRING)) {
        String sValue = (String) value;
        if (sValue != null && sValue.length() > DataTypeUtils.MAX_STRING_PROPERTY_LENGTH) {
          value = new Text(sValue);
        }
      } else if (type.equals(EdmSimpleType.BINARY)) {
        byte[] bValue = (byte[]) value;
        if (bValue != null) {
          if (bValue.length > DataTypeUtils.MAX_SHORT_BLOB_PROPERTY_LENGTH) {
            throw new RuntimeException("Bytes " + bValue.length + " exceeds the max supported length " + DataTypeUtils.MAX_SHORT_BLOB_PROPERTY_LENGTH);
          }
          value = new ShortBlob(bValue);
        }
      } else if (type.equals(EdmSimpleType.DATETIME)) {
        LocalDateTime dValue = (LocalDateTime) value;
        if (dValue != null) {
          value = dValue.toDateTime().toDate(); // TODO review
        }
      }
View Full Code Here

TOP

Related Classes of org.odata4j.edm.EdmType

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.