Examples of ODataEntityProviderPropertiesBuilder


Examples of org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties.ODataEntityProviderPropertiesBuilder

  }

  private EntityProviderWriteProperties getInlineEntityProviderProperties(final WriteCallbackContext context)
      throws EdmException {
    ODataEntityProviderPropertiesBuilder propertiesBuilder = EntityProviderWriteProperties.serviceRoot(baseUri);
    propertiesBuilder.callbacks(getCallbacks(baseUri, context.getCurrentExpandSelectTreeNode(), expandList));
    propertiesBuilder.expandSelectTree(context.getCurrentExpandSelectTreeNode());
    return propertiesBuilder.build();
  }
View Full Code Here

Examples of org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties.ODataEntityProviderPropertiesBuilder

   * be registered here
   */
  private static EntityProviderWriteProperties getEntityProviderProperties(final ODataJPAContext odataJPAContext,
      final GetEntitySetUriInfo resultsView, final List<Map<String, Object>> edmEntityList)
      throws ODataJPARuntimeException {
    ODataEntityProviderPropertiesBuilder entityFeedPropertiesBuilder = null;
    ODataContext context = odataJPAContext.getODataContext();

    Integer count = null;
    if (resultsView.getInlineCount() != null) {
      if ((resultsView.getSkip() != null || resultsView.getTop() != null)) {
        // when $skip and/or $top is present with $inlinecount
        count = getInlineCountForNonFilterQueryEntitySet(edmEntityList, resultsView);
      } else {
        // In all other cases
        count = resultsView.getInlineCount() == InlineCount.ALLPAGES ? edmEntityList.size() : null;
      }
    }

    try {
      PathInfo pathInfo = context.getPathInfo();
      URI serviceRoot = pathInfo.getServiceRoot();

      entityFeedPropertiesBuilder =
          EntityProviderWriteProperties.serviceRoot(pathInfo.getServiceRoot());
      JPAPaging paging = odataJPAContext.getPaging();
      if (odataJPAContext.getPageSize() > 0 && paging != null && paging.getNextPage() > 0) {
        String nextLink =
            serviceRoot.relativize(pathInfo.getRequestUri()).toString();
        nextLink = percentEncodeNextLink(nextLink);
        nextLink += (nextLink.contains("?") ? "&" : "?")
            + "$skiptoken=" + odataJPAContext.getPaging().getNextPage();
        entityFeedPropertiesBuilder.nextLink(nextLink);
      }
      entityFeedPropertiesBuilder.inlineCount(count);
      entityFeedPropertiesBuilder.inlineCountType(resultsView.getInlineCount());
      ExpandSelectTreeNode expandSelectTree =
          UriParser.createExpandSelectTree(resultsView.getSelect(), resultsView.getExpand());

      Map<String, ODataCallback> expandCallBack =
          JPAExpandCallBack.getCallbacks(serviceRoot, expandSelectTree, resultsView.getExpand());

      Map<String, ODataCallback> callBackMap = new HashMap<String, ODataCallback>();
      callBackMap.putAll(expandCallBack);

      String deltaToken = ODataJPATombstoneContext.getDeltaToken();
      if (deltaToken != null) {
        callBackMap.put(TombstoneCallback.CALLBACK_KEY_TOMBSTONE, new JPATombstoneCallBack(serviceRoot.toString(),
            resultsView, deltaToken));
      }

      entityFeedPropertiesBuilder.callbacks(callBackMap);
      entityFeedPropertiesBuilder.expandSelectTree(expandSelectTree);

    } catch (ODataException e) {
      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
    }

    return entityFeedPropertiesBuilder.build();
  }
View Full Code Here

Examples of org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties.ODataEntityProviderPropertiesBuilder

    return count;
  }

  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);
      entityFeedPropertiesBuilder.callbacks(JPAExpandCallBack.getCallbacks(odataJPAContext.getODataContext()
          .getPathInfo().getServiceRoot(), expandSelectTree, resultsView.getExpand()));
    } catch (ODataException e) {
      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
    }

    return entityFeedPropertiesBuilder.build();
  }
View Full Code Here

Examples of org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties.ODataEntityProviderPropertiesBuilder

    return entityFeedPropertiesBuilder.build();
  }

  private static EntityProviderWriteProperties getEntityProviderPropertiesforPost(
      final ODataJPAContext odataJPAContext, final PostUriInfo resultsView) throws ODataJPARuntimeException {
    ODataEntityProviderPropertiesBuilder entityFeedPropertiesBuilder = null;
    try {
      entityFeedPropertiesBuilder =
          EntityProviderWriteProperties.serviceRoot(odataJPAContext.getODataContext().getPathInfo().getServiceRoot());
    } catch (ODataException e) {
      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
    }

    return entityFeedPropertiesBuilder.build();
  }
View Full Code Here

Examples of org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties.ODataEntityProviderPropertiesBuilder

        int id = getKeyValue(uriInfo.getKeyPredicates().get(0));
        Map<String, Object> data = dataStore.getCar(id);

        if (data != null) {
          URI serviceRoot = getContext().getPathInfo().getServiceRoot();
          ODataEntityProviderPropertiesBuilder propertiesBuilder =
              EntityProviderWriteProperties.serviceRoot(serviceRoot);

          return EntityProvider.writeEntry(contentType, entitySet, data, propertiesBuilder.build());
        }
      } else if (ENTITY_SET_NAME_MANUFACTURERS.equals(entitySet.getName())) {
        int id = getKeyValue(uriInfo.getKeyPredicates().get(0));
        Map<String, Object> data = dataStore.getManufacturer(id);

        if (data != null) {
          URI serviceRoot = getContext().getPathInfo().getServiceRoot();
          ODataEntityProviderPropertiesBuilder propertiesBuilder =
              EntityProviderWriteProperties.serviceRoot(serviceRoot);

          return EntityProvider.writeEntry(contentType, entitySet, data, propertiesBuilder.build());
        }
      }

      throw new ODataNotFoundException(ODataNotFoundException.ENTITY);
View Full Code Here

Examples of org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties.ODataEntityProviderPropertiesBuilder

  }

  private EntityProviderWriteProperties getInlineEntityProviderProperties(final WriteCallbackContext context)
      throws EdmException {
    ODataEntityProviderPropertiesBuilder propertiesBuilder = EntityProviderWriteProperties.serviceRoot(baseUri);
    propertiesBuilder.callbacks(getCallbacks(baseUri, context.getCurrentExpandSelectTreeNode(), expandList));
    propertiesBuilder.expandSelectTree(context.getCurrentExpandSelectTreeNode());
    return propertiesBuilder.build();
  }
View Full Code Here

Examples of org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties.ODataEntityProviderPropertiesBuilder

   * be registered here
   */
  private static EntityProviderWriteProperties getEntityProviderProperties(final ODataJPAContext odataJPAContext,
      final GetEntitySetUriInfo resultsView, final List<Map<String, Object>> edmEntityList)
      throws ODataJPARuntimeException {
    ODataEntityProviderPropertiesBuilder entityFeedPropertiesBuilder = null;
    ODataContext context = odataJPAContext.getODataContext();

    Integer count = null;
    if (resultsView.getInlineCount() != null) {
      if ((resultsView.getSkip() != null || resultsView.getTop() != null)) {
        // when $skip and/or $top is present with $inlinecount
        count = getInlineCountForNonFilterQueryEntitySet(edmEntityList, resultsView);
      } else {
        // In all other cases
        count = resultsView.getInlineCount() == InlineCount.ALLPAGES ? edmEntityList.size() : null;
      }
    }

    try {
      PathInfo pathInfo = context.getPathInfo();
      entityFeedPropertiesBuilder =
          EntityProviderWriteProperties.serviceRoot(pathInfo.getServiceRoot());
      JPAPaging paging = odataJPAContext.getPaging();
      if (odataJPAContext.getPageSize() > 0 && paging != null && paging.getNextPage() > 0) {
        String nextLink =
            pathInfo.getServiceRoot().relativize(context.getPathInfo().getRequestUri()).toString();
        nextLink = percentEncodeNextLink(nextLink);
        nextLink += (nextLink.contains("?") ? "&" : "?")
            + "$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);

    } catch (ODataException e) {
      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
    }

    return entityFeedPropertiesBuilder.build();
  }
View Full Code Here

Examples of org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties.ODataEntityProviderPropertiesBuilder

    return count;
  }

  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);
      entityFeedPropertiesBuilder.callbacks(JPAExpandCallBack.getCallbacks(odataJPAContext.getODataContext()
          .getPathInfo().getServiceRoot(), expandSelectTree, resultsView.getExpand()));
    } catch (ODataException e) {
      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
    }

    return entityFeedPropertiesBuilder.build();
  }
View Full Code Here

Examples of org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties.ODataEntityProviderPropertiesBuilder

    return entityFeedPropertiesBuilder.build();
  }

  private static EntityProviderWriteProperties getEntityProviderPropertiesforPost(
      final ODataJPAContext odataJPAContext, final PostUriInfo resultsView) throws ODataJPARuntimeException {
    ODataEntityProviderPropertiesBuilder entityFeedPropertiesBuilder = null;
    try {
      entityFeedPropertiesBuilder =
          EntityProviderWriteProperties.serviceRoot(odataJPAContext.getODataContext().getPathInfo().getServiceRoot());
    } catch (ODataException e) {
      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
    }

    return entityFeedPropertiesBuilder.build();
  }
View Full Code Here

Examples of org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties.ODataEntityProviderPropertiesBuilder

   * be registered here
   */
  private static EntityProviderWriteProperties getEntityProviderProperties(final ODataJPAContext odataJPAContext,
      final GetEntitySetUriInfo resultsView, final List<Map<String, Object>> edmEntityList)
      throws ODataJPARuntimeException {
    ODataEntityProviderPropertiesBuilder entityFeedPropertiesBuilder = null;

    Integer count = null;
    if (resultsView.getInlineCount() != null) {
      if ((resultsView.getSkip() != null || resultsView.getTop() != null)) {
        // when $skip and/or $top is present with $inlinecount
        count = getInlineCountForNonFilterQueryEntitySet(edmEntityList, resultsView);
      } else {
        // In all other cases
        count = resultsView.getInlineCount() == InlineCount.ALLPAGES ? edmEntityList.size() : null;
      }
    }

    try {
      entityFeedPropertiesBuilder =
          EntityProviderWriteProperties.serviceRoot(odataJPAContext.getODataContext().getPathInfo().getServiceRoot());
      entityFeedPropertiesBuilder.inlineCount(count);
      entityFeedPropertiesBuilder.inlineCountType(resultsView.getInlineCount());
      ExpandSelectTreeNode expandSelectTree =
          UriParser.createExpandSelectTree(resultsView.getSelect(), resultsView.getExpand());
      entityFeedPropertiesBuilder.callbacks(JPAExpandCallBack.getCallbacks(odataJPAContext.getODataContext()
          .getPathInfo().getServiceRoot(), expandSelectTree, resultsView.getExpand()));
      entityFeedPropertiesBuilder.expandSelectTree(expandSelectTree);

    } catch (ODataException e) {
      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
    }

    return entityFeedPropertiesBuilder.build();
  }
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.