private boolean isStreamProperty(EdmProperty edmProperty) { final EdmType type = edmProperty.getType(); return (edmProperty.isPrimitive() && type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Stream)); }
private boolean isStreamProperty(EdmProperty edmProperty) { final EdmType type = edmProperty.getType(); return (edmProperty.isPrimitive() && type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Stream)); }
private boolean isStreamProperty(EdmProperty edmProperty) { final EdmType type = edmProperty.getType(); return (edmProperty.isPrimitive() && type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Stream)); }
private boolean isStreamProperty(EdmProperty edmProperty) { final EdmType type = edmProperty.getType(); return (edmProperty.isPrimitive() && type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Stream)); }
private boolean isStreamProperty(EdmProperty edmProperty) { final EdmType type = edmProperty.getType(); return (edmProperty.isPrimitive() && type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Stream)); }
private boolean isStreamProperty(EdmProperty edmProperty) { final EdmType type = edmProperty.getType(); return (edmProperty.isPrimitive() && type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Stream)); }
protected void writeProperties(final ServiceMetadata metadata, final EdmStructuredType type, final List<Property> properties, final SelectOption select, final JsonGenerator json) throws IOException, SerializerException { final boolean all = ExpandSelectHelper.isAll(select); final Set<String> selected = all ? new HashSet<String>() : ExpandSelectHelper.getSelectedPropertyNames(select .getSelectItems()); for (final String propertyName : type.getPropertyNames()) { if ((all || selected.contains(propertyName)) && !properties.isEmpty()) { final EdmProperty edmProperty = type.getStructuralProperty(propertyName); final Property property = findProperty(propertyName, properties); final Set<List<String>> selectedPaths = all || edmProperty.isPrimitive() ? null : ExpandSelectHelper .getSelectedPaths(select.getSelectItems(), propertyName); writeProperty(metadata, edmProperty, property, selectedPaths, json); } } }
protected void writeProperties(final ServiceMetadata metadata, final EdmStructuredType type, final List<Property> properties, final SelectOption select, final JsonGenerator json) throws IOException, SerializerException { final boolean all = ExpandSelectHelper.isAll(select); final Set<String> selected = all ? new HashSet<String>() : ExpandSelectHelper.getSelectedPropertyNames(select .getSelectItems()); for (final String propertyName : type.getPropertyNames()) { if ((all || selected.contains(propertyName)) && !properties.isEmpty()) { final EdmProperty edmProperty = type.getStructuralProperty(propertyName); final Property property = findProperty(propertyName, properties); final Set<List<String>> selectedPaths = all || edmProperty.isPrimitive() ? null : ExpandSelectHelper .getSelectedPaths(select.getSelectItems(), propertyName); writeProperty(metadata, edmProperty, property, selectedPaths, json); } } }
protected void writeProperties(final ServiceMetadata metadata, final EdmStructuredType type, final List<Property> properties, final SelectOption select, final JsonGenerator json) throws IOException, SerializerException { final boolean all = ExpandSelectHelper.isAll(select); final Set<String> selected = all ? new HashSet<String>() : ExpandSelectHelper.getSelectedPropertyNames(select .getSelectItems()); for (final String propertyName : type.getPropertyNames()) { if (all || selected.contains(propertyName)) { final EdmProperty edmProperty = type.getStructuralProperty(propertyName); final Property property = findProperty(propertyName, properties); final Set<List<String>> selectedPaths = all || edmProperty.isPrimitive() ? null : ExpandSelectHelper .getSelectedPaths(select.getSelectItems(), propertyName); writeProperty(metadata, edmProperty, property, selectedPaths, json); } } }
@Override public Object primitiveValue(final InputStream content, final EdmProperty property) throws DeserializerException { if (property == null || !property.isPrimitive()) { throw new DeserializerException("Wrong property.", DeserializerException.MessageKeys.NOT_IMPLEMENTED); } try { StringWriter writer = new StringWriter(); InputStreamReader reader = new InputStreamReader(content, "UTF-8"); int c = -1; while ((c = reader.read()) != -1) { writer.append((char) c); } final EdmPrimitiveType type = (EdmPrimitiveType) property.getType(); return type.valueOfString(writer.toString(), property.isNullable(), property.getMaxLength(), property.getPrecision(), property.getScale(), property.isUnicode(), type.getDefaultType()); } catch (final EdmPrimitiveTypeException e) { throw new DeserializerException("The value is not valid.", e, DeserializerException.MessageKeys.INVALID_VALUE_FOR_PROPERTY, property.getName()); } catch (final IOException e) { throw new DeserializerException("An I/O exception occurred.", e, DeserializerException.MessageKeys.IO_EXCEPTION); } }
@Override public Object primitiveValue(final InputStream content, final EdmProperty property) throws DeserializerException { if (property == null || !property.isPrimitive()) { throw new DeserializerException("Wrong property.", DeserializerException.MessageKeys.NOT_IMPLEMENTED); } try { StringWriter writer = new StringWriter(); InputStreamReader reader = new InputStreamReader(content, "UTF-8"); int c = -1; while ((c = reader.read()) != -1) { writer.append((char) c); } final EdmPrimitiveType type = (EdmPrimitiveType) property.getType(); return type.valueOfString(writer.toString(), property.isNullable(), property.getMaxLength(), property.getPrecision(), property.getScale(), property.isUnicode(), type.getDefaultType()); } catch (final EdmPrimitiveTypeException e) { throw new DeserializerException("The value is not valid.", e, DeserializerException.MessageKeys.INVALID_VALUE_FOR_PROPERTY, property.getName()); } catch (final IOException e) { throw new DeserializerException("An I/O exception occurred.", e, DeserializerException.MessageKeys.IO_EXCEPTION); } }
protected void writeProperties(final ServiceMetadata metadata, final EdmStructuredType type, final List<Property> properties, final SelectOption select, final JsonGenerator json) throws IOException, SerializerException { final boolean all = ExpandSelectHelper.isAll(select); final Set<String> selected = all ? new HashSet<String>() : ExpandSelectHelper.getSelectedPropertyNames(select .getSelectItems()); for (final String propertyName : type.getPropertyNames()) { if (all || selected.contains(propertyName)) { final EdmProperty edmProperty = type.getStructuralProperty(propertyName); final Property property = findProperty(propertyName, properties); final Set<List<String>> selectedPaths = all || edmProperty.isPrimitive() ? null : ExpandSelectHelper .getSelectedPaths(select.getSelectItems(), propertyName); writeProperty(metadata, edmProperty, property, selectedPaths, json); } } }
protected void writeProperties(final ServiceMetadata metadata, final EdmStructuredType type, final List<Property> properties, final SelectOption select, final String xml10InvalidCharReplacement, final XMLStreamWriter writer, Linked linked, ExpandOption expand) throws XMLStreamException, SerializerException { final boolean all = ExpandSelectHelper.isAll(select); final Set<String> selected = all ? new HashSet<String>() : ExpandSelectHelper.getSelectedPropertyNames(select.getSelectItems()); addKeyPropertiesToSelected(selected, type); Set<List<String>> expandedPaths = ExpandSelectHelper.getExpandedItemsPath(expand); for (final String propertyName : type.getPropertyNames()) { if (all || selected.contains(propertyName)) { final EdmProperty edmProperty = type.getStructuralProperty(propertyName); final Property property = findProperty(propertyName, properties); final Set<List<String>> selectedPaths = all || edmProperty.isPrimitive() ? null : ExpandSelectHelper.getSelectedPaths(select.getSelectItems(), propertyName); writeProperty(metadata, edmProperty, property, selectedPaths, xml10InvalidCharReplacement, writer, expandedPaths, linked, expand); } } }
protected void writeProperties(final ServiceMetadata metadata, final EdmStructuredType type, final List<Property> properties, final SelectOption select, final JsonGenerator json, Linked linked, ExpandOption expand) throws IOException, SerializerException { final boolean all = ExpandSelectHelper.isAll(select); final Set<String> selected = all ? new HashSet<String>() : ExpandSelectHelper.getSelectedPropertyNames(select.getSelectItems()); addKeyPropertiesToSelected(selected, type); Set<List<String>> expandedPaths = ExpandSelectHelper.getExpandedItemsPath(expand); for (final String propertyName : type.getPropertyNames()) { if (all || selected.contains(propertyName)) { final EdmProperty edmProperty = type.getStructuralProperty(propertyName); final Property property = findProperty(propertyName, properties); final Set<List<String>> selectedPaths = all || edmProperty.isPrimitive() ? null : ExpandSelectHelper.getSelectedPaths(select.getSelectItems(), propertyName); writeProperty(metadata, edmProperty, property, selectedPaths, json, expandedPaths, linked, expand); } } }
protected void writeProperties(final ServiceMetadata metadata, final EdmStructuredType type, final List<Property> properties, final SelectOption select, final JsonGenerator json, Linked linked, ExpandOption expand) throws IOException, SerializerException { final boolean all = ExpandSelectHelper.isAll(select); final Set<String> selected = all ? new HashSet<String>() : ExpandSelectHelper.getSelectedPropertyNames(select.getSelectItems()); addKeyPropertiesToSelected(selected, type); Set<List<String>> expandedPaths = ExpandSelectHelper.getExpandedItemsPath(expand); for (final String propertyName : type.getPropertyNames()) { if (all || selected.contains(propertyName)) { final EdmProperty edmProperty = type.getStructuralProperty(propertyName); final Property property = findProperty(propertyName, properties); final Set<List<String>> selectedPaths = all || edmProperty.isPrimitive() ? null : ExpandSelectHelper.getSelectedPaths(select.getSelectItems(), propertyName); writeProperty(metadata, edmProperty, property, selectedPaths, json, expandedPaths, linked, expand); } } }
protected void writeProperties(final ServiceMetadata metadata, final EdmStructuredType type, final List<Property> properties, final SelectOption select, final String xml10InvalidCharReplacement, final XMLStreamWriter writer, Linked linked, ExpandOption expand) throws XMLStreamException, SerializerException { final boolean all = ExpandSelectHelper.isAll(select); final Set<String> selected = all ? new HashSet<String>() : ExpandSelectHelper.getSelectedPropertyNames(select.getSelectItems()); addKeyPropertiesToSelected(selected, type); Set<List<String>> expandedPaths = ExpandSelectHelper.getExpandedItemsPath(expand); for (final String propertyName : type.getPropertyNames()) { if (all || selected.contains(propertyName)) { final EdmProperty edmProperty = type.getStructuralProperty(propertyName); final Property property = findProperty(propertyName, properties); final Set<List<String>> selectedPaths = all || edmProperty.isPrimitive() ? null : ExpandSelectHelper.getSelectedPaths(select.getSelectItems(), propertyName); writeProperty(metadata, edmProperty, property, selectedPaths, xml10InvalidCharReplacement, writer, expandedPaths, linked, expand); } } }
@Override public void visit(CountResponse response) throws ODataLibraryException, ODataApplicationException { if (request.getUriResourceProperty() != null) { EdmProperty edmProperty = request.getUriResourceProperty().getProperty(); if (edmProperty.isPrimitive()) { selectProcessor(CountPrimitiveCollectionProcessor.class).countPrimitiveCollection( request.getODataRequest(), response.getODataResponse(), request.getUriInfo()); } else { selectProcessor(CountComplexCollectionProcessor.class).countComplexCollection( request.getODataRequest(), response.getODataResponse(), request.getUriInfo()); } } else { selectProcessor(CountEntityCollectionProcessor.class).countEntityCollection( request.getODataRequest(), response.getODataResponse(), request.getUriInfo()); } }
@Override public void visit(CountResponse response) throws ODataLibraryException, ODataApplicationException { if (request.getUriResourceProperty() != null) { EdmProperty edmProperty = request.getUriResourceProperty().getProperty(); if (edmProperty.isPrimitive()) { selectProcessor(CountPrimitiveCollectionProcessor.class).countPrimitiveCollection( request.getODataRequest(), response.getODataResponse(), request.getUriInfo()); } else { selectProcessor(CountComplexCollectionProcessor.class).countComplexCollection( request.getODataRequest(), response.getODataResponse(), request.getUriInfo()); } } else { selectProcessor(CountEntityCollectionProcessor.class).countEntityCollection( request.getODataRequest(), response.getODataResponse(), request.getUriInfo()); } }
@Override public void visit(PropertyResponse response) throws ODataLibraryException, ODataApplicationException { EdmProperty edmProperty = request.getUriResourceProperty().getProperty(); if (edmProperty.isPrimitive()) { if(edmProperty.isCollection()) { selectProcessor(PrimitiveCollectionProcessor.class).readPrimitiveCollection( request.getODataRequest(), response.getODataResponse(), request.getUriInfo(), request.getResponseContentType()); } else { selectProcessor(PrimitiveProcessor.class).readPrimitive( request.getODataRequest(), response.getODataResponse(), request.getUriInfo(), request.getResponseContentType()); } } else { if(edmProperty.isCollection()) { selectProcessor(ComplexCollectionProcessor.class).readComplexCollection( request.getODataRequest(), response.getODataResponse(), request.getUriInfo(), request.getResponseContentType()); } else { selectProcessor(ComplexProcessor.class).readComplex( request.getODataRequest(), response.getODataResponse(), request.getUriInfo(), request.getResponseContentType()); } } }
@Override public void visit(PropertyResponse response) throws ODataLibraryException, ODataApplicationException { EdmProperty edmProperty = request.getUriResourceProperty().getProperty(); if (edmProperty.isPrimitive()) { if(edmProperty.isCollection()) { selectProcessor(PrimitiveCollectionProcessor.class).readPrimitiveCollection( request.getODataRequest(), response.getODataResponse(), request.getUriInfo(), request.getResponseContentType()); } else { selectProcessor(PrimitiveProcessor.class).readPrimitive( request.getODataRequest(), response.getODataResponse(), request.getUriInfo(), request.getResponseContentType()); } } else { if(edmProperty.isCollection()) { selectProcessor(ComplexCollectionProcessor.class).readComplexCollection( request.getODataRequest(), response.getODataResponse(), request.getUriInfo(), request.getResponseContentType()); } else { selectProcessor(ComplexProcessor.class).readComplex( request.getODataRequest(), response.getODataResponse(), request.getUriInfo(), request.getResponseContentType()); } } }