private LevelsExpandOption determineLevel(ExpandItem item2) { return item.getLevelsOption(); }
private ExpandItemWrapper(ExpandItem parentItem) { this.parentItem = parentItem; this.levelOption = new LevelsExpandOptionWrapper(parentItem.getLevelsOption().isMax(), parentItem.getLevelsOption().getValue()); }
private ExpandOptionWrapper(ExpandOption expandOption) { this.items = new ArrayList<>(); this.items.add(new ExpandItemWrapper(expandOption.getExpandItems().get(0))); this.parentOptions = expandOption; expandOption.getExpandItems().get(0).getLevelsOption(); }
private void appendExpandItemJson(final JsonGenerator gen, final ExpandItem item) throws IOException { gen.writeStartObject(); if (item.isStar()) { gen.writeBooleanField("star", item.isStar()); } else if (item.getResourcePath() != null && !item.getResourcePath().getUriResourceParts().isEmpty()) { gen.writeFieldName("expandPath"); appendURIResourceParts(gen, item.getResourcePath().getUriResourceParts()); } if (item.isRef()) { gen.writeBooleanField("isRef", item.isRef()); } if (item.getLevelsOption() != null) { gen.writeFieldName("levels"); if (item.getLevelsOption().isMax()) { gen.writeString("max"); } else { gen.writeNumber(item.getLevelsOption().getValue()); } } appendCommonJsonObjects(gen, item.getCountOption(), item.getSkipOption(), item.getTopOption(), item.getFilterOption(), item.getOrderByOption(), item.getSelectOption(), item.getExpandOption(), item.getSearchOption(), item.getApplyOption()); gen.writeEndObject(); }
private void appendExpandItemJson(final JsonGenerator gen, final ExpandItem item) throws IOException { gen.writeStartObject(); if (item.isStar()) { gen.writeBooleanField("star", item.isStar()); } else if (item.getResourcePath() != null && !item.getResourcePath().getUriResourceParts().isEmpty()) { gen.writeFieldName("expandPath"); appendURIResourceParts(gen, item.getResourcePath().getUriResourceParts()); } if (item.isRef()) { gen.writeBooleanField("isRef", item.isRef()); } if (item.getLevelsOption() != null) { gen.writeFieldName("levels"); if (item.getLevelsOption().isMax()) { gen.writeString("max"); } else { gen.writeNumber(item.getLevelsOption().getValue()); } } appendCommonJsonObjects(gen, item.getCountOption(), item.getSkipOption(), item.getTopOption(), item.getFilterOption(), item.getOrderByOption(), item.getSelectOption(), item.getExpandOption(), item.getSearchOption(), item.getApplyOption()); gen.writeEndObject(); }
private void checkForUnimplementedFeaturesWithinExpand(List<ExpandItem> expandItems,ODataRequest request) throws CDSRuntimeException { for(ExpandItem expandItem : expandItems) { CDSRuntimeException cdsRuntimeException; if((expandItem).getCountOption() != null){ cdsRuntimeException = new CDSRuntimeException(CDSRuntimeException.MessageKeys.NOT_IMPLEMENTED, "$count in expand is not implemented", HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), HeaderUtil.getlocale(request), "$count in Expand"); logger.error("$count system query option is not implemented", cdsRuntimeException); throw cdsRuntimeException; } if(expandItem.getLevelsOption() != null){ cdsRuntimeException = new CDSRuntimeException(CDSRuntimeException.MessageKeys.NOT_IMPLEMENTED, "$level in expand is not implemented", HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), HeaderUtil.getlocale(request), "$level in Expand"); logger.error("$levels option is not implemented", cdsRuntimeException); throw cdsRuntimeException; } if(expandItem.isStar()){ cdsRuntimeException = new CDSRuntimeException(CDSRuntimeException.MessageKeys.NOT_IMPLEMENTED, "$expand=* in Expand not mplemented", HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), HeaderUtil.getlocale(request), "$expand=* in Expand"); logger.error("$expand=* option is not implemented", cdsRuntimeException); throw cdsRuntimeException; } } }
if (item.getLevelsOption() != null) pathList.put(new JPAExpandLevelWrapper(sd, expandOption), Util.determineAssoziation(sd, ((UriResourcePartTyped) startResourceItem).getType(), associationName));
protected void writeNavigationProperties(final ServiceMetadata metadata, final EdmStructuredType type, final Linked linked, final ExpandOption expand, final String name, final JsonGenerator json) throws SerializerException, IOException { if (ExpandSelectHelper.hasExpand(expand)) { final boolean expandAll = ExpandSelectHelper.getExpandAll(expand) != null; final Set<String> expanded = expandAll ? new HashSet<String>() : ExpandSelectHelper.getExpandedPropertyNames( expand.getExpandItems()); for (final String propertyName : type.getNavigationPropertyNames()) { if (expandAll || expanded.contains(propertyName)) { final EdmNavigationProperty property = type.getNavigationProperty(propertyName); final Link navigationLink = linked.getNavigationLink(property.getName()); final ExpandItem innerOptions = expandAll ? null : ExpandSelectHelper.getExpandItem(expand.getExpandItems(), propertyName); if (innerOptions != null && innerOptions.getLevelsOption() != null) { throw new SerializerException("Expand option $levels is not supported.", SerializerException.MessageKeys.NOT_IMPLEMENTED); } if (navigationLink != null) { writeExpandedNavigationProperty(metadata, property, navigationLink, innerOptions == null ? null : innerOptions.getExpandOption(), innerOptions == null ? null : innerOptions.getSelectOption(), innerOptions == null ? null : innerOptions.getCountOption(), innerOptions == null ? false : innerOptions.hasCountPath(), innerOptions == null ? false : innerOptions.isRef(), name, json); } } } } }
protected void writeNavigationProperties(final ServiceMetadata metadata, final EdmStructuredType type, final Linked linked, final ExpandOption expand, final String name, final JsonGenerator json) throws SerializerException, IOException { if (ExpandSelectHelper.hasExpand(expand)) { final boolean expandAll = ExpandSelectHelper.getExpandAll(expand) != null; final Set<String> expanded = expandAll ? new HashSet<String>() : ExpandSelectHelper.getExpandedPropertyNames( expand.getExpandItems()); for (final String propertyName : type.getNavigationPropertyNames()) { if (expandAll || expanded.contains(propertyName)) { final EdmNavigationProperty property = type.getNavigationProperty(propertyName); final Link navigationLink = linked.getNavigationLink(property.getName()); final ExpandItem innerOptions = expandAll ? null : ExpandSelectHelper.getExpandItem(expand.getExpandItems(), propertyName); if (innerOptions != null && innerOptions.getLevelsOption() != null) { throw new SerializerException("Expand option $levels is not supported.", SerializerException.MessageKeys.NOT_IMPLEMENTED); } if (navigationLink != null) { writeExpandedNavigationProperty(metadata, property, navigationLink, innerOptions == null ? null : innerOptions.getExpandOption(), innerOptions == null ? null : innerOptions.getSelectOption(), innerOptions == null ? null : innerOptions.getCountOption(), innerOptions == null ? false : innerOptions.hasCountPath(), innerOptions == null ? false : innerOptions.isRef(), name, json); } } } } }
LevelsExpandOption levelsOption = null; if (innerOptions != null) { levelsOption = innerOptions.getLevelsOption(); childExpand = levelsOption == null ? innerOptions.getExpandOption() : new ExpandOptionImpl().addExpandItem(innerOptions); } else if (expandAll != null) { levels = 1; levelsOption = expandAll.getLevelsOption(); childExpand = new ExpandOptionImpl().addExpandItem(expandAll);
LevelsExpandOption levelsOption = null; if (innerOptions != null) { levelsOption = innerOptions.getLevelsOption(); childExpand = levelsOption == null ? innerOptions.getExpandOption() : new ExpandOptionImpl().addExpandItem(innerOptions); } else if (expandAll != null) { levels = 1; levelsOption = expandAll.getLevelsOption(); childExpand = new ExpandOptionImpl().addExpandItem(expandAll);
LevelsExpandOption levelsOption = null; if (innerOptions != null) { levelsOption = innerOptions.getLevelsOption(); childExpand = levelsOption == null ? innerOptions.getExpandOption() : new ExpandOptionImpl().addExpandItem( innerOptions); } else if (expandAll != null) { levels = 1; levelsOption = expandAll.getLevelsOption(); childExpand = new ExpandOptionImpl().addExpandItem(expandAll);
LevelsExpandOption levelsOption = null; if (innerOptions != null) { levelsOption = innerOptions.getLevelsOption(); childExpand = levelsOption == null ? innerOptions.getExpandOption() : new ExpandOptionImpl().addExpandItem( innerOptions); } else if (expandAll != null) { levels = 1; levelsOption = expandAll.getLevelsOption(); childExpand = new ExpandOptionImpl().addExpandItem(expandAll);
} else if (ei.getLevelsOption() != null) { if (ei.getLevelsOption().isMax()) { levels = MAX_EXPAND_LEVEL - expandLevel + 1; } else { levels = ei.getLevelsOption().getValue(); checkExpandLevel(expandLevel + levels - 1);