@Override public SerializerResult serialize(final ODataRequest request, final EntityCollection result) throws SerializerException { return new JPAValueSerializerResult(serializer.count(result.getCount())); }
@Override public SerializerResult serialize(final Annotatable result, final EdmType entityType) throws SerializerException, ODataJPASerializerException { final PrimitiveValueSerializerOptions options = PrimitiveValueSerializerOptions.with().build(); return new JPAValueSerializerResult(serializer.primitiveValue((EdmPrimitiveType) entityType, ((Property) result) .getValue(), options)); }
throw new ODataJPASerializerException(ODataJPASerializerException.MessageKeys.RESULT_NOT_FOUND, HttpStatusCode.INTERNAL_SERVER_ERROR); serializerResult = serializer.binary((byte[]) property.getValue()); } else { serializerResult = serializer.primitiveValue(edmPropertyType, info.getProperty().getValue(), options);
@Override public void processBatch(final BatchFacade facade, final ODataRequest request, final ODataResponse response) throws ODataApplicationException, ODataLibraryException { final int handle = context.getDebugger().startRuntimeMeasurement(this, "processBatch"); final String boundary = facade.extractBoundaryFromContentType(request.getHeader(HttpHeader.CONTENT_TYPE)); final BatchOptions options = BatchOptions.with() .rawBaseUri(request.getRawBaseUri()) .rawServiceResolutionUri(request.getRawServiceResolutionUri()) .build(); final List<BatchRequestPart> requestParts = odata.createFixedFormatDeserializer() .parseBatchRequest(request.getBody(), boundary, options); final List<ODataResponsePart> responseParts = new ArrayList<>(); for (final BatchRequestPart part : requestParts) { responseParts.add(facade.handleBatchRequest(part)); } final String responseBoundary = "batch_" + UUID.randomUUID().toString(); final InputStream responseContent = odata.createFixedFormatSerializer().batchResponse(responseParts, responseBoundary); response.setHeader(HttpHeader.CONTENT_TYPE, ContentType.MULTIPART_MIXED + ";boundary=" + responseBoundary); response.setContent(responseContent); response.setStatusCode(HttpStatusCode.ACCEPTED.getStatusCode()); context.getDebugger().stopRuntimeMeasurement(handle); }
final InputStream responseContent = odata.createFixedFormatSerializer().batchResponse( responseParts, responseBoundary); response.setHeader(HttpHeader.CONTENT_TYPE, ContentType.MULTIPART_MIXED + ";boundary="
public void writeCount(int count) throws SerializerException { assert (!isClosed()); this.response.setContent(this.serializer.count(count)); writeOK(ContentType.TEXT_PLAIN); close(); }
public void write(Object value) throws SerializerException { if (value == null) { writeNoContent(true); return; } if (this.type != null) { PrimitiveValueSerializerOptions options = PrimitiveValueSerializerOptions.with() .facetsFrom(this.type).build(); this.response.setContent(this.serializer.primitiveValue((EdmPrimitiveType) this.type.getType(), value, options)); } else { PrimitiveValueSerializerOptions options = PrimitiveValueSerializerOptions.with() .nullable(this.returnType.isNullable()).maxLength(this.returnType.getMaxLength()) .precision(this.returnType.getPrecision()).scale(this.returnType.getScale()).build(); this.response.setContent(this.serializer.primitiveValue( (EdmPrimitiveType) this.returnType.getType(), value, options)); } writeOK(ContentType.TEXT_PLAIN); }
final InputStream responseContent = odata.createFixedFormatSerializer().batchResponse( responseParts, responseBoundary); response.setHeader(HttpHeader.CONTENT_TYPE, ContentType.MULTIPART_MIXED + ";boundary="
public void writeCount(int count) throws SerializerException { assert (!isClosed()); this.response.setContent(this.serializer.count(count)); writeOK(ContentType.TEXT_PLAIN); close(); }
public void write(Object value) throws SerializerException { if (value == null) { writeNoContent(true); return; } if (this.type != null) { PrimitiveValueSerializerOptions options = PrimitiveValueSerializerOptions.with() .facetsFrom(this.type).build(); this.response.setContent(this.serializer.primitiveValue((EdmPrimitiveType) this.type.getType(), value, options)); } else { PrimitiveValueSerializerOptions options = PrimitiveValueSerializerOptions.with() .nullable(this.returnType.isNullable()).maxLength(this.returnType.getMaxLength()) .precision(this.returnType.getPrecision()).scale(this.returnType.getScale()).build(); this.response.setContent(this.serializer.primitiveValue( (EdmPrimitiveType) this.returnType.getType(), value, options)); } writeOK(ContentType.TEXT_PLAIN); }