You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by sk...@apache.org on 2014/07/08 10:17:35 UTC

[17/18] git commit: [OLINGO-337] merger origin/master

[OLINGO-337] merger origin/master


Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/811fff54
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/811fff54
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/811fff54

Branch: refs/heads/olingo337
Commit: 811fff545c64364d66af0d8f4ba6e57f585479d3
Parents: aff42fc d860717
Author: Stephan Klevenz <st...@sap.com>
Authored: Tue Jul 8 10:10:31 2014 +0200
Committer: Stephan Klevenz <st...@sap.com>
Committed: Tue Jul 8 10:10:36 2014 +0200

----------------------------------------------------------------------
 .../olingo/commons/core/data/PropertyImpl.java  |   4 +-
 .../serializer/json/ODataJsonSerializer.java    | 120 ++---
 .../json/ODataJsonSerializerTest.java           | 523 +++++++++++++++++--
 .../tecsvc/processor/SampleJsonProcessor.java   | 157 +++++-
 4 files changed, 681 insertions(+), 123 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/811fff54/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/SampleJsonProcessor.java
----------------------------------------------------------------------
diff --cc lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/SampleJsonProcessor.java
index b3dc02d,e34fd42..ffb8d7f
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/SampleJsonProcessor.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/SampleJsonProcessor.java
@@@ -95,10 -91,36 +92,36 @@@ public class SampleJsonProcessor implem
      LOG.info("Finished in " + (System.nanoTime() - time) / 1000 + " microseconds");
  
      response.setStatusCode(HttpStatusCode.OK.getStatusCode());
 -    response.setHeader("Content-Type", ContentType.APPLICATION_JSON.toContentTypeString());
 +    response.setHeader(HttpHeader.CONTENT_TYPE, requestedContentType.toContentTypeString());
    }
  
-   protected Entity createEntity() {
+   private ContextURL getContextUrl(ODataRequest request, EdmEntityType entityType) {
+     return ContextURL.getInstance(URI.create(request.getRawBaseUri() + "/" + entityType.getName()));
+   }
+ 
+   public EdmEntityType getEntityType(UriInfo uriInfo) {
+     return getEntitySet(uriInfo).getEntityType();
+   }
+ 
+   public EdmEntitySet getEntitySet(UriInfo uriInfo) {
+     List<UriResource> resourcePaths = uriInfo.getUriResourceParts();
+     if(resourcePaths.isEmpty()) {
+       throw new RuntimeException("Invalid resource path.");
+     }
+     String entitySetName = resourcePaths.get(resourcePaths.size()-1).toString();
+     return edm.getEntityContainer(new FullQualifiedName("com.sap.odata.test1", "Container"))
+             .getEntitySet(entitySetName);
+   }
+ 
+   protected Entity createEntity(EdmEntityType entityType) {
+     boolean complex = (entityType.getName().contains("Comp"));
+     if(entityType.getName().contains("Coll")) {
+       return createEntityWithCollection(complex);
+     }
+     return createEntity(complex);
+   }
+ 
+   protected Entity createEntity(boolean complex) {
      Entity entity = new EntityImpl();
      Property property = new PropertyImpl();
      property.setName("PropertyString");