public static UriInfoImpl constructDeepReadForDraftRoot(EdmEntitySet edmEntitySet, String serviceName) throws ODataException { UriInfoImpl uriInfoForRead = new UriInfoImpl(); uriInfoForRead.setStartEntitySet(edmEntitySet); uriInfoForRead.setTargetEntitySet(edmEntitySet); Map<String,List<String>> draftTree = CSNUtil.getDraftTree(serviceName); List<ArrayList<NavigationPropertySegment>> expandOption = new ArrayList<>(); constructDraftTreeExpand(edmEntitySet, serviceName, draftTree, new ArrayList<>(), expandOption); uriInfoForRead.setExpand(expandOption); return uriInfoForRead; }
public EntityCollection processResultSetForMainTable(ResultSet result, Connection conn,ODataRequest request) throws ODataApplicationException { EntityCollection ec; try { ResultSetProcessor rsp=new ResultSetProcessor(request); ec = rsp.toEntityCollection(result, qHForDraftMainTable.getEntityInfo()); } catch (Exception e) { logger.error(e.getMessage(),e); throw new CDSRuntimeException(CDSRuntimeException.MessageKeys.INTERNAL_ERROR, "Error occured while converting result set to entities:"+ e.getMessage(), HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode(), HeaderUtil.getlocale(request),e); } Map<String,List<String>> draftTree=CSNUtil.getDraftTree(qHForDraftMainTable.getSchema()); //After getting the resultSet Calculate and append the Calculated fields for Drafts Table for(int i=0;i<ec.getEntities().size();i++) { Entity entityActive=ec.getEntities().get(i); correctionInMainEntities(entityActive, qHForDraftMainTable.getSchema(), draftTree); } return ec; }
this.removeIsActivateFromEntitySet(entitySet); Map<String,List<String>> draftTree = CSNUtil.getDraftTree(serviceName); UriInfoImpl uriInfoForRead = UriInfoTransformerBuilder.constructDeepReadForDraftRoot(entitySet, serviceName); uriInfoForRead.setKeyPredicates(this.getKeysFromFunctionImportParams(uriInfo, false));
for(String navName:mainEntity.getNavigationPropertyNames()){ EdmNavigationProperty navProp=mainEntity.getNavigationProperty(navName); Map<String,List<String>> draftTree=CSNUtil.getDraftTree( EdmHelper.getServiceName(uriInfo.asUriInfoResource())); if(!navProp.isCollection() && draftTree.get(mainEntity.getName()).contains(navProp.getType().getName())) { //there for it is a 1:1 entity and its a Draft Node