Examples of EntityPropertyInfo


Examples of org.apache.olingo.odata2.core.ep.aggregator.EntityPropertyInfo

      validateMetadata();
    } else if (FormatJson.ODATA_CONTEXT.equals(name)) {
      readODataContext();
    } else {
      ensureODataEntryExists();
      EntityPropertyInfo propertyInfo = eia.getPropertyInfo(name);
      if (propertyInfo != null) {
        Object propertyValue = new JsonPropertyConsumer()
            .readPropertyValue(reader, propertyInfo, typeMappings.get(name), readProperties);
        if (properties.containsKey(name)) {
          throw new EntityProviderException(EntityProviderException.DOUBLE_PROPERTY.addContent(name));
View Full Code Here

Examples of org.apache.olingo.odata2.core.ep.aggregator.EntityPropertyInfo

    }
  }

  @Override
  public ODataResponse writeProperty(final EdmProperty edmProperty, final Object value) throws EntityProviderException {
    EntityPropertyInfo propertyInfo = EntityInfoAggregator.create(edmProperty);
    return writeSingleTypedElement(propertyInfo, value);
  }
View Full Code Here

Examples of org.apache.olingo.odata2.core.ep.aggregator.EntityPropertyInfo

        @SuppressWarnings("unchecked")
        Map<String, Object> map = (Map<String, Object>) data;
        return writeEntry(functionImport.getEntitySet(), map, properties);
      }

      final EntityPropertyInfo info = EntityInfoAggregator.create(functionImport);
      if (isCollection) {
        return writeCollection(info, (List<?>) data);
      } else {
        return writeSingleTypedElement(info, data);
      }
View Full Code Here

Examples of org.apache.olingo.odata2.core.ep.aggregator.EntityPropertyInfo

        @SuppressWarnings("unchecked")
        Map<String, Object> map = (Map<String, Object>) data;
        return writeEntry(functionImport.getEntitySet(), map, properties);
      }

      final EntityPropertyInfo info = EntityInfoAggregator.create(functionImport);
      if (functionImport.getReturnType().getMultiplicity() == EdmMultiplicity.MANY) {
        return writeCollection(info, (List<?>) data);
      } else {
        return writeSingleTypedElement(info, data);
      }
View Full Code Here

Examples of org.apache.olingo.odata2.core.ep.aggregator.EntityPropertyInfo

public class JsonPropertyConsumer {

  public Map<String, Object> readPropertyStandalone(final JsonReader reader, final EdmProperty property,
      final EntityProviderReadProperties readProperties) throws EntityProviderException {
    try {
      EntityPropertyInfo entityPropertyInfo = EntityInfoAggregator.create(property);
      Map<String, Object> typeMappings = readProperties == null ? null : readProperties.getTypeMappings();
      Map<String, Object> result = new HashMap<String, Object>();

      reader.beginObject();
      String nextName = reader.nextName();
View Full Code Here

Examples of org.apache.olingo.odata2.core.ep.aggregator.EntityPropertyInfo

          throw new EntityProviderException(EntityProviderException.INVALID_ENTITYTYPE.addContent(expectedTypeName)
              .addContent(actualTypeName));
        }
        reader.endObject();
      } else {
        EntityPropertyInfo childPropertyInfo = complexPropertyInfo.getPropertyInfo(childName);
        if (childPropertyInfo == null) {
          throw new EntityProviderException(EntityProviderException.INVALID_PROPERTY.addContent(childName));
        }
        Object childData = readPropertyValue(reader, childPropertyInfo, mapping.get(childName), readProperties);
        if (data.containsKey(childName)) {
View Full Code Here

Examples of org.apache.olingo.odata2.core.ep.aggregator.EntityPropertyInfo

  }

  private void readCustomElement(final XMLStreamReader reader, final String tagName, final EntityInfoAggregator eia,
      final EntityProviderReadProperties readProperties)
      throws EdmException, EntityProviderException, XMLStreamException {
    EntityPropertyInfo targetPathInfo = eia.getTargetPathInfo(tagName);
    NamespaceContext nsctx = reader.getNamespaceContext();

    boolean skipTag = true;
    if (!Edm.NAMESPACE_ATOM_2005.equals(reader.getName().getNamespaceURI())) {

      if (targetPathInfo != null) {
        final String customPrefix = targetPathInfo.getCustomMapping().getFcNsPrefix();
        final String customNamespaceURI = targetPathInfo.getCustomMapping().getFcNsUri();

        if (customPrefix != null && customNamespaceURI != null) {
          String xmlPrefix = nsctx.getPrefix(customNamespaceURI);
          String xmlNamespaceUri = reader.getNamespaceURI(customPrefix);

          if (customNamespaceURI.equals(xmlNamespaceUri) && customPrefix.equals(xmlPrefix)) {
            skipTag = false;
            reader.require(XMLStreamConstants.START_ELEMENT, customNamespaceURI, tagName);
            final String text = reader.getElementText();
            reader.require(XMLStreamConstants.END_ELEMENT, customNamespaceURI, tagName);

            final EntityPropertyInfo propertyInfo = getValidatedPropertyInfo(eia, tagName);
            final Class<?> typeMapping = typeMappings.getMappingClass(propertyInfo.getName());
            final EdmSimpleType type = (EdmSimpleType) propertyInfo.getType();
            final Object value = type.valueOfString(text, EdmLiteralKind.DEFAULT,
                readProperties == null || readProperties.isValidatingFacets() ? propertyInfo.getFacets() : null,
                typeMapping == null ? type.getDefaultType() : typeMapping);
            properties.put(tagName, value);
          }
        }
      } else {
View Full Code Here

Examples of org.apache.olingo.odata2.core.ep.aggregator.EntityPropertyInfo

    } else {
      // inline properties
      checkCurrentHandledStartTag(FormatXml.ATOM_CONTENT);
    }

    EntityPropertyInfo property;
    XmlPropertyConsumer xpc = new XmlPropertyConsumer();

    String closeTag = null;
    boolean run = true;
    reader.next();
View Full Code Here

Examples of org.apache.olingo.odata2.core.ep.aggregator.EntityPropertyInfo

   * @return valid {@link EntityPropertyInfo} (which is never <code>NULL</code>).
   * @throws EntityProviderException
   */
  private EntityPropertyInfo getValidatedPropertyInfo(final EntityInfoAggregator entitySet, final String name)
      throws EntityProviderException {
    EntityPropertyInfo info = entitySet.getPropertyInfo(name);
    if (info == null) {
      throw new EntityProviderException(EntityProviderException.INVALID_PROPERTY.addContent(name));
    }
    return info;
  }
View Full Code Here

Examples of org.apache.olingo.odata2.core.ep.aggregator.EntityPropertyInfo

  }

  public Map<String, Object> readProperty(final XMLStreamReader reader, final EdmProperty property,
      final boolean merge, final Map<String, Object> typeMappings, final EntityProviderReadProperties readProperties)
      throws EntityProviderException {
    EntityPropertyInfo eia = EntityInfoAggregator.create(property);

    try {
      reader.next();

      Object value = readStartedElement(reader, eia, EntityTypeMapping.create(typeMappings), readProperties);

      if (eia.isComplex() && merge) {
        mergeWithDefaultValues(value, eia);
      }

      Map<String, Object> result = new HashMap<String, Object>();
      result.put(eia.getName(), value);
      return result;
    } catch (XMLStreamException e) {
      throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass()
          .getSimpleName()), e);
    } catch (EdmException e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.