@Override public IDataProviderResponse readEntitySet(GetEntitySetUriInfo uriInfo, ODataContext context) throws ODataException { GetEntitySetUriInfo resolvedUriInfo = resolveCrossServiceNavigation((UriInfo) uriInfo, true, context); IDataProvider provider = getTargetDataProvider(resolvedUriInfo.getFunctionImport(), resolvedUriInfo.getStartEntitySet()); if (provider == null) { throw new DataProviderException(DataProviderException.NOT_IMPLEMENTED.addContent("readEntitySet"), context.getAcceptableLanguages().get(0)); } else { return provider.readEntitySet(resolvedUriInfo, context); } } @Override
@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; }
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); } return jpaOuterJoinClauses; }
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); } return jpaOuterJoinClauses; }
try { data.addAll((List<?>) retrieveData( uriInfo.getStartEntitySet(), uriInfo.getKeyPredicates(), uriInfo.getFunctionImport(),
try { data.addAll((List<?>) retrieveData( uriInfo.getStartEntitySet(), uriInfo.getKeyPredicates(), uriInfo.getFunctionImport(),
try { data.addAll((List<?>) retrieveData( uriInfo.getStartEntitySet(), uriInfo.getKeyPredicates(), uriInfo.getFunctionImport(),
EdmEntitySet entitySet = uriInfo.getStartEntitySet(); if (expanding) { entitySet = uriInfo.getTargetEntitySet(); setCustomQueryOptions(queryRequest, uriInfo); if (expanding && (!uriInfo.getStartEntitySet().getName().equals(uriInfo.getTargetEntitySet().getName()))) { ((QueryRequestImpl) queryRequest).setSourceEntityName(uriInfo.getStartEntitySet().getName()); try { ((QueryRequestImpl) queryRequest).setSourceKeys(getKeys(uriInfo.getKeyPredicates())); ((QueryRequestImpl) queryRequest).setSourceEntityName(uriInfo.getStartEntitySet().getName()); try { ((QueryRequestImpl) queryRequest).setSourceKeys(getKeys(uriInfo.getKeyPredicates()));
this.gwlog.debug("readEntitySet: " + TraceUtil.getEntitySetLog(uriInfo.getStartEntitySet()) + ", content type = " + (contentType == null ? "<null>" : contentType));
this.gwlog.debug("readEntitySet: " + TraceUtil.getEntitySetLog(uriInfo.getStartEntitySet()) + ", content type = " + (contentType == null ? "<null>" : contentType));