public void writeEdmBinary(byte[] value) throws SerializerException { if (value == null) { writeNoContent(true); return; } this.response.setContent(new ByteArrayInputStream(value)); writeOK(ContentType.APPLICATION_OCTET_STREAM); }
public void visit(PrimitiveValueResponse response) throws ODataLibraryException, ODataApplicationException { response.writeServerError(true); }
public void visit(PrimitiveValueResponse response) throws ODataLibraryException, ODataApplicationException { EntityCollection entitySet = (EntityCollection)queryResponse; if (!entitySet.getEntities().isEmpty()) { Entity entity = entitySet.getEntities().get(0); EdmProperty edmProperty = request.getUriResourceProperty().getProperty(); Property property = entity.getProperty(edmProperty.getName()); if (property == null) { response.writeNotFound(true); } else if (property.getValue() == null) { response.writeNoContent(true); } else { response.write(property.getValue()); } } else { response.writeNotFound(true); } }
@Override public void visit(PrimitiveValueResponse response) throws ODataApplicationException, SerializerException { EdmProperty edmProperty = request.getUriResourceProperty().getProperty(); Property property = details.entity.getProperty(edmProperty.getName()); response.write(property.getValue()); }
public static PrimitiveValueResponse getInstance(ServiceRequest request, ODataResponse response, boolean collection, EdmProperty type) { FixedFormatSerializer serializer = request.getOdata().createFixedFormatSerializer(); return new PrimitiveValueResponse(request.getServiceMetaData(), serializer, response, collection, type, request.getPreferences()); }
@Override public void visit(PrimitiveValueResponse response) throws ODataLibraryException, ODataApplicationException { selectProcessor(PrimitiveValueProcessor.class).readPrimitiveValue( request.getODataRequest(), response.getODataResponse(), request.getUriInfo(), request.getResponseContentType()); }
@Override public void execute(ServiceHandler handler, ODataResponse response) throws ODataLibraryException, ODataApplicationException { EdmProperty edmProperty = getUriResourceProperty().getProperty(); if (isGET()) { handler.read(DataRequest.this, PrimitiveValueResponse.getInstance(DataRequest.this, response, isCollection(), getUriResourceProperty().getProperty())); } else if (isDELETE()) { Property property = new Property( edmProperty.getType().getFullQualifiedName().getFullQualifiedNameAsString(), edmProperty.getName()); PropertyResponse propertyResponse = PropertyResponse.getInstance(DataRequest.this, response, edmProperty.getType(), getContextURL(odata), edmProperty.isCollection()); handler.updateProperty(DataRequest.this, property, true, false, getETag(), propertyResponse); } else if (isPUT()) { PropertyResponse propertyResponse = PropertyResponse.getInstance(DataRequest.this, response, edmProperty.getType(), getContextURL(odata), edmProperty.isCollection()); Property property = new Property( edmProperty.getType().getFullQualifiedName().getFullQualifiedNameAsString(), edmProperty.getName()); property.setValue(ValueType.PRIMITIVE, getRawValueFromClient()); handler.updateProperty(DataRequest.this, property, true, false, getETag(), propertyResponse); } }
public static PrimitiveValueResponse getInstance(ServiceRequest request, ODataResponse response, boolean collection, EdmProperty type) { FixedFormatSerializer serializer = request.getOdata().createFixedFormatSerializer(); return new PrimitiveValueResponse(request.getServiceMetaData(), serializer, response, collection, type, request.getPreferences()); }
@Override public void visit(PrimitiveValueResponse response) throws ODataLibraryException, ODataApplicationException { selectProcessor(PrimitiveValueProcessor.class).readPrimitiveValue( request.getODataRequest(), response.getODataResponse(), request.getUriInfo(), request.getResponseContentType()); }
@Override public void execute(ServiceHandler handler, ODataResponse response) throws ODataLibraryException, ODataApplicationException { EdmProperty edmProperty = getUriResourceProperty().getProperty(); if (isGET()) { handler.read(DataRequest.this, PrimitiveValueResponse.getInstance(DataRequest.this, response, isCollection(), getUriResourceProperty().getProperty())); } else if (isDELETE()) { Property property = new Property( edmProperty.getType().getFullQualifiedName().getFullQualifiedNameAsString(), edmProperty.getName()); PropertyResponse propertyResponse = PropertyResponse.getInstance(DataRequest.this, response, edmProperty.getType(), getContextURL(odata), edmProperty.isCollection()); handler.updateProperty(DataRequest.this, property, true, false, getETag(), propertyResponse); } else if (isPUT()) { PropertyResponse propertyResponse = PropertyResponse.getInstance(DataRequest.this, response, edmProperty.getType(), getContextURL(odata), edmProperty.isCollection()); Property property = new Property( edmProperty.getType().getFullQualifiedName().getFullQualifiedNameAsString(), edmProperty.getName()); property.setValue(ValueType.PRIMITIVE, getRawValueFromClient()); handler.updateProperty(DataRequest.this, property, true, false, getETag(), propertyResponse); } }
public void writeEdmBinary(byte[] value) throws SerializerException { if (value == null) { writeNoContent(true); return; } this.response.setContent(new ByteArrayInputStream(value)); writeOK(ContentType.APPLICATION_OCTET_STREAM); }
public static PrimitiveValueResponse getInstance(ServiceRequest request, ODataResponse response, boolean collection, EdmReturnType type) { FixedFormatSerializer serializer = request.getOdata().createFixedFormatSerializer(); return new PrimitiveValueResponse(request.getServiceMetaData(), serializer, response, collection, type, request.getPreferences()); }
public void visit(PrimitiveValueResponse response) throws ODataLibraryException, ODataApplicationException { response.writeServerError(true); }
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); }
public static PrimitiveValueResponse getInstance(ServiceRequest request, ODataResponse response, boolean collection, EdmReturnType type) { FixedFormatSerializer serializer = request.getOdata().createFixedFormatSerializer(); return new PrimitiveValueResponse(request.getServiceMetaData(), serializer, response, collection, type, request.getPreferences()); }
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); }