Examples of TombstoneCallback


Examples of org.apache.olingo.odata2.api.ep.callback.TombstoneCallback

  public void append(final XMLStreamWriter writer, final EntityInfoAggregator eia,
      final List<Map<String, Object>> data, final boolean isInline) throws EntityProviderException {
    try {
      writer.writeStartElement(FormatXml.ATOM_FEED);
      TombstoneCallback callback = null;
      if (!isInline) {
        writer.writeDefaultNamespace(Edm.NAMESPACE_ATOM_2005);
        writer.writeNamespace(Edm.PREFIX_M, Edm.NAMESPACE_M_2007_08);
        writer.writeNamespace(Edm.PREFIX_D, Edm.NAMESPACE_D_2007_08);
        callback = getTombstoneCallback();
View Full Code Here

Examples of org.apache.olingo.odata2.api.ep.callback.TombstoneCallback

  }

  private TombstoneCallback getTombstoneCallback() {
    if (properties.getCallbacks() != null
        && properties.getCallbacks().containsKey(TombstoneCallback.CALLBACK_KEY_TOMBSTONE)) {
      TombstoneCallback callback =
          (TombstoneCallback) properties.getCallbacks().get(TombstoneCallback.CALLBACK_KEY_TOMBSTONE);
      return callback;
    } else {
      return null;
    }
View Full Code Here

Examples of org.apache.olingo.odata2.api.ep.callback.TombstoneCallback

  public void append(final Writer writer, final EntityInfoAggregator entityInfo, final List<Map<String, Object>> data,
      final boolean isRootElement) throws EntityProviderException {
    JsonStreamWriter jsonStreamWriter = new JsonStreamWriter(writer);

    TombstoneCallback callback = getTombstoneCallback();

    try {
      jsonStreamWriter.beginObject();

      if (isRootElement) {
        jsonStreamWriter.name(FormatJson.D)
            .beginObject();
      }

      if (properties.getInlineCountType() == InlineCount.ALLPAGES) {
        final int inlineCount = properties.getInlineCount() == null ? 0 : properties.getInlineCount();
        jsonStreamWriter.namedStringValueRaw(FormatJson.COUNT, String.valueOf(inlineCount)).separator();
      }

      jsonStreamWriter.name(FormatJson.RESULTS)
          .beginArray();
      JsonEntryEntityProducer entryProducer = new JsonEntryEntityProducer(properties);
      boolean first = true;
      for (final Map<String, Object> entryData : data) {
        if (first) {
          first = false;
        } else {
          jsonStreamWriter.separator();
        }
        entryProducer.append(writer, entityInfo, entryData, false);
      }

      if (callback != null) {
        JsonDeletedEntryEntityProducer deletedEntryProducer = new JsonDeletedEntryEntityProducer(properties);
        TombstoneCallbackResult callbackResult = callback.getTombstoneCallbackResult();
        List<Map<String, Object>> deletedEntries = callbackResult.getDeletedEntriesData();
        if (deletedEntries != null) {
          deletedEntryProducer.append(writer, entityInfo, deletedEntries);
        }
      }
View Full Code Here

Examples of org.apache.olingo.odata2.api.ep.callback.TombstoneCallback

  }

  private TombstoneCallback getTombstoneCallback() {
    if (properties.getCallbacks() != null
        && properties.getCallbacks().containsKey(TombstoneCallback.CALLBACK_KEY_TOMBSTONE)) {
      TombstoneCallback callback =
          (TombstoneCallback) properties.getCallbacks().get(TombstoneCallback.CALLBACK_KEY_TOMBSTONE);
      return callback;
    } else {
      return null;
    }
View Full Code Here

Examples of org.apache.olingo.odata2.api.ep.callback.TombstoneCallback

  @Test
  public void deltaLink() throws Exception {
    final EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms");

    TombstoneCallback tombstoneCallback =
        new TombstoneCallbackImpl(null, BASE_URI + "Rooms?!deltatoken=1234");

    final String json = writeRoomData(entitySet, tombstoneCallback);

    assertTrue("Delta Link missing or wrong!", json
View Full Code Here

Examples of org.apache.olingo.odata2.api.ep.callback.TombstoneCallback

  @Test
  public void deletedEntries() throws Exception {
    final EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms");

    TombstoneCallback tombstoneCallback =
        new TombstoneCallbackImpl(deletedRoomData, null);

    final String json = writeRoomData(entitySet, tombstoneCallback);

    assertDeletedEntries(json);
View Full Code Here

Examples of org.apache.olingo.odata2.api.ep.callback.TombstoneCallback

  public void deletedEntriesEmpty() throws Exception {
    final EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms");

    deletedRoomData.clear();

    TombstoneCallback tombstoneCallback =
        new TombstoneCallbackImpl(deletedRoomData, null);

    final String json = writeRoomData(entitySet, tombstoneCallback);

    assertTrue("Something wrong with empty deletedRoomData list!", json.contains("nr_Building\"}}}]}}"));
View Full Code Here

Examples of org.apache.olingo.odata2.api.ep.callback.TombstoneCallback

  @Test
  public void deletedEntriesAndDeltaLink() throws Exception {
    final EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms");

    TombstoneCallback tombstoneCallback =
        new TombstoneCallbackImpl(deletedRoomData, BASE_URI + "Rooms?!deltatoken=1234");

    final String json = writeRoomData(entitySet, tombstoneCallback);

    assertTrue("Delta Link missing or wrong!", json
View Full Code Here

Examples of org.apache.olingo.odata2.api.ep.callback.TombstoneCallback

        URI deltaLink;
        deltaLink =
            new URI(requestUri.getScheme(), requestUri.getUserInfo(), requestUri.getHost(), requestUri.getPort(),
                requestUri.getPath(), DELTATOKEN_1234, requestUri.getFragment());

        TombstoneCallback tombstoneCallback =
            new TombstoneCallbackImpl(deletedRoomData, deltaLink.toASCIIString());

        HashMap<String, ODataCallback> callbacks = new HashMap<String, ODataCallback>();
        callbacks.put(TombstoneCallback.CALLBACK_KEY_TOMBSTONE, tombstoneCallback);
View Full Code Here

Examples of org.apache.olingo.odata2.api.ep.callback.TombstoneCallback

  }

  @Test
  public void nullAsCallbackResult() throws Exception {
    initializeRoomData(2);
    TombstoneCallback tombstoneCallback = new TombstoneCallbackImpl(null, null);
    callbacks = new HashMap<String, ODataCallback>();
    callbacks.put(TombstoneCallback.CALLBACK_KEY_TOMBSTONE, tombstoneCallback);

    EntityProviderWriteProperties properties =
        EntityProviderWriteProperties.serviceRoot(BASE_URI).callbacks(callbacks).build();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.