Examples of WriteFeedCallbackResult


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

    class FeedCallback implements OnWriteFeedContent {
      @Override
      public WriteFeedCallbackResult retrieveFeedResult(final WriteFeedCallbackContext context)
          throws ODataApplicationException {
        WriteFeedCallbackResult result = new WriteFeedCallbackResult();
        result.setFeedData(null);
        result.setInlineProperties(DEFAULT_PROPERTIES);
        return result;
      }
View Full Code Here

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

    class FeedCallback implements OnWriteFeedContent {
      @Override
      public WriteFeedCallbackResult retrieveFeedResult(final WriteFeedCallbackContext context)
          throws ODataApplicationException {
        WriteFeedCallbackResult result = new WriteFeedCallbackResult();
        result.setFeedData(new ArrayList<Map<String, Object>>());
        result.setInlineProperties(DEFAULT_PROPERTIES);
        return result;
      }
View Full Code Here

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

    ODataCallback employeeCallback = new OnWriteFeedContent() {

      @Override
      public WriteFeedCallbackResult retrieveFeedResult(final WriteFeedCallbackContext context)
          throws ODataApplicationException {
        WriteFeedCallbackResult writeFeedCallbackResult = new WriteFeedCallbackResult();
        writeFeedCallbackResult.setInlineProperties(DEFAULT_PROPERTIES);
        writeFeedCallbackResult.setFeedData(null);
        return writeFeedCallbackResult;
      }
    };
    callbacksRoom.put("nr_Employees", employeeCallback);
    EntityProviderWriteProperties properties =
View Full Code Here

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

    ODataCallback employeeCallback = new OnWriteFeedContent() {

      @Override
      public WriteFeedCallbackResult retrieveFeedResult(final WriteFeedCallbackContext context)
          throws ODataApplicationException {
        WriteFeedCallbackResult writeFeedCallbackResult = new WriteFeedCallbackResult();
        writeFeedCallbackResult.setInlineProperties(DEFAULT_PROPERTIES);
        writeFeedCallbackResult.setFeedData(new ArrayList<Map<String, Object>>());
        return writeFeedCallbackResult;
      }
    };
    callbacksRoom.put("nr_Employees", employeeCallback);
    EntityProviderWriteProperties properties =
View Full Code Here

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

    if (callback == null) {
      throw new EntityProviderException(EntityProviderException.EXPANDNOTSUPPORTED);
    }
    try {
      if (isFeed) {
        final WriteFeedCallbackResult result =
            ((OnWriteFeedContent) callback).retrieveFeedResult((WriteFeedCallbackContext) context);
        List<Map<String, Object>> inlineData = result.getFeedData();
        if (inlineData == null) {
          inlineData = new ArrayList<Map<String, Object>>();
        }
        final EntityProviderWriteProperties inlineProperties = result.getInlineProperties();
        final EntityInfoAggregator inlineEntityInfo =
            EntityInfoAggregator.create(inlineEntitySet, inlineProperties.getExpandSelectTree());
        new JsonFeedEntityProducer(inlineProperties).append(writer, inlineEntityInfo, inlineData, false);

      } else {
        final WriteEntryCallbackResult result =
            ((OnWriteEntryContent) callback).retrieveEntryResult((WriteEntryCallbackContext) context);
        Map<String, Object> inlineData = result.getEntryData();
        if (inlineData != null && !inlineData.isEmpty()) {
          final EntityProviderWriteProperties inlineProperties = result.getInlineProperties();
          final EntityInfoAggregator inlineEntityInfo =
              EntityInfoAggregator.create(inlineEntitySet, inlineProperties.getExpandSelectTree());
          new JsonEntryEntityProducer(inlineProperties).append(writer, inlineEntityInfo, inlineData, false);
        } else {
          jsonStreamWriter.unquotedValue("null");
View Full Code Here

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

    this.baseUri = baseUri;
  }

  @Override
  public WriteFeedCallbackResult retrieveFeedResult(final WriteFeedCallbackContext context) {
    WriteFeedCallbackResult result = new WriteFeedCallbackResult();
    try {
      if ("Rooms".equals(context.getSourceEntitySet().getName())) {
        if ("nr_Employees".equals(context.getNavigationProperty().getName())) {
          HashMap<String, ODataCallback> callbacks = new HashMap<String, ODataCallback>();
          for (String navPropName : context.getSourceEntitySet().getRelatedEntitySet(context.getNavigationProperty())
              .getEntityType().getNavigationPropertyNames()) {
            callbacks.put(navPropName, this);
          }
          EntityProviderWriteProperties inlineProperties =
              EntityProviderWriteProperties.serviceRoot(baseUri).callbacks(callbacks).expandSelectTree(
                  context.getCurrentExpandSelectTreeNode()).selfLink(context.getSelfLink()).build();

          result.setFeedData(dataProvider.getEmployeesData());
          result.setInlineProperties(inlineProperties);
        }
      } else if ("Buildings".equals(context.getSourceEntitySet().getName())) {
        EntityProviderWriteProperties inlineProperties =
            EntityProviderWriteProperties.serviceRoot(baseUri).expandSelectTree(
                context.getCurrentExpandSelectTreeNode()).selfLink(context.getSelfLink()).build();
        List<Map<String, Object>> emptyData = new ArrayList<Map<String, Object>>();
        result.setFeedData(emptyData);
        result.setInlineProperties(inlineProperties);
      }
    } catch (EdmException e) {
      throw new ODataRuntimeException("EdmException", e);
    }
    return result;
View Full Code Here

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

    WriteFeedCallbackContext writeFeedContext = EdmMockUtil.getWriteFeedCallBackContext();
    try {
      Field field = callBack.getClass().getDeclaredField("nextEntitySet");
      field.setAccessible(true);
      field.set(callBack, EdmMockUtil.mockTargetEntitySet());
      WriteFeedCallbackResult result = callBack.retrieveFeedResult(writeFeedContext);
      assertEquals(2, result.getFeedData().size());
    } catch (SecurityException e) {
      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
    } catch (NoSuchFieldException e) {
      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
    } catch (IllegalArgumentException e) {
View Full Code Here

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

            values.add(getStructuralTypeValueMap(entryData, entityType));
          }
        } 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;
      } catch (final ODataException e) {
        throw new ODataApplicationException(e.getLocalizedMessage(), Locale.ROOT, e);
      }
    }
View Full Code Here

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

              if (callback == null) {
                throw new EntityProviderException(EntityProviderException.EXPANDNOTSUPPORTED);
              }
              try {
                if (isFeed) {
                  final WriteFeedCallbackResult result =
                      ((OnWriteFeedContent) callback).retrieveFeedResult((WriteFeedCallbackContext) context);
                  List<Map<String, Object>> inlineData = result.getFeedData();
                  if (inlineData == null) {
                    inlineData = new ArrayList<Map<String, Object>>();
                  }
                  final EntityProviderWriteProperties inlineProperties = result.getInlineProperties();
                  final EntityInfoAggregator inlineEntityInfo =
                      EntityInfoAggregator.create(inlineEntitySet, inlineProperties.getExpandSelectTree());
                  new JsonFeedEntityProducer(inlineProperties).append(writer, inlineEntityInfo, inlineData, false);

                } else {
                  final WriteEntryCallbackResult result =
                      ((OnWriteEntryContent) callback).retrieveEntryResult((WriteEntryCallbackContext) context);
                  Map<String, Object> inlineData = result.getEntryData();
                  if (inlineData != null && !inlineData.isEmpty()) {
                    final EntityProviderWriteProperties inlineProperties = result.getInlineProperties();
                    final EntityInfoAggregator inlineEntityInfo =
                        EntityInfoAggregator.create(inlineEntitySet, inlineProperties.getExpandSelectTree());
                    new JsonEntryEntityProducer(inlineProperties).append(writer, inlineEntityInfo, inlineData, false);
                  } else {
                    jsonStreamWriter.unquotedValue("null");
View Full Code Here

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

    WriteFeedCallbackContext writeFeedContext = EdmMockUtil.getWriteFeedCallBackContext();
    try {
      Field field = callBack.getClass().getDeclaredField("nextEntitySet");
      field.setAccessible(true);
      field.set(callBack, EdmMockUtil.mockTargetEntitySet());
      WriteFeedCallbackResult result = callBack.retrieveFeedResult(writeFeedContext);
      assertEquals(2, result.getFeedData().size());
    } catch (SecurityException e) {
      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
    } catch (NoSuchFieldException e) {
      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
    } catch (IllegalArgumentException e) {
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.