Package org.apache.olingo.odata2.api.uri

Examples of org.apache.olingo.odata2.api.uri.ExpandSelectTreeNode$ExpandSelectTreeNodeBuilder


    assertEquals(expected, actual);
  }

  @Test
  public void complexProperty() throws Exception {
    final ExpandSelectTreeNode actual = getExpandSelectTree("Location", null);
    assertNotNull(actual);
    assertFalse(actual.isAll());
    assertEquals(Arrays.asList(edm.getEntityType("RefScenario", "Employee").getProperty("Location")),
        actual.getProperties());
    assertTrue(actual.getLinks().isEmpty());
  }
View Full Code Here


    // "links":[]}},{"ne_Team":null},{"ne_Manager":{"all":true,"properties":[],"links":[{"ne_Team":{"all":true,
    // "properties":[],"links":[{"nt_Employees":{"all":true,"properties":[],"links":[]}}]}}]}}]}

    String select = "Age,ne_Room/Seats,ne_Team/Name,ne_Manager/*,ne_Manager/ne_Team,ne_Team";
    String expand = "ne_Room/nr_Building,ne_Manager/ne_Team/nt_Employees,ne_Manager/ne_Room";
    ExpandSelectTreeNode actual = getExpandSelectTree(select, expand);

    assertFalse(actual.isAll());
    assertEquals("Age", actual.getProperties().get(0).getName());
    assertNotNull(actual.getLinks());

    Map<String, ExpandSelectTreeNode> links = actual.getLinks();
    assertEquals(3, links.size());
    for (String navPropertyName : links.keySet()) {
      if ("ne_Room".equals(navPropertyName)) {
        ExpandSelectTreeNode roomNode = links.get(navPropertyName);
        assertFalse(roomNode.isAll());
        assertEquals("Seats", roomNode.getProperties().get(0).getName());
        assertTrue(roomNode.getLinks().isEmpty());
      } else if ("ne_Team".equals(navPropertyName)) {
        assertNull(links.get(navPropertyName));
      } else if ("ne_Manager".equals(navPropertyName)) {
        ExpandSelectTreeNodeImpl managerNode = (ExpandSelectTreeNodeImpl) links.get(navPropertyName);
        String expected =
View Full Code Here

    final UriInfo uriInfo = UriParser.parse(edm, pathSegments, queryParameters);

    ExpandSelectTreeCreator expandSelectTreeCreator =
        new ExpandSelectTreeCreator(uriInfo.getSelect(), uriInfo.getExpand());
    ExpandSelectTreeNode expandSelectTree = expandSelectTreeCreator.create();
    assertNotNull(expandSelectTree);
    return (ExpandSelectTreeNodeImpl) expandSelectTree;
  }
View Full Code Here

        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);
        context.setCurrentExpandSelectTreeNode(subNode);
        context.setSelfLink(new URI(self));

        ODataCallback callback = properties.getCallbacks().get(navigationPropertyName);
        if (callback == null) {
View Full Code Here

        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);
        context.setCurrentExpandSelectTreeNode(subNode);

        ODataCallback callback = properties.getCallbacks().get(navigationPropertyName);
        if (callback == null) {
          throw new EntityProviderException(EntityProviderException.EXPANDNOTSUPPORTED);
View Full Code Here

    if (!appliesFilter(data, uriInfo.getFilter())) {
      throw new ODataNotFoundException(ODataNotFoundException.ENTITY);
    }

    final ExpandSelectTreeNode expandSelectTreeNode =
        UriParser.createExpandSelectTree(uriInfo.getSelect(), uriInfo.getExpand());
    ODataResponse odr =
        ODataResponse.fromResponse(writeEntry(uriInfo.getTargetEntitySet(), expandSelectTreeNode, data, contentType))
            .build();
View Full Code Here

      final String requestContentType, final String contentType) throws ODataException {
    final EdmEntitySet entitySet = uriInfo.getTargetEntitySet();
    final EdmEntityType entityType = entitySet.getEntityType();

    Object data = dataSource.newDataObject(entitySet);
    ExpandSelectTreeNode expandSelectTree = null;

    if (entityType.hasStream()) {
      dataSource.createData(entitySet, data);
      dataSource.writeBinaryData(entitySet, data,
          new BinaryData(EntityProvider.readBinary(content), requestContentType));
View Full Code Here

            + "$skiptoken=" + odataJPAContext.getPaging().getNextPage();
        entityFeedPropertiesBuilder.nextLink(nextLink);
      }
      entityFeedPropertiesBuilder.inlineCount(count);
      entityFeedPropertiesBuilder.inlineCountType(resultsView.getInlineCount());
      ExpandSelectTreeNode expandSelectTree =
          UriParser.createExpandSelectTree(resultsView.getSelect(), resultsView.getExpand());
      entityFeedPropertiesBuilder.callbacks(JPAExpandCallBack.getCallbacks(context
          .getPathInfo().getServiceRoot(), expandSelectTree, resultsView.getExpand()));
      entityFeedPropertiesBuilder.expandSelectTree(expandSelectTree);
View Full Code Here

  }

  private static EntityProviderWriteProperties getEntityProviderProperties(final ODataJPAContext odataJPAContext,
      final GetEntityUriInfo resultsView) throws ODataJPARuntimeException {
    ODataEntityProviderPropertiesBuilder entityFeedPropertiesBuilder = null;
    ExpandSelectTreeNode expandSelectTree = null;
    try {
      entityFeedPropertiesBuilder =
          EntityProviderWriteProperties.serviceRoot(odataJPAContext.getODataContext().getPathInfo().getServiceRoot());
      expandSelectTree = UriParser.createExpandSelectTree(resultsView.getSelect(), resultsView.getExpand());
      entityFeedPropertiesBuilder.expandSelectTree(expandSelectTree);
View Full Code Here

  public void readAtomEntry() throws IOException, XpathException, SAXException, XMLStreamException,
      FactoryConfigurationError, ODataException {
    long t = startTimer();

    for (int i = 0; i < TIMES; i++) {
      ExpandSelectTreeNode epProperties = null;
      EntityInfoAggregator eia = EntityInfoAggregator.create(edmEntitySet, epProperties);
      provider.append(writer, eia, roomData, false, false);
    }
    stopTimer(t, "readAtomEntry");
  }
View Full Code Here

TOP

Related Classes of org.apache.olingo.odata2.api.uri.ExpandSelectTreeNode$ExpandSelectTreeNodeBuilder

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.