protected String generateWhereExpression() throws ODataException { if (entitySetView.getFilter() != null) { String whereExpression = ODataExpressionParser.parseToJPAWhereExpression( entitySetView.getFilter(), getJPAEntityAlias()); Map<String, Map<Integer, Object>> parameterizedExpressionMap = new HashMap<String, Map<Integer,Object>>(); parameterizedExpressionMap.put(whereExpression, ODataExpressionParser.getPositionalParameters()); ODataParameterizedWhereExpressionUtil.setParameterizedQueryMap(parameterizedExpressionMap); ODataExpressionParser.reInitializePositionalParameters(); return whereExpression; } ODataExpressionParser.reInitializePositionalParameters(); return null; } }
protected String generateWhereExpression() throws ODataException { if (entitySetView.getFilter() != null) { String whereExpression = ODataExpressionParser.parseToJPAWhereExpression( entitySetView.getFilter(), getJPAEntityAlias()); Map<String, Map<Integer, Object>> parameterizedExpressionMap = new HashMap<String, Map<Integer,Object>>(); parameterizedExpressionMap.put(whereExpression, ODataExpressionParser.getPositionalParameters()); ODataParameterizedWhereExpressionUtil.setParameterizedQueryMap(parameterizedExpressionMap); ODataExpressionParser.reInitializePositionalParameters(); return whereExpression; } ODataExpressionParser.reInitializePositionalParameters(); return null; } }
@Override public IDataProviderResponse readExpandedEntitySet(GetEntitySetUriInfo uriInfo, ODataContext context) throws ODataException { GWUriInfo gwUriInfo = new GWUriInfo((UriInfo) uriInfo, uriInfo.getStartEntitySet(), uriInfo.getKeyPredicates(), uriInfo.getNavigationSegments(), uriInfo.getFilter()); gwUriInfo.setExpand(new ArrayList<ArrayList<NavigationPropertySegment>>()); gwUriInfo.setSelect(new ArrayList<SelectItem>()); IDataProviderResponse response = readEntitySet(gwUriInfo, context); ArrayList<Map<String, Object>> resultList = new ArrayList<Map<String, Object>>(); ExpandSelectTreeNode expandSelectTreeNode = UriParser.createExpandSelectTree(uriInfo.getSelect(), uriInfo.getExpand()); Map<String, ExpandSelectTreeNode> links = expandSelectTreeNode.getLinks(); for (Map<String, Object> responseEntity : response.getResultEntities()) { HashMap<String, Object> resultMap = new HashMap<String, Object>(); resultMap.putAll(responseEntity); EdmEntitySet entitySet = uriInfo.getTargetEntitySet(); List<KeyPredicate> keyPredicates = getKeyPredicates(entitySet.getEntityType(), resultMap); GWUriInfo singleUriInfo = new GWUriInfo((UriInfo) uriInfo, uriInfo.getStartEntitySet(), keyPredicates, uriInfo.getNavigationSegments(), uriInfo.getFilter()); for (Entry<String, ExpandSelectTreeNode> expandNodeEntry : links.entrySet()) { Object singleResult = getSingleNavigationPathResult(expandNodeEntry, entitySet, resultMap, singleUriInfo, context); resultMap.put(expandNodeEntry.getKey(), singleResult); } resultList.add(resultMap); } BaseDataProviderResponse baseResponse = new BaseDataProviderResponse(); baseResponse.setResultEntities(resultList); return baseResponse; }
entitySet, data, uriInfo.getFilter(), inlineCountType, uriInfo.getOrderBy(),
entitySet, data, uriInfo.getFilter(), inlineCountType, uriInfo.getOrderBy(),
entitySet, data, uriInfo.getFilter(), inlineCountType, uriInfo.getOrderBy(),
QueryRequestImpl queryRequest = new QueryRequestImpl(null, entitySet.getName(), entityMetadata, context.getRequestHeaders(), context.getHttpMethod()); Expression filterTree = new ExpressionBuilderImplV2().buildForV2(uriInfo.getFilter()); queryRequest.setQueryExpression(filterTree); queryRequest.setServiceName(serviceName);