Package org.apache.olingo.odata2.jpa.processor.api.jpql

Examples of org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContext


        // is it a referenced entity?
        if (resourcePath.startsWith("$")) {
            resourcePath = replaceContentId(edm, resourcePath, contentIdMap);
        }

        final UriInfoImpl uriInfo = parseUri(edm, resourcePath, null);

        // serialize data into ODataResponse object, if set in request and this is not a DELETE request
        final Map<String, String> headers = new HashMap<String, String>();
        byte[] body = null;
View Full Code Here


            resolvedResourcePath = resourceLocation != null
                ? resourceLocation.substring(serviceUri.length()) : resourcePath;
        }
        final Map<String, String> resolvedQueryParams = request instanceof Olingo2BatchQueryRequest
            ? ((Olingo2BatchQueryRequest) request).getQueryParams() : null;
        final UriInfoImpl uriInfo = parseUri(edm, resolvedResourcePath, resolvedQueryParams);

        // resolve response content
        final Object resolvedContent = content != null ? readContent(uriInfo, content) : null;

        return new Olingo2BatchResponse(statusCode, statusInfo, response.getContentId(), response.getHeaders(),
View Full Code Here

        }
        return absolutUri.toString();
    }

    private static UriInfoImpl parseUri(Edm edm, String resourcePath, Map<String, String> queryParams) {
        UriInfoImpl result;
        try {
            final List<PathSegment> pathSegments = new ArrayList<PathSegment>();
            final String[] segments = new URI(resourcePath).getPath().split(SEPARATOR);
            if (queryParams == null) {
                queryParams = Collections.emptyMap();
View Full Code Here

        contextType = JPQLContextType.JOIN;
      } else {
        contextType = JPQLContextType.SELECT;
      }

      JPQLContext jpqlContext = JPQLContext.createBuilder(contextType, resultsView).build();
      JPQLStatement jpqlStatement = JPQLStatement.createBuilder(jpqlContext).build();
      String deltaToken = ODataJPATombstoneContext.getDeltaToken();

      Query query = null;
      if (deltaToken != null) {
        String statement = jpqlStatement.toString();
        String[] statementParts = statement.split(JPQLStatement.KEYWORD.WHERE);
        String deltaCondition = jpqlContext.getJPAEntityAlias() + ".creationDate >= {ts '" + deltaToken + "'}";
        if (statementParts.length > 1) {
          statement =
              statementParts[0] + JPQLStatement.DELIMITER.SPACE + JPQLStatement.KEYWORD.WHERE
                  + JPQLStatement.DELIMITER.SPACE + deltaCondition + JPQLStatement.DELIMITER.SPACE
                  + JPQLStatement.Operator.AND + statementParts[1];
View Full Code Here

        contextType = JPQLContextType.JOIN;
      } else {
        contextType = JPQLContextType.SELECT;
      }

      JPQLContext jpqlContext = null;

      if (oDataJPAContext.getPageSize() > 0) {
        jpqlContext = JPQLContext.createBuilder(contextType,
            uriParserResultView, true).build();
      } else {
View Full Code Here

    } catch (EdmException e) {
      ODataJPARuntimeException.throwException(
          ODataJPARuntimeException.GENERAL, e);
    }

    JPQLContext jpqlContext = JPQLContext.createBuilder(contextType,
        resultsView).build();

    JPQLStatement jpqlStatement = JPQLStatement.createBuilder(jpqlContext)
        .build();
    Query query = null;
View Full Code Here

    } catch (EdmException e) {
      ODataJPARuntimeException.throwException(
          ODataJPARuntimeException.GENERAL, e);
    }

    JPQLContext jpqlContext = JPQLContext.createBuilder(contextType,
        resultsView).build();

    JPQLStatement jpqlStatement = JPQLStatement.createBuilder(jpqlContext)
        .build();
    Query query = null;
View Full Code Here

    Object selectedObject = null;

    if (uriParserResultView instanceof DeleteUriInfo || uriParserResultView instanceof GetEntityUriInfo
        || uriParserResultView instanceof PutMergePatchUriInfo) {

      JPQLContext selectJPQLContext = JPQLContext.createBuilder(
          contextType, uriParserResultView).build();

      JPQLStatement selectJPQLStatement = JPQLStatement.createBuilder(
          selectJPQLContext).build();
      Query query = null;
View Full Code Here

  public void testGetStatementBuilderFactoryforSelect() throws ODataException {

    GetEntitySetUriInfo getEntitySetView = getUriInfo();

    // Build JPQL Context
    JPQLContext selectContext = JPQLContext.createBuilder(JPQLContextType.SELECT, getEntitySetView).build();
    JPQLStatementBuilder statementBuilder =
        new ODataJPAFactoryImpl().getJPQLBuilderFactory().getStatementBuilder(selectContext);

    assertTrue(statementBuilder instanceof JPQLSelectStatementBuilder);
View Full Code Here

  public void testGetStatementBuilderFactoryforSelectSingle() throws ODataException {

    GetEntityUriInfo getEntityView = getEntityUriInfo();

    // Build JPQL Context
    JPQLContext selectContext = JPQLContext.createBuilder(JPQLContextType.SELECT_SINGLE, getEntityView).build();
    JPQLStatementBuilder statementBuilder =
        new ODataJPAFactoryImpl().getJPQLBuilderFactory().getStatementBuilder(selectContext);

    assertTrue(statementBuilder instanceof JPQLSelectSingleStatementBuilder);
View Full Code Here

TOP

Related Classes of org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContext

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.