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(); }
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); } } } } }
innerOptions == null ? null : innerOptions.getCountOption(), innerOptions == null ? false : innerOptions.hasCountPath(), innerOptions == null ? false : innerOptions.isRef(), xml10InvalidCharReplacement, ancestors, name, writer); writer.writeEndElement();
innerOptions == null ? null : innerOptions.getCountOption(), innerOptions == null ? false : innerOptions.hasCountPath(), innerOptions == null ? false : innerOptions.isRef(), xml10InvalidCharReplacement, ancestors, name, writer); writer.writeEndElement();
innerOptions == null ? null : innerOptions.getCountOption(), innerOptions == null ? false : innerOptions.hasCountPath(), innerOptions == null ? false : innerOptions.isRef(), ancestors, name, json);
innerOptions == null ? null : innerOptions.getCountOption(), innerOptions == null ? false : innerOptions.hasCountPath(), innerOptions == null ? false : innerOptions.isRef(), ancestors, name, json);