private Builder() { options = new EntitySerializerOptions(); }
SerializerException cachedException = null; try { final ContextURL contextURL = checkContextURL(options == null ? null : options.getContextURL()); CircleStreamBuffer buffer = new CircleStreamBuffer(); outputStream = buffer.getOutputStream(); String name = contextURL == null ? null:contextURL.getEntitySetOrSingletonOrType(); writeEntity(metadata, entityType, entity, contextURL, options == null ? null : options.getExpand(), null, options == null ? null : options.getSelect(), options == null ? false : options.getWriteOnlyReferences(), null, name, json);
@Override public SerializerResult serialize(ODataRequest request, EntityCollection result) throws SerializerException, ODataJPASerializerException { final EdmEntitySet targetEdmEntitySet = Util.determineTargetEntitySet(uriInfo.getUriResourceParts()); final EdmEntityType entityType = targetEdmEntitySet.getEntityType(); final ContextURL contextUrl = ContextURL.with() .entitySet(targetEdmEntitySet) .build(); final EntitySerializerOptions options = EntitySerializerOptions.with() .contextURL(contextUrl) .expand(uriInfo.getExpandOption()) .build(); return serializer.entity(serviceMetadata, entityType, result .getEntities() .get(0), options); }
SerializerException cachedException = null; try { final ContextURL contextURL = checkContextURL(options == null ? null : options.getContextURL()); CircleStreamBuffer buffer = new CircleStreamBuffer(); outputStream = buffer.getOutputStream(); String name = contextURL == null ? null:contextURL.getEntitySetOrSingletonOrType(); writeEntity(metadata, entityType, entity, contextURL, options == null ? null : options.getExpand(), null, options == null ? null : options.getSelect(), options == null ? false : options.getWriteOnlyReferences(), null, name, json);
@Override public SerializerResult serialize(final Annotatable annotatable, final EdmType entityType) throws SerializerException { final EntityCollection result = (EntityCollection) annotatable; final String selectList = uriHelper.buildContextURLSelectList((EdmEntityType) entityType, uriInfo.getExpandOption(), uriInfo.getSelectOption()); final ContextURL contextUrl = ContextURL.with() .type(entityType) .selectList(selectList) .build(); final EntitySerializerOptions options = EntitySerializerOptions.with() .contextURL(contextUrl) .select(uriInfo.getSelectOption()) .expand(uriInfo.getExpandOption()) .build(); return serializer.entity(serviceMetadata, (EdmEntityType) entityType, result .getEntities() .get(0), options); }
@Override public SerializerResult entity(final ServiceMetadata metadata, final EdmEntityType entityType, final Entity entity, final EntitySerializerOptions options) throws SerializerException { final ContextURL contextURL = checkContextURL(options == null ? null : options.getContextURL()); final String name = contextURL == null ? null : contextURL.getEntitySetOrSingletonOrType(); if (options != null && options.getWriteOnlyReferences()) { return entityReference(entity, ReferenceSerializerOptions.with().contextURL(contextURL).build()); writer.writeStartDocument(DEFAULT_CHARSET, "1.0"); writeEntity(metadata, entityType, entity, contextURL, options == null ? null : options.getExpand(), null, options == null ? null : options.getSelect(), options == null ? null : options.xml10InvalidCharReplacement(), writer, true, false, name, null); writer.writeEndDocument();
return (T) EntitySerializerOptions.with() .contextURL(contextUrl) .expand(uriInfo.getExpandOption()).select(this.uriInfo.getSelectOption())
private Builder() { options = new EntitySerializerOptions(); }
@Override public SerializerResult entity(final ServiceMetadata metadata, final EdmEntityType entityType, final Entity entity, final EntitySerializerOptions options) throws SerializerException { final ContextURL contextURL = checkContextURL(options == null ? null : options.getContextURL()); final String name = contextURL == null ? null : contextURL.getEntitySetOrSingletonOrType(); if (options != null && options.getWriteOnlyReferences()) { return entityReference(entity, ReferenceSerializerOptions.with().contextURL(contextURL).build()); writer.writeStartDocument(DEFAULT_CHARSET, "1.0"); writeEntity(metadata, entityType, entity, contextURL, options == null ? null : options.getExpand(), null, options == null ? null : options.getSelect(), options == null ? null : options.xml10InvalidCharReplacement(), writer, true, false, name, null); writer.writeEndDocument();
return (T) EntitySerializerOptions.with() .contextURL(contextUrl) .expand(uriInfo.getExpandOption()).select(this.uriInfo.getSelectOption())