public void writeReadEntitySet(EdmEntityType entityType, EntityCollection entitySet) throws SerializerException { assert (!isClosed()); if (entitySet == null) { writeNotFound(true); return; } if (ContentTypeHelper.isODataMetadataFull(this.responseContentType)) { buildOperations(entityType, entitySet); } // write the whole collection to response this.response.setContent(this.serializer.entityCollection(metadata, entityType, entitySet, this.options) .getContent()); writeOK(responseContentType); close(); }
public void writeReadEntitySet(EdmEntityType entityType, EntityCollection entitySet) throws SerializerException { assert (!isClosed()); if (entitySet == null) { writeNotFound(true); return; } if (ContentTypeHelper.isODataMetadataFull(this.responseContentType)) { buildOperations(entityType, entitySet); } // write the whole collection to response this.response.setContent(this.serializer.entityCollection(metadata, entityType, entitySet, this.options) .getContent()); writeOK(responseContentType); close(); }
@Override public SerializerResult serialize(final Annotatable annotatable, final EdmType entityType) throws SerializerException, ODataJPASerializerException { final EntityCollection result = (EntityCollection) annotatable; final String selectList = uriHelper.buildContextURLSelectList((EdmEntityType) entityType, uriInfo.getExpandOption(), uriInfo.getSelectOption()); final ContextURL contextUrl = ContextURL.with() .asCollection() .type(entityType) .selectList(selectList) .build(); final EntityCollectionSerializerOptions options = EntityCollectionSerializerOptions.with() .contextURL(contextUrl) .select(uriInfo.getSelectOption()) .expand(uriInfo.getExpandOption()) .build(); return serializer.entityCollection(serviceMetadata, (EdmEntityType) entityType, result, options); }
@Override public SerializerResult serialize(final ODataRequest request, final EntityCollection result) throws SerializerException { final EdmEntitySet targetEdmEntitySet = Util.determineTargetEntitySet(uriInfo.getUriResourceParts()); final String selectList = uriHelper.buildContextURLSelectList(targetEdmEntitySet.getEntityType(), uriInfo.getExpandOption(), uriInfo.getSelectOption()); final ContextURL contextUrl = ContextURL.with() .entitySet(targetEdmEntitySet) .selectList(selectList) .build(); final String id = request.getRawBaseUri() + "/" + targetEdmEntitySet.getEntityType().getName(); final EntityCollectionSerializerOptions opts = EntityCollectionSerializerOptions.with() .contextURL(contextUrl) .id(id) .count(uriInfo.getCountOption()) .select(uriInfo.getSelectOption()) .expand(uriInfo.getExpandOption()) .build(); return serializer.entityCollection(this.serviceMetadata, targetEdmEntitySet.getEntityType(), result, opts); }