Examples of EdmNavigationProperty


Examples of org.apache.olingo.odata2.api.edm.EdmNavigationProperty

    if (eia.getExpandedNavigationPropertyNames().contains(navigationPropertyName)) {
      if (properties.getCallbacks() != null && properties.getCallbacks().containsKey(navigationPropertyName)) {
        writer.writeStartElement(Edm.NAMESPACE_M_2007_08, FormatXml.M_INLINE);

        EdmNavigationProperty navProp = (EdmNavigationProperty) eia.getEntityType().getProperty(navigationPropertyName);
        WriteFeedCallbackContext context = new WriteFeedCallbackContext();
        context.setSourceEntitySet(eia.getEntitySet());
        context.setNavigationProperty(navProp);
        context.setEntryData(data);
        ExpandSelectTreeNode subNode = properties.getExpandSelectTree().getLinks().get(navigationPropertyName);
View Full Code Here

Examples of org.apache.olingo.odata2.api.edm.EdmNavigationProperty

    if (eia.getExpandedNavigationPropertyNames().contains(navigationPropertyName)) {
      if (properties.getCallbacks() != null && properties.getCallbacks().containsKey(navigationPropertyName)) {
        writer.writeStartElement(Edm.NAMESPACE_M_2007_08, FormatXml.M_INLINE);

        EdmNavigationProperty navProp = (EdmNavigationProperty) eia.getEntityType().getProperty(navigationPropertyName);
        WriteEntryCallbackContext context = new WriteEntryCallbackContext();
        context.setSourceEntitySet(eia.getEntitySet());
        context.setNavigationProperty(navProp);
        context.setEntryData(data);
        ExpandSelectTreeNode subNode = properties.getExpandSelectTree().getLinks().get(navigationPropertyName);
View Full Code Here

Examples of org.apache.olingo.odata2.api.edm.EdmNavigationProperty

      final List<String> propertyNames) throws EntityProviderException {
    try {
      Map<String, NavigationPropertyInfo> infos = new HashMap<String, NavigationPropertyInfo>();

      for (String propertyName : propertyNames) {
        EdmNavigationProperty navProperty = (EdmNavigationProperty) type.getProperty(propertyName);
        NavigationPropertyInfo info = NavigationPropertyInfo.create(navProperty);
        infos.put(propertyName, info);
      }

      return infos;
View Full Code Here

Examples of org.apache.olingo.odata2.api.edm.EdmNavigationProperty

      jpaOuterJoinClauses.add(jpaOuterJoinClause);

      for (NavigationSegment navigationSegment : entitySetView.getNavigationSegments()) {

        EdmNavigationProperty navigationProperty = navigationSegment.getNavigationProperty();

        String relationShipAlias = generateRelationShipAlias();

        joinCondition =
            ODataExpressionParser.parseKeyPredicates(navigationSegment.getKeyPredicates(), relationShipAlias);
View Full Code Here

Examples of org.apache.olingo.odata2.api.edm.EdmNavigationProperty

    Map<String, Object> entry = context.getEntryData();
    Map<String, Object> edmPropertyValueMap = null;
    List<EdmNavigationProperty> currentNavPropertyList = null;
    Map<String, ExpandSelectTreeNode> navigationLinks = null;
    JPAEntityParser jpaResultParser = new JPAEntityParser();
    EdmNavigationProperty currentNavigationProperty = context.getNavigationProperty();
    try {
      Object inlinedEntry = entry.get(currentNavigationProperty.getName());
      if (nextEntitySet == null) {
        nextEntitySet = context.getSourceEntitySet().getRelatedEntitySet(currentNavigationProperty);
      }
      edmPropertyValueMap = jpaResultParser.parse2EdmPropertyValueMap(inlinedEntry, nextEntitySet.getEntityType());
      result.setEntryData(edmPropertyValueMap);
      navigationLinks = context.getCurrentExpandSelectTreeNode().getLinks();
      if (navigationLinks.size() > 0) {
        currentNavPropertyList = new ArrayList<EdmNavigationProperty>();
        EdmNavigationProperty nextNavProperty =
            getNextNavigationProperty(context.getSourceEntitySet().getEntityType(), context.getNavigationProperty());
        if (nextNavProperty != null) {
          currentNavPropertyList.add(nextNavProperty);
        }
        HashMap<String, Object> navigationMap =
View Full Code Here

Examples of org.apache.olingo.odata2.api.edm.EdmNavigationProperty

    WriteFeedCallbackResult result = new WriteFeedCallbackResult();
    HashMap<String, Object> inlinedEntry = (HashMap<String, Object>) context.getEntryData();
    List<Map<String, Object>> edmEntityList = new ArrayList<Map<String, Object>>();
    JPAEntityParser jpaResultParser = new JPAEntityParser();
    List<EdmNavigationProperty> currentNavPropertyList = null;
    EdmNavigationProperty currentNavigationProperty = context.getNavigationProperty();
    ExpandSelectTreeNode currentExpandTreeNode = context.getCurrentExpandSelectTreeNode();

    try {
      @SuppressWarnings({ "unchecked" })
      Collection<Object> listOfItems = (Collection<Object>) inlinedEntry.get(context.getNavigationProperty().getName());
      if (nextEntitySet == null) {
        nextEntitySet = context.getSourceEntitySet().getRelatedEntitySet(currentNavigationProperty);
      }
      if (currentExpandTreeNode.getProperties().size() > 0) {
        edmEntityList =
            jpaResultParser.parse2EdmEntityList(listOfItems, getEdmProperties(nextEntitySet,
                currentExpandTreeNode));
      } else {
        edmEntityList = jpaResultParser.parse2EdmEntityList(listOfItems, nextEntitySet.getEntityType());
      }
      result.setFeedData(edmEntityList);

      if (currentExpandTreeNode.getLinks().size() > 0) {
        currentNavPropertyList = new ArrayList<EdmNavigationProperty>();
        EdmNavigationProperty nextNavProperty =
            getNextNavigationProperty(context.getSourceEntitySet().getEntityType(), context.getNavigationProperty());
        if (nextNavProperty != null) {
          currentNavPropertyList.add(nextNavProperty);
        }
        int count = 0;
View Full Code Here

Examples of org.apache.olingo.odata2.api.edm.EdmNavigationProperty

  private EdmNavigationProperty getNextNavigationProperty(final EdmEntityType sourceEntityType,
      final EdmNavigationProperty navigationProperty) throws EdmException {
    for (ArrayList<NavigationPropertySegment> navPropSegments : expandList) {
      int size = navPropSegments.size();
      for (int i = 0; i < size; i++) {
        EdmNavigationProperty navProperty = navPropSegments.get(i).getNavigationProperty();
        if (navProperty.getFromRole().equalsIgnoreCase(sourceEntityType.getName())
            && navProperty.getName().equals(navigationProperty.getName())) {
          if (i < size - 1) {
            return navPropSegments.get(i + 1).getNavigationProperty();
          }
        }
      }
View Full Code Here

Examples of org.odata4j.edm.EdmNavigationProperty

        } else if (propValue instanceof ShortBlob) {
          propValue = ((ShortBlob) propValue).getBytes();
        }
        properties.add(OProperties.simple(propName, (EdmSimpleType<?>) prop.getType(), propValue));
      } else {
        EdmNavigationProperty navProp = eet.findNavigationProperty(propName);
        if (navProp != null) {
          List<OEntity> expandedProps = new ArrayList<OEntity>();
          try {
            if (queryInfo != null && queryInfo.expand != null && queryInfo.expand.size() > 0) {
              for (EntitySimpleProperty esp : queryInfo.expand) {
                if (esp.getPropertyName().equals(propName)) {
                  EdmEntitySet eesNavProp = metadata.getEdmEntitySet(navProp.getToRole().getRole());
                  EdmMultiplicity emNavProp = navProp.getRelationship().getEnd2().getMultiplicity();
                  if (emNavProp == EdmMultiplicity.ZERO_TO_ONE) {
                    Entity e = datastore.get((Key) propValue);
                    expandedProps.add(toOEntity(eesNavProp, e, queryInfo, propName));
                  } else if (emNavProp == EdmMultiplicity.MANY) {
                    @SuppressWarnings("unchecked")
                    Collection<Key> keys = (Collection<Key>) propValue;
                    for (Key key : keys) {
                      Entity e = datastore.get(key);
                      expandedProps.add(toOEntity(eesNavProp, e, queryInfo, propName));
                    }
                  } else {
                    throw new NotImplementedException("Property " + propName + " of type " + propValue.getClass().getName());
                  }
                }
              }
            }
          } catch (EntityNotFoundException e) {
            e.printStackTrace();
          }
          if (expandedProps.size() == 0) {
            links.add(OLinks.relatedEntity(navProp.getRelationship().getName(), propName, null));
          } else {
            links.add(OLinks.relatedEntitiesInline(navProp.getRelationship().getName(), propName, null, expandedProps));
          }
        } else {
          throw new NotImplementedException("Property " + propName + " of type " + propValue.getClass().getName());
        }
      }
View Full Code Here

Examples of org.odata4j.edm.EdmNavigationProperty

        String uri = link.getHref();
        String entitySetName = e.getKind();
        String key = uri.substring(uri.lastIndexOf('('));
        EdmEntitySet ees = metadata.getEdmEntitySet(entitySetName);
        EdmEntityType eet = ees.getType();
        EdmNavigationProperty enp = eet.findNavigationProperty(link.getRelation());
        EdmMultiplicity em = enp.getRelationship().getEnd2().getMultiplicity();
        Entity entity = findEntity(enp.getToRole().getType().getName(), OEntityKey.parse(key));
        if (em == EdmMultiplicity.ZERO_TO_ONE) {
          e.setProperty(link.getRelation(), entity.getKey());
        } else {
          e.setProperty(link.getRelation(), new ArrayList<Key>(Arrays.asList(entity.getKey())));
        }
View Full Code Here

Examples of org.odata4j.edm.EdmNavigationProperty

    // Support for filtering navigation properties by key
    if (propName.contains("/")) {
      propName = propName.substring(0, propName.indexOf("/"));
      EdmEntitySet ees = metadata.getEdmEntitySet(q.getKind());
      EdmEntityType eet = ees.getType();
      EdmNavigationProperty enp = eet.findNavigationProperty(propName);
      long id = Long.parseLong(propValue.toString());
      propValue = KeyFactory.createKey(enp.getToRole().getRole(), id);
    }

    Filter filter = new FilterPredicate(propName, op, propValue);
    q.setFilter(filter);
  }
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.