You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@olingo.apache.org by "Michael Bolz (JIRA)" <ji...@apache.org> on 2015/07/29 12:27:05 UTC

[jira] [Commented] (OLINGO-741) UriParser unable to determine correct UriResource type when NavigationProperty has same name as an EntitySet

    [ https://issues.apache.org/jira/browse/OLINGO-741?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14645841#comment-14645841 ] 

Michael Bolz commented on OLINGO-741:
-------------------------------------

Issue could be related to method {{Object visitExpandPath(final ExpandPathContext ctx)}}.

Change method as follows could fix this:
{code}
  @Override
  public Object visitExpandPath(final ExpandPathContext ctx) {
    ExpandItemImpl expandItem = new ExpandItemImpl();

    // UriResourceItImpl pathInfoIT = new UriResourceItImpl();
    UriResource lastPart = context.contextUriInfo.getLastResourcePart();

    // save context
    ExpandItemImpl contextExpandItemPathBU = context.contextExpandItemPath;
    UriInfoImpl uriInfoResourceBU = context.contextUriInfo;

    // set tmp context
    context.contextExpandItemPath = expandItem;
    context.contextUriInfo = new UriInfoImpl().setKind(UriInfoKind.resource);
    // contextUriInfo.addPathInfo(pathInfoIT);
    context.contextUriInfo.addResourcePart((UriResourceImpl) lastPart);

    super.visitExpandPath(ctx);

    if(context.contextUriInfo.getUriResourceParts().get(0) == lastPart) {
      context.contextUriInfo.removeResourcePart(0);
    }

    EdmType startType = removeUriResourceStartingTypeFilterImpl(context.contextUriInfo);
    expandItem.setResourcePath(context.contextUriInfo);
    if (startType != null) {
      expandItem.setTypeFilter(startType);
    }

    // reset context
    context.contextUriInfo = uriInfoResourceBU;
    context.contextExpandItemPath = contextExpandItemPathBU;

    return expandItem;
  }
{code}

> UriParser unable to determine correct UriResource type when NavigationProperty has same name as an EntitySet
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: OLINGO-741
>                 URL: https://issues.apache.org/jira/browse/OLINGO-741
>             Project: Olingo
>          Issue Type: Bug
>          Components: odata4-server
>    Affects Versions: (Java) V4 4.0.0-beta-03
>            Reporter: Michael Bolz
>            Assignee: Michael Bolz
>
> UriParser unable to determine correct UriResource type when NavigationProperty has same name as an EntitySet.
> Example can be found in Tutorial Part 6 ({{p6_queryoptions-es}}) in Git Commit: [\[OLINGO-713\] Added tutorial project for system query options - expand/select|https://git1-us-west.apache.org/repos/asf?p=olingo-odata4.git;a=commit;h=b477bde07b190717b0e6ef443efcef1ca1b3d57e].
> Just start sample and navigate to {{http://localhost:8080/DemoService.svc/Categories(1)/?$expand=Products}}.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)