public JPALambdaOperation(final JPAFilterComplierAccess jpaComplier, final Member member) { super(jpaComplier); this.member = member.getResourcePath(); }
public UriInfoResource getMember() { return member.getResourcePath(); }
@Override public void visit(Member expr) { // this is seg way into RequestURLHierarchyVisitor based parsing visit(expr.getResourcePath()); }
@Override public Expr visitMember(Member member) throws ExpressionVisitException { return visitMember(member.getResourcePath()); }
@Override public List<UriResource> getUriResourceParts() { final List<UriResource> result = new ArrayList<>(); final List<UriResource> source = parentMember.getMember().getResourcePath().getUriResourceParts(); for (int i = source.size() - 1; i > 0; i--) { if (source.get(i).getKind() == UriResourceKind.navigationProperty || source.get(i).getKind() == UriResourceKind.entitySet || (source.get(i) instanceof UriResourceProperty && ((UriResourceProperty) source.get(i)).isCollection())) { break; } result.add(0, source.get(i)); } return result; }
boolean hasNavigation(final JPAOperator operand) { if (operand instanceof JPAMemberOperator) { final List<UriResource> uriResourceParts = ((JPAMemberOperator) operand).getMember().getResourcePath() .getUriResourceParts(); for (int i = uriResourceParts.size() - 1; i >= 0; i--) { if (uriResourceParts.get(i) instanceof UriResourceNavigation || (uriResourceParts.get(i) instanceof UriResourceProperty && ((UriResourceProperty) uriResourceParts.get(i)).isCollection())) return true; } } return false; }
@Override public Object visitMember(Member member) throws ExpressionVisitException, ODataApplicationException { List<UriResource> uriPartsWithinLambda = member.getResourcePath().getUriResourceParts(); String propertyPath = uriPartsWithinLambda.get(1).getSegmentValue(); if(uriPartsWithinLambda.size() > 2){ List<UriResource> restOfUri = uriPartsWithinLambda.subList(2, uriPartsWithinLambda.size()); for(UriResource uPa : restOfUri) { propertyPath += "."; propertyPath += uPa.getSegmentValue(); }} return convertToUpperCaseIfRequired(propertyPath); }
@Override public String toString() { return "JPAFilterExpression [literal=" + literal + ", operator=" + operator + ", member=" + "[resourcePath=" + member.getResourcePath().getUriResourceParts() + ", startTypeFilter= " + member.getStartTypeFilter() + ", type= " + member.getType() + "]]"; } }
@Override public JPAPath visitMember(final Member member) throws ExpressionVisitException, ODataApplicationException { final UriResourceKind uriResourceKind = member.getResourcePath().getUriResourceParts().get(0).getKind(); if (uriResourceKind == UriResourceKind.primitiveProperty || uriResourceKind == UriResourceKind.complexProperty) { if (!Util.hasNavigation(member.getResourcePath().getUriResourceParts())) { final String path = Util.determineProptertyNavigationPath(member.getResourcePath().getUriResourceParts()); JPAPath selectItemPath = null; try { selectItemPath = jpaEntityType.getPath(path); } catch (ODataJPAModelException e) { throw new ODataJPAFilterException(e, HttpStatusCode.INTERNAL_SERVER_ERROR); } if (selectItemPath != null) { pathList.add(selectItemPath); return selectItemPath; } } } return null; }
@Override public Object visitMember(Member member) throws ExpressionVisitException, ODataApplicationException { if (member.getResourcePath().getUriResourceParts().size() == 1) { UriResource uriResource = (UriResource) member.getResourcePath().getUriResourceParts().get(0); if ((uriResource instanceof UriResourcePrimitiveProperty)) { String propertyName = ((UriResourcePrimitiveProperty) uriResource).getProperty().getName(); List<UriResource> uriResourceParts = member.getResourcePath().getUriResourceParts(); UriResource lastUriResourcePart = uriResourceParts.get(uriResourceParts.size()-1); if(!(lastUriResourcePart instanceof UriResourceLambdaAny) && !(lastUriResourcePart instanceof UriResourceLambdaAll)) { StringBuffer complexPropName = new StringBuffer(""); for (int i = 0; i < member.getResourcePath().getUriResourceParts().size(); i++) { complexPropName.append(member.getResourcePath().getUriResourceParts().get(i)); if (i != member.getResourcePath().getUriResourceParts().size() - 1) { complexPropName.append(".");
@Override public Object visitMember(Member member) throws ExpressionVisitException, ODataApplicationException { StringBuffer memberString= new StringBuffer("");; List<UriResource> uriResourceParts = member.getResourcePath().getUriResourceParts(); for (int i = 0; i < member.getResourcePath().getUriResourceParts().size(); i++) { memberString.append(member.getResourcePath().getUriResourceParts().get(i)); if (i != member.getResourcePath().getUriResourceParts().size() - 1) { memberString.append("/"); return memberString; if (member.getResourcePath().getUriResourceParts().size() == 1) { UriResource uriResource = (UriResource) member.getResourcePath().getUriResourceParts().get(0); if ((uriResource instanceof UriResourcePrimitiveProperty)) { EdmProperty edmProperty = ((UriResourcePrimitiveProperty) uriResource).getProperty(); uriResourceParts = member.getResourcePath().getUriResourceParts(); UriResource lastUriResourcePart = uriResourceParts.get(uriResourceParts.size()-1); if(!(lastUriResourcePart instanceof UriResourceLambdaAny) && !(lastUriResourcePart instanceof UriResourceLambdaAll)) { StringBuffer complexPropName = new StringBuffer(""); for (int i = 0; i < member.getResourcePath().getUriResourceParts().size(); i++) { complexPropName.append(member.getResourcePath().getUriResourceParts().get(i)); if (i != member.getResourcePath().getUriResourceParts().size() - 1) { complexPropName.append(".");
@Override public VisitorOperand visitMember(Member member) throws ExpressionVisitException, ODataApplicationException { final List<UriResource> uriResourceParts = member.getResourcePath().getUriResourceParts(); int size = uriResourceParts.size(); if (uriResourceParts.get(0) instanceof UriResourceProperty) { EdmProperty currentEdmProperty = ((UriResourceProperty) uriResourceParts.get(0)).getProperty(); Property currentProperty = entity.getProperty(currentEdmProperty.getName()); return new TypedOperand(currentProperty.getValue(), currentEdmProperty.getType(), currentEdmProperty); } else if (uriResourceParts.get(size - 1) instanceof UriResourceLambdaAll) { return throwNotImplemented(); } else if (uriResourceParts.get(size - 1) instanceof UriResourceLambdaAny) { return throwNotImplemented(); } else { return throwNotImplemented(); } }
private JPAPath determineAttributePath() throws ODataApplicationException { final String attributePath = Util.determineProptertyNavigationPath(member.getResourcePath().getUriResourceParts()); JPAPath selectItemPath = null; try { selectItemPath = jpaEntityType.getPath(attributePath); if (selectItemPath == null && association != null) { selectItemPath = jpaEntityType.getPath(attributePath.isEmpty() ? association.getAlias() : association.getAlias() + JPAPath.PATH_SEPERATOR + attributePath); } } catch (ODataJPAModelException e) { throw new ODataJPAFilterException(e, HttpStatusCode.INTERNAL_SERVER_ERROR); } return selectItemPath; }
@Override Subquery<?> getExistsQuery() throws ODataApplicationException { final List<UriResource> allUriResourceParts = new ArrayList<>(uriResourceParts); allUriResourceParts.addAll(jpaMember.getMember().getResourcePath().getUriResourceParts());
protected UriResourceKind getAggregationType(final VisitableExpression expression) { UriInfoResource member = null; if (expression != null && expression instanceof Binary) { if (((Binary) expression).getLeftOperand() instanceof JPAMemberOperator) member = ((JPAMemberOperator) ((Binary) expression).getLeftOperand()).getMember().getResourcePath(); else if (((Binary) expression).getRightOperand() instanceof JPAMemberOperator) member = ((JPAMemberOperator) ((Binary) expression).getRightOperand()).getMember().getResourcePath(); } else if (expression != null && expression instanceof JPAFilterExpression) member = ((JPAFilterExpression) expression).getMember(); if (member != null) { for (final UriResource r : member.getUriResourceParts()) { if (r.getKind() == UriResourceKind.count) return r.getKind(); } } return null; } }
final Expression expression = orderByItem.getExpression(); if (expression instanceof Member) { final UriInfoResource resourcePath = ((Member) expression).getResourcePath(); final StringBuilder pathString = new StringBuilder(); for (final UriResource uriResource : resourcePath.getUriResourceParts()) {
@Override public JPAOperator visitMember(final Member member) throws ExpressionVisitException, ODataApplicationException { final int handle = debugger.startRuntimeMeasurement(this, "visitMember"); if (getLambdaType(member.getResourcePath()) == UriResourceKind.lambdaAny) { debugger.stopRuntimeMeasurement(handle); return new JPALambdaAnyOperation(this.jpaComplier, member); } else if (getLambdaType(member.getResourcePath()) == UriResourceKind.lambdaAll) { debugger.stopRuntimeMeasurement(handle); return new JPALambdaAllOperation(this.jpaComplier, member); } else if (isAggregation(member.getResourcePath())) { debugger.stopRuntimeMeasurement(handle); return new JPAAggregationOperationImp(jpaComplier.getRoot(), jpaComplier.getConverter()); } else if (isCustomFunction(member.getResourcePath())) { final UriResource resource = member.getResourcePath().getUriResourceParts().get(0); final JPADataBaseFunction jpaFunction = (JPADataBaseFunction) this.jpaComplier.getSd().getFunction( ((UriResourceFunction) resource).getFunction()); final List<UriParameter> odataParams = ((UriResourceFunction) resource).getParameters(); debugger.stopRuntimeMeasurement(handle); return new JPAFunctionOperator(this, odataParams, jpaFunction); } debugger.stopRuntimeMeasurement(handle); return new JPAMemberOperator(this.jpaComplier.getJpaEntityType(), this.jpaComplier.getRoot(), member, jpaComplier .getAssoziation()); }
@Override public JsonNode visitMember(final Member member) throws ExpressionVisitException, ODataApplicationException { final List<UriResource> uriResourceParts = member.getResourcePath().getUriResourceParts(); final UriResource lastSegment = uriResourceParts.get(uriResourceParts.size() - 1); ObjectNode result = nodeFactory.objectNode()
@Override public JsonNode visitMember(final Member member) throws ExpressionVisitException, ODataApplicationException { final List<UriResource> uriResourceParts = member.getResourcePath().getUriResourceParts(); final UriResource lastSegment = uriResourceParts.get(uriResourceParts.size() - 1); ObjectNode result = nodeFactory.objectNode()
final Expression expression = orderByItem.getExpression(); if (expression instanceof Member) { final UriInfoResource resourcePath = ((Member) expression).getResourcePath(); JPAStructuredType type = jpaEntity; Path<?> p = target;