Examples of JPAJoinClause


Examples of org.apache.olingo.odata2.jpa.processor.api.access.JPAJoinClause

      try {
        setType(JPQLContextType.JOIN_SINGLE);
        setJPAJoinClause(generateJoinClauses());

        if (!jpaJoinClauses.isEmpty()) {
          JPAJoinClause joinClause = jpaJoinClauses.get(jpaJoinClauses.size() - 1);
          setJPAEntityName(joinClause.getEntityName());
          setJPAEntityAlias(joinClause.getEntityRelationShipAlias());
        }

        setKeyPredicates(entityView.getKeyPredicates());

        setSelectExpression(generateSelectExpression());
View Full Code Here

Examples of org.apache.olingo.odata2.jpa.processor.api.access.JPAJoinClause

    }

    protected List<JPAJoinClause> generateJoinClauses() throws ODataJPARuntimeException, EdmException {

      List<JPAJoinClause> jpaOuterJoinClauses = new ArrayList<JPAJoinClause>();
      JPAJoinClause jpaOuterJoinClause = null;
      String joinCondition = null;
      String entityAlias = generateJPAEntityAlias();
      joinCondition = ODataExpressionParser.parseKeyPredicates(entityView.getKeyPredicates(), entityAlias);

      EdmEntityType entityType = entityView.getStartEntitySet().getEntityType();
      Mapping mapping = (Mapping) entityType.getMapping();
      String entityTypeName = null;
      if (mapping != null) {
        entityTypeName = mapping.getInternalName();
      } else {
        entityTypeName = entityType.getName();
      }

      jpaOuterJoinClause =
          new JPAJoinClause(entityTypeName, entityAlias, null, null, joinCondition, JPAJoinClause.JOIN.INNER);

      jpaOuterJoinClauses.add(jpaOuterJoinClause);

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

        EdmNavigationProperty navigationProperty = navigationSegment.getNavigationProperty();

        String relationShipAlias = generateRelationShipAlias();

        joinCondition =
            ODataExpressionParser.parseKeyPredicates(navigationSegment.getKeyPredicates(), relationShipAlias);

        jpaOuterJoinClause =
            new JPAJoinClause(getFromEntityName(navigationProperty), entityAlias,
                getRelationShipName(navigationProperty), relationShipAlias, joinCondition, JPAJoinClause.JOIN.INNER);

        jpaOuterJoinClauses.add(jpaOuterJoinClause);

      }
View Full Code Here

Examples of org.apache.olingo.odata2.jpa.processor.api.access.JPAJoinClause

    jpqlQuery.append(context.getSelectExpression()).append(JPQLStatement.DELIMITER.SPACE);
    jpqlQuery.append(JPQLStatement.KEYWORD.FROM).append(JPQLStatement.DELIMITER.SPACE);

    if (context.getJPAJoinClauses() != null && context.getJPAJoinClauses().size() > 0) {
      List<JPAJoinClause> joinClauseList = context.getJPAJoinClauses();
      JPAJoinClause joinClause = joinClauseList.get(0);
      String joinCondition = joinClause.getJoinCondition();
      joinWhereCondition = new StringBuilder();
      if (joinCondition != null) {
        joinWhereCondition.append(joinCondition);
      }
      String relationShipAlias = null;
      joinClause = joinClauseList.get(1);
      jpqlQuery.append(joinClause.getEntityName()).append(JPQLStatement.DELIMITER.SPACE);
      jpqlQuery.append(joinClause.getEntityAlias());

      int i = 1;
      int limit = joinClauseList.size();
      relationShipAlias = joinClause.getEntityAlias();
      while (i < limit) {
        jpqlQuery.append(JPQLStatement.DELIMITER.SPACE);
        jpqlQuery.append(JPQLStatement.KEYWORD.JOIN).append(JPQLStatement.DELIMITER.SPACE);

        joinClause = joinClauseList.get(i);
        jpqlQuery.append(relationShipAlias).append(JPQLStatement.DELIMITER.PERIOD);
        jpqlQuery.append(joinClause.getEntityRelationShip()).append(JPQLStatement.DELIMITER.SPACE);
        jpqlQuery.append(joinClause.getEntityRelationShipAlias());

        relationShipAlias = joinClause.getEntityRelationShipAlias();
        i++;

        joinCondition = joinClause.getJoinCondition();
        if (joinCondition != null) {
          joinWhereCondition.append(JPQLStatement.DELIMITER.SPACE + JPQLStatement.Operator.AND
              + JPQLStatement.DELIMITER.SPACE);

          joinWhereCondition.append(joinCondition);
View Full Code Here

Examples of org.apache.olingo.odata2.jpa.processor.api.access.JPAJoinClause

    EasyMock.replay(context);
  }

  private List<JPAJoinClause> getJoinClauseList() {
    List<JPAJoinClause> joinClauseList = new ArrayList<JPAJoinClause>();
    JPAJoinClause jpaOuterJoinClause =
        new JPAJoinClause("SOHeader", "soh", null, null, "soh.createdBy = 'Peter'", JPAJoinClause.JOIN.LEFT);
    joinClauseList.add(jpaOuterJoinClause);
    jpaOuterJoinClause =
        new JPAJoinClause("SOHeader", "soh", "soItem", "soi", "soi.shId = soh.soId", JPAJoinClause.JOIN.LEFT);
    joinClauseList.add(jpaOuterJoinClause);
    jpaOuterJoinClause =
        new JPAJoinClause("SOItem", "si", "material", "mat", "mat.id = 'abc'", JPAJoinClause.JOIN.LEFT);
    joinClauseList.add(jpaOuterJoinClause);
    return joinClauseList;
  }
View Full Code Here

Examples of org.apache.olingo.odata2.jpa.processor.api.access.JPAJoinClause

        }

        setJPAOuterJoinClause(generateJoinClauses());

        if (!jpaJoinClauses.isEmpty()) {
          JPAJoinClause joinClause = jpaJoinClauses.get(jpaJoinClauses.size() - 1);
          setJPAEntityName(joinClause.getEntityName());
          setJPAEntityAlias(joinClause.getEntityRelationShipAlias());
        }

        setOrderByCollection(generateOrderByFileds());

        setSelectExpression(generateSelectExpression());
View Full Code Here

Examples of org.apache.olingo.odata2.jpa.processor.api.access.JPAJoinClause

    }

    protected List<JPAJoinClause> generateJoinClauses() throws ODataJPARuntimeException, EdmException {

      List<JPAJoinClause> jpaOuterJoinClauses = new ArrayList<JPAJoinClause>();
      JPAJoinClause jpaOuterJoinClause = null;
      String joinCondition = null;
      String entityAlias = generateJPAEntityAlias();
      joinCondition = ODataExpressionParser.parseKeyPredicates(entitySetView.getKeyPredicates(), entityAlias);

      EdmEntityType entityType = entitySetView.getStartEntitySet().getEntityType();
      Mapping mapping = (Mapping) entityType.getMapping();
      String entityTypeName = null;
      if (mapping != null) {
        entityTypeName = mapping.getInternalName();
      } else {
        entityTypeName = entityType.getName();
      }

      jpaOuterJoinClause =
          new JPAJoinClause(entityTypeName, entityAlias, null, null, joinCondition, JPAJoinClause.JOIN.INNER);

      jpaOuterJoinClauses.add(jpaOuterJoinClause);

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

        EdmNavigationProperty navigationProperty = navigationSegment.getNavigationProperty();

        String relationShipAlias = generateRelationShipAlias();

        joinCondition =
            ODataExpressionParser.parseKeyPredicates(navigationSegment.getKeyPredicates(), relationShipAlias);

        jpaOuterJoinClause =
            new JPAJoinClause(getFromEntityName(navigationProperty), entityAlias,
                getRelationShipName(navigationProperty), relationShipAlias, joinCondition, JPAJoinClause.JOIN.INNER);

        jpaOuterJoinClauses.add(jpaOuterJoinClause);

      }
View Full Code Here

Examples of org.apache.olingo.odata2.jpa.processor.api.access.JPAJoinClause

    jpqlQuery.append(JPQLStatement.KEYWORD.FROM).append(JPQLStatement.DELIMITER.SPACE);

    if (context.getJPAJoinClauses() != null && context.getJPAJoinClauses().size() > 0) {
      List<JPAJoinClause> joinClauseList = context.getJPAJoinClauses();
      JPAJoinClause joinClause = joinClauseList.get(0);
      String joinCondition = joinClause.getJoinCondition();
      joinWhereCondition = new StringBuilder();
      if (joinCondition != null) {
        joinWhereCondition.append(joinCondition);
      }
      String relationShipAlias = null;
      joinClause = joinClauseList.get(1);
      jpqlQuery.append(joinClause.getEntityName()).append(JPQLStatement.DELIMITER.SPACE);
      jpqlQuery.append(joinClause.getEntityAlias());

      int i = 1;
      int limit = joinClauseList.size();
      relationShipAlias = joinClause.getEntityAlias();
      while (i < limit) {
        jpqlQuery.append(JPQLStatement.DELIMITER.SPACE);
        jpqlQuery.append(JPQLStatement.KEYWORD.JOIN).append(JPQLStatement.DELIMITER.SPACE);

        joinClause = joinClauseList.get(i);
        jpqlQuery.append(relationShipAlias).append(JPQLStatement.DELIMITER.PERIOD);
        jpqlQuery.append(joinClause.getEntityRelationShip()).append(JPQLStatement.DELIMITER.SPACE);
        jpqlQuery.append(joinClause.getEntityRelationShipAlias());

        relationShipAlias = joinClause.getEntityRelationShipAlias();
        i++;

        joinCondition = joinClause.getJoinCondition();
        if (joinCondition != null) {
          joinWhereCondition.append(JPQLStatement.DELIMITER.SPACE + JPQLStatement.Operator.AND
              + JPQLStatement.DELIMITER.SPACE);

          joinWhereCondition.append(joinCondition);
View Full Code Here

Examples of org.apache.olingo.odata2.jpa.processor.api.access.JPAJoinClause

    EasyMock.replay(context);
  }

  private List<JPAJoinClause> getJoinClauseList() {
    List<JPAJoinClause> joinClauseList = new ArrayList<JPAJoinClause>();
    JPAJoinClause jpaOuterJoinClause =
        new JPAJoinClause("SOHeader", "soh", null, null, "soh.soId = 1", JPAJoinClause.JOIN.LEFT);
    joinClauseList.add(jpaOuterJoinClause);
    jpaOuterJoinClause =
        new JPAJoinClause("SOHeader", "soh", "soItem", "soi", "soi.shId = soh.soId", JPAJoinClause.JOIN.LEFT);
    joinClauseList.add(jpaOuterJoinClause);
    jpaOuterJoinClause =
        new JPAJoinClause("SOItem", "si", "material", "mat", "mat.id = 'abc'", JPAJoinClause.JOIN.LEFT);
    joinClauseList.add(jpaOuterJoinClause);
    return joinClauseList;
  }
View Full Code Here

Examples of org.apache.olingo.odata2.jpa.processor.api.access.JPAJoinClause

        }

        setJPAOuterJoinClause(generateJoinClauses());

        if (!jpaJoinClauses.isEmpty()) {
          JPAJoinClause joinClause = jpaJoinClauses.get(jpaJoinClauses.size() - 1);
          setJPAEntityName(joinClause.getEntityName());
          setJPAEntityAlias(joinClause.getEntityRelationShipAlias());
        }

        setOrderByCollection(generateOrderByFileds());

        setSelectExpression(generateSelectExpression());
View Full Code Here

Examples of org.apache.olingo.odata2.jpa.processor.api.access.JPAJoinClause

    }

    protected List<JPAJoinClause> generateJoinClauses() throws ODataJPARuntimeException, EdmException {

      List<JPAJoinClause> jpaOuterJoinClauses = new ArrayList<JPAJoinClause>();
      JPAJoinClause jpaOuterJoinClause = null;
      String joinCondition = null;
      String entityAlias = generateJPAEntityAlias();
      joinCondition = ODataExpressionParser.parseKeyPredicates(entitySetView.getKeyPredicates(), entityAlias);

      EdmEntityType entityType = entitySetView.getStartEntitySet().getEntityType();
      Mapping mapping = (Mapping) entityType.getMapping();
      String entityTypeName = null;
      if (mapping != null) {
        entityTypeName = mapping.getInternalName();
      } else {
        entityTypeName = entityType.getName();
      }

      jpaOuterJoinClause =
          new JPAJoinClause(entityTypeName, entityAlias, null, null, joinCondition, JPAJoinClause.JOIN.INNER);

      jpaOuterJoinClauses.add(jpaOuterJoinClause);

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

        EdmNavigationProperty navigationProperty = navigationSegment.getNavigationProperty();

        String relationShipAlias = generateRelationShipAlias();

        joinCondition =
            ODataExpressionParser.parseKeyPredicates(navigationSegment.getKeyPredicates(), relationShipAlias);

        jpaOuterJoinClause =
            new JPAJoinClause(getFromEntityName(navigationProperty), entityAlias,
                getRelationShipName(navigationProperty), relationShipAlias, joinCondition, JPAJoinClause.JOIN.INNER);

        jpaOuterJoinClauses.add(jpaOuterJoinClause);

      }
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.