Package org.apache.olingo.odata2.api.ep

Examples of org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties$ODataEntityProviderPropertiesBuilder


  }

  @Override
  public ODataResponse readEntitySet(final GetEntitySetUriInfo uriInfo, final String contentType)
      throws ODataException {
    final EntityProviderWriteProperties properties =
        EntityProviderWriteProperties.serviceRoot(getContext().getPathInfo().getServiceRoot()).build();

    final List<Map<String, Object>> values = new ArrayList<Map<String, Object>>();

    for (final HashMap<String, String> record : records) {
View Full Code Here


    return response;
  }

  @Override
  public ODataResponse readEntity(final GetEntityUriInfo uriInfo, final String contentType) throws ODataException {
    final EntityProviderWriteProperties properties =
        EntityProviderWriteProperties.serviceRoot(getContext().getPathInfo().getServiceRoot()).build();

    // query
    final String mappedKeyName =
        (String) uriInfo.getTargetEntitySet().getEntityType().getKeyProperties().get(0).getMapping().getObject();
View Full Code Here

    @Override
    public WriteEntryCallbackResult retrieveEntryResult(final WriteEntryCallbackContext context)
        throws ODataApplicationException {
      WriteEntryCallbackResult writeEntryCallbackResult = new WriteEntryCallbackResult();
      EntityProviderWriteProperties inlineProperties =
          EntityProviderWriteProperties.fromProperties(DEFAULT_PROPERTIES).expandSelectTree(
              context.getCurrentExpandSelectTreeNode()).build();
      writeEntryCallbackResult.setInlineProperties(inlineProperties);
      Map<String, Object> buildingData = new HashMap<String, Object>();
      buildingData.put("Id", "1");
View Full Code Here

public class ODataEntityProviderPropertiesTest extends BaseTest {

  @Test
  public void buildFeedProperties() throws Exception {
    URI serviceRoot = new URI("http://localhost:80/");
    EntityProviderWriteProperties properties = EntityProviderWriteProperties.serviceRoot(serviceRoot)
        .inlineCountType(InlineCount.ALLPAGES)
        .inlineCount(1)
        .nextLink("http://localhost")
        .build();

    assertEquals("Wrong base uri.", "http://localhost:80/", properties.getServiceRoot().toASCIIString());
    assertEquals("Wrong inline count type.", InlineCount.ALLPAGES, properties.getInlineCountType());
    assertEquals("Wrong inline count.", Integer.valueOf(1), properties.getInlineCount());
    assertEquals("Wrong nextLink", "http://localhost", properties.getNextLink());
  }
View Full Code Here

    URI serviceRoot = new URI("http://localhost:80/");
    Map<String, ODataCallback> callbacks = new HashMap<String, ODataCallback>();
    callbacks.put("aCallback", new MyCallback(null, null));
    ExpandSelectTreeNode expandSelectTree = new ExpandSelectTreeNodeImpl();
    URI selfLink = new URI("http://some.uri");
    final EntityProviderWriteProperties properties = EntityProviderWriteProperties.serviceRoot(serviceRoot)
        .callbacks(callbacks)
        .expandSelectTree(expandSelectTree)
        .inlineCount(1)
        .inlineCountType(InlineCount.ALLPAGES)
        .mediaResourceMimeType("image/png")
        .nextLink("http://localhost")
        .selfLink(selfLink)
        .includeSimplePropertyType(true)
        .build();

    assertEquals("Wrong amount of callbacks.", 1, properties.getCallbacks().size());
    assertTrue("No callback found.", properties.getCallbacks().containsKey("aCallback"));
    assertEquals("Wrong expand select tree.", expandSelectTree, properties.getExpandSelectTree());
    assertEquals("Wrong self link.", selfLink, properties.getSelfLink());
    assertEquals("Wrong media resource mime type.", "image/png", properties.getMediaResourceMimeType());
    assertEquals("Wrong base uri.", "http://localhost:80/", properties.getServiceRoot().toASCIIString());
    assertEquals("Wrong inline count type.", InlineCount.ALLPAGES, properties.getInlineCountType());
    assertEquals("Wrong inline count.", Integer.valueOf(1), properties.getInlineCount());
    assertEquals("Wrong nextLink", "http://localhost", properties.getNextLink());
    assertTrue("Simple property types should be true", properties.isIncludeSimplePropertyType());
  }
View Full Code Here

  @Test
  public void buildEntryProperties() throws Exception {
    final String mediaResourceMimeType = "text/html";
    final URI serviceRoot = new URI("http://localhost:80/");
    final EntityProviderWriteProperties properties = EntityProviderWriteProperties.serviceRoot(serviceRoot)
        .mediaResourceMimeType(mediaResourceMimeType)
        .build();
    assertEquals("Wrong mime type.", "text/html", properties.getMediaResourceMimeType());
  }
View Full Code Here

    URI serviceRoot = new URI("http://localhost:80/");
    Map<String, ODataCallback> callbacks = new HashMap<String, ODataCallback>();
    callbacks.put("aCallback", new MyCallback(null, null));
    ExpandSelectTreeNode expandSelectTree = new ExpandSelectTreeNodeImpl();
    URI selfLink = new URI("http://some.uri");
    final EntityProviderWriteProperties properties = EntityProviderWriteProperties.serviceRoot(serviceRoot)
        .callbacks(callbacks)
        .expandSelectTree(expandSelectTree)
        .inlineCount(1)
        .inlineCountType(InlineCount.ALLPAGES)
        .mediaResourceMimeType("image/png")
        .nextLink("http://localhost")
        .selfLink(selfLink)
        .includeSimplePropertyType(true)
        .build();

    //
    final EntityProviderWriteProperties fromProperties =
        EntityProviderWriteProperties.fromProperties(properties).build();

    //
    assertEquals(1, fromProperties.getCallbacks().size());
    assertTrue(fromProperties.getCallbacks().containsKey("aCallback"));
    assertEquals(expandSelectTree, fromProperties.getExpandSelectTree());
    assertEquals(selfLink, fromProperties.getSelfLink());
    assertEquals("image/png", fromProperties.getMediaResourceMimeType());
    assertEquals("Wrong base uri.", "http://localhost:80/", fromProperties.getServiceRoot().toASCIIString());
    assertEquals("Wrong inline count type.", InlineCount.ALLPAGES, fromProperties.getInlineCountType());
    assertEquals("Wrong inline count.", Integer.valueOf(1), fromProperties.getInlineCount());
    assertEquals("Wrong nextLink", "http://localhost", fromProperties.getNextLink());
    assertTrue("Simple property types should be true", fromProperties.isIncludeSimplePropertyType());
  }
View Full Code Here

        } catch (final ODataNotFoundException e) {
          values.clear();
        }
        WriteFeedCallbackResult result = new WriteFeedCallbackResult();
        result.setFeedData(values);
        EntityProviderWriteProperties inlineProperties =
            EntityProviderWriteProperties.serviceRoot(getContext().getPathInfo().getServiceRoot()).callbacks(
                getCallbacks(relatedData, entityType)).expandSelectTree(context.getCurrentExpandSelectTreeNode())
                .selfLink(context.getSelfLink()).build();
        result.setInlineProperties(inlineProperties);
        return result;
View Full Code Here

        if (relatedData == null) {
          result.setEntryData(Collections.<String, Object> emptyMap());
        } else {
          result.setEntryData(getStructuralTypeValueMap(relatedData, entityType));

          EntityProviderWriteProperties inlineProperties =
              EntityProviderWriteProperties.serviceRoot(getContext().getPathInfo().getServiceRoot()).callbacks(
                  getCallbacks(relatedData, entityType)).expandSelectTree(context.getCurrentExpandSelectTreeNode())
                  .build();
          result.setInlineProperties(inlineProperties);
        }
View Full Code Here

  private String writeRoomData(final EdmEntitySet entitySet, final TombstoneCallback tombstoneCallback)
      throws URISyntaxException, EntityProviderException, IOException {
    Map<String, ODataCallback> callbacks = new HashMap<String, ODataCallback>();
    callbacks.put(TombstoneCallback.CALLBACK_KEY_TOMBSTONE, tombstoneCallback);

    EntityProviderWriteProperties properties =
        EntityProviderWriteProperties.serviceRoot(new URI(BASE_URI)).callbacks(callbacks).build();

    final ODataResponse response = new JsonEntityProvider().writeFeed(entitySet, roomsData,
        properties);
    assertNotNull(response);
View Full Code Here

TOP

Related Classes of org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties$ODataEntityProviderPropertiesBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.