Author: archanarai
Date: Tue Nov 14 10:16:34 2017
New Revision: 1815196
URL: http://svn.apache.org/viewvc?rev=1815196&view=rev
Log:
CMS commit to olingo by archanarai
Modified:
olingo/site/trunk/content/doc/odata4/tutorials/action/tutorial_bound_action.mdtext
Modified:
olingo/site/trunk/content/doc/odata4/tutorials/action/tutorial_bound_action.mdtext
URL:
http://svn.apache.org/viewvc/olingo/site/trunk/content/doc/odata4/tutorials/action/tutorial_bound_action.mdtext?rev=1815196&r1=1815195&r2=1815196&view=diff
==============================================================================
---
olingo/site/trunk/content/doc/odata4/tutorials/action/tutorial_bound_action.mdtext
(original)
+++
olingo/site/trunk/content/doc/odata4/tutorials/action/tutorial_bound_action.mdtext
Tue Nov 14 10:16:34 2017
@@ -417,8 +417,7 @@ We also create methods for GetDiscounted
return collection;
}
- public Entity getBoundFunctionEntity(EdmAction function, Integer amount,
- List<UriParameter> keyParams) throws ODataApplicationException {
+ public Entity getBoundFunctionEntity(EdmAction function, Integer amount)
throws ODataApplicationException {
if ("GetDiscountedProduct".equals(function.getName())) {
for (Entity entity : categoryList) {
if(amount== entity.getProperty("amount")){
@@ -500,28 +499,26 @@ Like by reading entity collections, the
// then fetch the entity collection for the target type
responseEntityCollection =
storage.getBoundFunctionEntityCollection(function, amount);
}
- }
-
-Then the result has to be serialized. The only difference to entity sets is
the way how the EdmEntityType is determined.
-
- ::::java
+ }
// 3rd: create and configure a serializer
- ContextURL contextUrl =
ContextURL.with().entitySet(responseEdmEntitySet).build();
- final String id = request.getRawBaseUri() + "/" +
responseEdmEntitySet.getName();
- EntityCollectionSerializerOptions opts =
EntityCollectionSerializerOptions.with()
+ ContextURL contextUrl =
ContextURL.with().entitySet(responseEdmEntitySet).build();
+ final String id = request.getRawBaseUri() + "/" +
responseEdmEntitySet.getName();
+ EntityCollectionSerializerOptions opts =
EntityCollectionSerializerOptions.with()
.contextURL(contextUrl).id(id).build();
- EdmEntityType edmEntityType = responseEdmEntitySet.getEntityType();
+ EdmEntityType edmEntityType = responseEdmEntitySet.getEntityType();
- ODataSerializer serializer = odata.createSerializer(responseFormat);
- SerializerResult serializerResult =
serializer.entityCollection(serviceMetadata, edmEntityType,
+ ODataSerializer serializer = odata.createSerializer(responseFormat);
+ SerializerResult serializerResult =
serializer.entityCollection(serviceMetadata, edmEntityType,
responseEntityCollection, opts);
- // 4th: configure the response object: set the body, headers and status
code
- response.setContent(serializerResult.getContent());
- response.setStatusCode(HttpStatusCode.OK.getStatusCode());
- response.setHeader(HttpHeader.CONTENT_TYPE,
responseFormat.toContentTypeString());
+ // 4th: configure the response object: set the body, headers and status
code
+ response.setContent(serializerResult.getContent());
+ response.setStatusCode(HttpStatusCode.OK.getStatusCode());
+ response.setHeader(HttpHeader.CONTENT_TYPE,
responseFormat.toContentTypeString());
}
+
+
Next we will implement the processor to read a single entity. The
implementation is quite similar to the implementation of the collection
processor.
::::java