当前位置: 首页>>代码示例>>Java>>正文


Java EntityCollectionSerializerOptions类代码示例

本文整理汇总了Java中org.apache.olingo.server.api.serializer.EntityCollectionSerializerOptions的典型用法代码示例。如果您正苦于以下问题:Java EntityCollectionSerializerOptions类的具体用法?Java EntityCollectionSerializerOptions怎么用?Java EntityCollectionSerializerOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


EntityCollectionSerializerOptions类属于org.apache.olingo.server.api.serializer包,在下文中一共展示了EntityCollectionSerializerOptions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: serializeDeltaPayloads

import org.apache.olingo.server.api.serializer.EntityCollectionSerializerOptions; //导入依赖的package包/类
private SerializerResult serializeDeltaPayloads(final ODataRequest request, final Delta delta, 
    final EdmEntitySet edmEntitySet, final EdmEntityType edmEntityType,
    final ContentType requestedFormat, final ExpandOption expand, final SelectOption select,
    final CountOption countOption, String id) throws ODataLibraryException {

  return odata.createEdmDeltaSerializer(requestedFormat, request.getHeaders(HttpHeader.ODATA_VERSION))
      .entityCollection(serviceMetadata,
      edmEntityType, delta,
      EntityCollectionSerializerOptions.with()
      .contextURL(isODataMetadataNone(requestedFormat) ? null :
        getContextUrl(request.getRawODataPath(), edmEntitySet, edmEntityType, false, expand, select, false))
    .count(countOption)
    .expand(expand).select(select)
    .id(id)
    .build());
 
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:18,代码来源:TechnicalEntityProcessor.java

示例2: serializeEntityCollection

import org.apache.olingo.server.api.serializer.EntityCollectionSerializerOptions; //导入依赖的package包/类
private SerializerResult serializeEntityCollection(final ODataRequest request, final EntityCollection
    entityCollection, final EdmEntitySet edmEntitySet, final EdmEntityType edmEntityType,
    final ContentType requestedFormat, final ExpandOption expand, final SelectOption select,
    final CountOption countOption, String id, final boolean isContNav) throws ODataLibraryException {

  return odata.createSerializer(requestedFormat, request.getHeaders(HttpHeader.ODATA_VERSION))
      .entityCollection(
      serviceMetadata,
      edmEntityType,
      entityCollection,
      EntityCollectionSerializerOptions.with()
          .contextURL(isODataMetadataNone(requestedFormat) ? null :
              getContextUrl(request.getRawODataPath(), edmEntitySet, edmEntityType, false, expand, select, isContNav))
          .count(countOption)
          .expand(expand).select(select)
          .id(id)
          .build());
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:19,代码来源:TechnicalEntityProcessor.java

示例3: entityWithStreamMetadataMinimal

import org.apache.olingo.server.api.serializer.EntityCollectionSerializerOptions; //导入依赖的package包/类
@Test
public void entityWithStreamMetadataMinimal() throws Exception {
  final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESWithStream");
  final EntityCollection collection = data.readAll(edmEntitySet);
  InputStream result = serializer.entityCollection(metadata, edmEntitySet.getEntityType(), collection,
      EntityCollectionSerializerOptions.with()
      .contextURL(ContextURL.with().entitySet(edmEntitySet).build())
      .build()).getContent();
  final String resultString = IOUtils.toString(result);
  final String expectedResult = "{\"@odata.context\":\"$metadata#ESWithStream\","
      + "\"@odata.metadataEtag\":\"W/\\\"metadataETag\\\"\","
      + "\"value\":[{\"PropertyInt16\":32767},"
      + "{\"PropertyInt16\":7,\"[email protected]\":\"eTag\","
      + "\"[email protected]\":\"image/jpeg\"}]}";
  Assert.assertEquals(expectedResult, resultString);
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:17,代码来源:ODataJsonSerializerTest.java

示例4: entitySetTwoPrimNoMetadata

import org.apache.olingo.server.api.serializer.EntityCollectionSerializerOptions; //导入依赖的package包/类
@Test
public void entitySetTwoPrimNoMetadata() throws Exception {
  final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESTwoPrim");
  final EntityCollection entitySet = data.readAll(edmEntitySet);
  final String resultString = IOUtils.toString(serializerNoMetadata
      .entityCollection(metadata, edmEntitySet.getEntityType(), entitySet,
          EntityCollectionSerializerOptions.with()
              .contextURL(ContextURL.with().entitySet(edmEntitySet).build())
              .build()).getContent());
  final String expectedResult = "{\"value\":["
      + "{\"PropertyInt16\":32766,\"PropertyString\":\"Test String1\"},"
      + "{\"PropertyInt16\":-365,\"PropertyString\":\"Test String2\"},"
      + "{\"PropertyInt16\":-32766,\"PropertyString\":null},"
      + "{\"PropertyInt16\":32767,\"PropertyString\":\"Test String4\"}]}";
  Assert.assertEquals(expectedResult, resultString);
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:17,代码来源:ODataJsonSerializerTest.java

示例5: entitySetMedia

import org.apache.olingo.server.api.serializer.EntityCollectionSerializerOptions; //导入依赖的package包/类
@Test
public void entitySetMedia() throws Exception {
  final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESMedia");
  final EntityCollection entitySet = data.readAll(edmEntitySet);
  final String resultString = IOUtils.toString(serializer.entityCollection(metadata,
      edmEntitySet.getEntityType(), entitySet,
      EntityCollectionSerializerOptions.with()
          .contextURL(ContextURL.with().entitySet(edmEntitySet).build()).build()).getContent());
  final String expectedResult = "{\"@odata.context\":\"$metadata#ESMedia\","
      + "\"@odata.metadataEtag\":\"W/\\\"metadataETag\\\"\","
      + "\"value\":["
      + "{\"@odata.mediaEtag\":\"W/\\\"1\\\"\",\"@odata.mediaContentType\":\"image/svg+xml\","
      + "\"@odata.mediaEditLink\":\"ESMedia(1)/$value\",\"PropertyInt16\":1},"
      + "{\"@odata.mediaEtag\":\"W/\\\"2\\\"\",\"@odata.mediaContentType\":\"image/svg+xml\","
      + "\"@odata.mediaEditLink\":\"ESMedia(2)/$value\",\"PropertyInt16\":2},"
      + "{\"@odata.mediaEtag\":\"W/\\\"3\\\"\",\"@odata.mediaContentType\":\"image/svg+xml\","
      + "\"@odata.mediaEditLink\":\"ESMedia(3)/$value\",\"PropertyInt16\":3},"
      + "{\"@odata.mediaEtag\":\"W/\\\"4\\\"\",\"@odata.mediaContentType\":\"image/svg+xml\","
      + "\"@odata.mediaEditLink\":\"ESMedia(4)/$value\",\"PropertyInt16\":4}]}";
  Assert.assertEquals(expectedResult, resultString);
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:22,代码来源:ODataJsonSerializerTest.java

示例6: addedDeltaLink

import org.apache.olingo.server.api.serializer.EntityCollectionSerializerOptions; //导入依赖的package包/类
@Test
public void addedDeltaLink() throws Exception {
  final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESDelta");
  Delta delta = new Delta();
  List<DeltaLink> addedLinks = new ArrayList<DeltaLink>();
  DeltaLink link1 = new DeltaLink();
  link1.setRelationship("NavPropertyETAllPrimOne");
  link1.setSource(new URI("ESDelta(100)"));
  link1.setTarget(new URI("ESAllPrim(0)"));
  addedLinks.add(link1 );
  delta.getAddedLinks().addAll(addedLinks );
   InputStream stream = ser.entityCollection(metadata, edmEntitySet.getEntityType(), delta ,
      EntityCollectionSerializerOptions.with()
      .contextURL(ContextURL.with().entitySet(edmEntitySet).build())
      .build()).getContent();
     String jsonString = IOUtils.toString(stream);
     final String expectedResult = "{"
         + "\"@context\":\"$metadata#ESDelta/$delta\",\"value\":[{"
         + "\"@context\":\"#ESDelta/$link\",\"source\":\"ESDelta(100)\",\"relationship\":\"NavPropertyETAllPrimOne\","
         + "\"target\":\"ESAllPrim(0)\"}]"          
         + "}";
     Assert.assertNotNull(jsonString);
     Assert.assertEquals(expectedResult, jsonString);
   }
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:25,代码来源:JsonDeltaSerializerWithNavigationsTest.java

示例7: deletedDeltaLink

import org.apache.olingo.server.api.serializer.EntityCollectionSerializerOptions; //导入依赖的package包/类
@Test
public void deletedDeltaLink() throws Exception {
  final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESDelta");
  Delta delta = new Delta();
  List<DeltaLink> deletedLinks = new ArrayList<DeltaLink>();
  DeltaLink link1 = new DeltaLink();
  link1.setRelationship("NavPropertyETAllPrimOne");
  link1.setSource(new URI("ESDelta(100)"));
  link1.setTarget(new URI("ESAllPrim(0)"));
  deletedLinks.add(link1 );
  delta.getDeletedLinks().addAll(deletedLinks);
   InputStream stream = ser.entityCollection(metadata, edmEntitySet.getEntityType(), delta ,
      EntityCollectionSerializerOptions.with()
      .contextURL(ContextURL.with().entitySet(edmEntitySet).build())
      .build()).getContent();
     String jsonString = IOUtils.toString(stream);
     final String expectedResult = "{"
         + "\"@context\":\"$metadata#ESDelta/$delta\",\"value\":[{"
         + "\"@context\":\"#ESDelta/$deletedLink\",\"source\":\"ESDelta(100)\","
         + "\"relationship\":\"NavPropertyETAllPrimOne\","
         + "\"target\":\"ESAllPrim(0)\"}]"          
         + "}";
     Assert.assertNotNull(jsonString);
     Assert.assertEquals(expectedResult, jsonString);
   }
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:26,代码来源:JsonDeltaSerializerWithNavigationsTest.java

示例8: addedDifferentdDeltaEntity

import org.apache.olingo.server.api.serializer.EntityCollectionSerializerOptions; //导入依赖的package包/类
@Test
public void addedDifferentdDeltaEntity() throws Exception {
  final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
  final EdmEntitySet edmEntitySet2 = entityContainer.getEntitySet("ESDelta");
  Delta delta = new Delta();
  final Entity entity = data.readAll(edmEntitySet).getEntities().get(0);
  List<Entity> addedEntity = new ArrayList<Entity>();
  addedEntity.add(entity);
  delta.getEntities().addAll(addedEntity);
   InputStream stream = ser.entityCollection(metadata, edmEntitySet2.getEntityType(), delta ,
      EntityCollectionSerializerOptions.with()
      .contextURL(ContextURL.with().entitySet(edmEntitySet2).build())
      .build()).getContent();
     String jsonString = IOUtils.toString(stream);
     final String expectedResult = "{"
       +"\"@context\":\"$metadata#ESDelta/$delta\",\"value\":[{"
       + "\"@context\":\"#ESAllPrim/$entity\",\"@id\":\"ESAllPrim(32767)\","
       + "\"PropertyInt16\":32767,\"PropertyString\":\"First Resource - positive values\"}]"
       + "}";
     Assert.assertNotNull(jsonString);
     Assert.assertEquals(expectedResult, jsonString);
   }
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:23,代码来源:JsonDeltaSerializerWithNavigationsTest.java

示例9: testDeltaForStream

import org.apache.olingo.server.api.serializer.EntityCollectionSerializerOptions; //导入依赖的package包/类
@Test
public void testDeltaForStream() throws Exception {
  final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESWithStream");
  Delta delta = new Delta();
  List<DeltaLink> addedLinks = new ArrayList<DeltaLink>();
  DeltaLink link1 = new DeltaLink();
  link1.setRelationship("NavPropertyETAllPrimOne");
  link1.setSource(new URI("ESDelta(100)"));
  link1.setTarget(new URI("ESAllPrim(0)"));
  addedLinks.add(link1 );
  delta.getAddedLinks().addAll(addedLinks );
   InputStream stream = ser.entityCollection(metadata, edmEntitySet.getEntityType(), delta ,
      EntityCollectionSerializerOptions.with()
      .contextURL(ContextURL.with().entitySet(edmEntitySet).build())
      .build()).getContent();
     String jsonString = IOUtils.toString(stream);
     final String expectedResult = "{"
         + "\"@context\":\"$metadata#ESWithStream/$delta\","
         + "\"value\":[{\"@context\":\"#ESWithStream/$link\","
         + "\"source\":\"ESDelta(100)\",\"relationship\":"
         + "\"NavPropertyETAllPrimOne\",\"target\":\"ESAllPrim(0)\"}]"      
         + "}";
     Assert.assertNotNull(jsonString);
     Assert.assertEquals(expectedResult, jsonString);
   }
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:26,代码来源:JsonDeltaSerializerWithNavigationsTest.java

示例10: negativeDeltaEntityTest

import org.apache.olingo.server.api.serializer.EntityCollectionSerializerOptions; //导入依赖的package包/类
@Test(expected = SerializerException.class)
public void negativeDeltaEntityTest() throws Exception {
  final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESDelta");
  Delta delta = new Delta();
  
  final Entity entity2 = data.readAll(edmEntitySet).getEntities().get(1);
  List<Entity> addedEntity = new ArrayList<Entity>();
  Entity changedEntity = new Entity();
  changedEntity.addProperty(entity2.getProperty("PropertyString"));
  addedEntity.add(changedEntity);
  delta.getEntities().addAll(addedEntity);
   ser.entityCollection(metadata, edmEntitySet.getEntityType(), delta ,
      EntityCollectionSerializerOptions.with()
      .contextURL(ContextURL.with().entitySet(edmEntitySet).build())
      .build()).getContent();
    
   }
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:18,代码来源:JsonDeltaSerializerWithNavigationsTest.java

示例11: negativeLinkDeltaTest2

import org.apache.olingo.server.api.serializer.EntityCollectionSerializerOptions; //导入依赖的package包/类
@Test(expected = SerializerException.class)
public void negativeLinkDeltaTest2() throws Exception {
  final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESDelta");
  Delta delta = new Delta();
  
  List<DeltaLink> addedLinks = new ArrayList<DeltaLink>();
  DeltaLink link1 = new DeltaLink();
  link1.setRelationship("NavPropertyETAllPrimOne");
  link1.setTarget(new URI("ESAllPrim(0)"));
  addedLinks.add(link1 );
  delta.getAddedLinks().addAll(addedLinks );
     
  ser.entityCollection(metadata, edmEntitySet.getEntityType(), delta ,
      EntityCollectionSerializerOptions.with()
      .contextURL(ContextURL.with().entitySet(edmEntitySet).build())
      .build()).getContent();      
   }
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:18,代码来源:JsonDeltaSerializerWithNavigationsTest.java

示例12: negativeLinkDeltaTest3

import org.apache.olingo.server.api.serializer.EntityCollectionSerializerOptions; //导入依赖的package包/类
@Test(expected = SerializerException.class)
public void negativeLinkDeltaTest3() throws Exception {
  final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESDelta");
  Delta delta = new Delta();
  
  List<DeltaLink> addedLinks = new ArrayList<DeltaLink>();
  DeltaLink link1 = new DeltaLink();
  link1.setRelationship("NavPropertyETAllPrimOne");
  link1.setSource(new URI("ESDelta(100)"));
  addedLinks.add(link1 );
  delta.getAddedLinks().addAll(addedLinks );
     
  ser.entityCollection(metadata, edmEntitySet.getEntityType(), delta ,
      EntityCollectionSerializerOptions.with()
      .contextURL(ContextURL.with().entitySet(edmEntitySet).build())
      .build()).getContent();      
   }
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:18,代码来源:JsonDeltaSerializerWithNavigationsTest.java

示例13: negativeDeltaDeletedEntityTest2

import org.apache.olingo.server.api.serializer.EntityCollectionSerializerOptions; //导入依赖的package包/类
@Test(expected = SerializerException.class)
public void negativeDeltaDeletedEntityTest2() throws Exception {
  final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESDelta");
  Delta delta = new Delta();   
    
  List<DeletedEntity> deletedEntity = new ArrayList<DeletedEntity>();
  DeletedEntity delEntity1 = new DeletedEntity();
  delEntity1.setId(new URI("ESDelta(100)"));
 
  deletedEntity.add(delEntity1);
  delta.getDeletedEntities().addAll(deletedEntity);    
 
  ser.entityCollection(metadata, edmEntitySet.getEntityType(), delta ,
      EntityCollectionSerializerOptions.with()
      .contextURL(ContextURL.with().entitySet(edmEntitySet).build())
      .build()).getContent();
    
   }
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:19,代码来源:JsonDeltaSerializerWithNavigationsTest.java

示例14: entityWithStreamMetadataMinimal

import org.apache.olingo.server.api.serializer.EntityCollectionSerializerOptions; //导入依赖的package包/类
@Test
public void entityWithStreamMetadataMinimal() throws Exception {
  final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESWithStream");
  final EntityCollection collection = data.readAll(edmEntitySet);
  InputStream result = serializer.entityCollection(metadata, edmEntitySet.getEntityType(), collection,
      EntityCollectionSerializerOptions.with()
      .contextURL(ContextURL.with().entitySet(edmEntitySet).build())
      .build()).getContent();
  final String resultString = IOUtils.toString(result);
  final String expectedResult = "{\"@context\":\"$metadata#ESWithStream\","
      + "\"@metadataEtag\":\"W/\\\"metadataETag\\\"\","
      + "\"value\":[{\"PropertyInt16\":32767},"
      + "{\"PropertyInt16\":7,\"[email protected]\":\"eTag\","
      + "\"[email protected]\":\"image/jpeg\"}]}";
  Assert.assertEquals(expectedResult, resultString);
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:17,代码来源:ODataJsonSerializerv01Test.java

示例15: entityWithStreamExpand

import org.apache.olingo.server.api.serializer.EntityCollectionSerializerOptions; //导入依赖的package包/类
@Test
public void entityWithStreamExpand() throws Exception {
  final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESWithStream");
  final EntityCollection collection = data.readAll(edmEntitySet);
  final ExpandOption expand = ExpandSelectMock.mockExpandOption(Collections.singletonList(
      ExpandSelectMock.mockExpandItem(edmEntitySet, "PropertyStream")));
  InputStream result = serializer.entityCollection(metadata, edmEntitySet.getEntityType(), collection,
      EntityCollectionSerializerOptions.with()
      .contextURL(ContextURL.with().entitySet(edmEntitySet).build())
      .expand(expand).build()).getContent();
  final String resultString = IOUtils.toString(result);
  final String expectedResult =  "{\"@context\":\"$metadata#ESWithStream\","
      + "\"@metadataEtag\":\"W/\\\"metadataETag\\\"\","
      + "\"value\":[{\"PropertyInt16\":32767,\"PropertyStream\":\"�ioz�\\\"�\"},"
      + "{\"PropertyInt16\":7,\"[email protected]\":\"eTag\","
      + "\"[email protected]\":\"image/jpeg\",\"PropertyStream\":\"�ioz�\\\"�\"}]}";
  Assert.assertEquals(expectedResult, resultString);
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:19,代码来源:ODataJsonSerializerv01Test.java


注:本文中的org.apache.olingo.server.api.serializer.EntityCollectionSerializerOptions类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。