@SuppressWarnings("unchecked") private List<String> getPropertyNames(List<Map<String, Object>> resultEntries, GetEntitySetUriInfo uriInfo) throws EdmException{ List<String> propNameList = new ArrayList<String>(); List<String> sPropList = new ArrayList<String>(); if(uriInfo.getSelect() != null && !uriInfo.getSelect().isEmpty()){ for(SelectItem sItem : uriInfo.getSelect()){ sPropList.add(sItem.getProperty().getName()); } } for(String entityName : resultEntries.get(0).keySet()){ if(sPropList.isEmpty() || sPropList.contains(entityName)){ if(resultEntries.get(0).get(entityName) instanceof Map){ Set<String> entityKeySet = ((Map<String, Object>)resultEntries.get(0).get(entityName)).keySet(); for(String entityKey : entityKeySet){ propNameList.add(entityName +" - "+entityKey); } }else{ propNameList.add(entityName); } } } return propNameList; }
private void setSelect(QueryRequest queryRequest, GetEntitySetUriInfo uriInfo) { if (uriInfo.getSelect() != null) { for (SelectItem select : uriInfo.getSelect()) { if (select != null) { if (select.getProperty() != null) { String str = null; try { str = select.getProperty().getName(); } catch (EdmException e) { logger.error("Error while setting select option"); } ((QueryRequestImpl) queryRequest).setSelectItems(str); } } } } }
@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; }
entityFeedPropertiesBuilder.inlineCountType(resultsView.getInlineCount()); ExpandSelectTreeNode expandSelectTree = UriParser.createExpandSelectTree(resultsView.getSelect(), resultsView.getExpand());
entityFeedPropertiesBuilder.inlineCountType(resultsView.getInlineCount()); ExpandSelectTreeNode expandSelectTree = UriParser.createExpandSelectTree(resultsView.getSelect(), resultsView.getExpand());
List<Map<String, Object>> edmEntityList = null; JPAEntityParser jpaResultParser = new JPAEntityParser(); final List<SelectItem> selectedItems = resultsView.getSelect(); if (selectedItems != null && !selectedItems.isEmpty()) { edmEntityList =
List<Map<String, Object>> edmEntityList = null; JPAEntityParser jpaResultParser = new JPAEntityParser(oDataJPAContext, (UriInfo) resultsView); final List<SelectItem> selectedItems = resultsView.getSelect(); if (selectedItems != null && !selectedItems.isEmpty()) { edmEntityList =
.inlineCountType(inlineCountType) .inlineCount(count) .expandSelectTree(UriParser.createExpandSelectTree(uriInfo.getSelect(), uriInfo.getExpand())) .callbacks(getCallbacks(data, entityType)) .nextLink(nextLink)
.inlineCountType(inlineCountType) .inlineCount(count) .expandSelectTree(UriParser.createExpandSelectTree(uriInfo.getSelect(), uriInfo.getExpand())) .callbacks(getCallbacks(data, entityType)) .nextLink(nextLink)
.callback(uriInfo.getCallback()) .clientCallbacks(uriInfo.getClientCallbacks()) .expandSelectTree(UriParser.createExpandSelectTree(uriInfo.getSelect(), uriInfo.getExpand())) .callbacks(getCallbacks(data, entityType)) .nextLink(nextLink)