Examples of WriteEntryCallbackResult


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

    OnWriteEntryContent callback = new OnWriteEntryContent() {

      @Override
      public WriteEntryCallbackResult retrieveEntryResult(final WriteEntryCallbackContext context)
          throws ODataApplicationException {
        WriteEntryCallbackResult result = new WriteEntryCallbackResult();
        result.setInlineProperties(DEFAULT_PROPERTIES);
        result.setEntryData(new HashMap<String, Object>());
        return result;
      }
    };
    callbacksEmployee.put("ne_Team", callback);
    EntityProviderWriteProperties properties =
View Full Code Here

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

        ODataCallback callback = properties.getCallbacks().get(navigationPropertyName);
        if (callback == null) {
          throw new EntityProviderException(EntityProviderException.EXPANDNOTSUPPORTED);
        }
        WriteEntryCallbackResult result = null;
        try {
          result = ((OnWriteEntryContent) callback).retrieveEntryResult(context);
        } catch (ODataApplicationException e) {
          throw new EntityProviderException(EntityProviderException.COMMON, e);
        }
        Map<String, Object> inlineData = result.getEntryData();
        if (inlineData != null && !inlineData.isEmpty()) {
          EntityProviderWriteProperties inlineProperties = result.getInlineProperties();
          EdmEntitySet inlineEntitySet = eia.getEntitySet().getRelatedEntitySet(navProp);
          AtomEntryEntityProducer inlineProducer = new AtomEntryEntityProducer(inlineProperties);
          EntityInfoAggregator inlineEia =
              EntityInfoAggregator.create(inlineEntitySet, inlineProperties.getExpandSelectTree());
          inlineProducer.append(writer, inlineEia, inlineData, false, false);
View Full Code Here

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

    class EntryCallback implements OnWriteEntryContent {
      @Override
      public WriteEntryCallbackResult retrieveEntryResult(final WriteEntryCallbackContext context)
          throws ODataApplicationException {
        WriteEntryCallbackResult result = new WriteEntryCallbackResult();
        result.setEntryData(null);
        result.setInlineProperties(DEFAULT_PROPERTIES);
        return result;
      }
    }
    EntryCallback callback = new EntryCallback();
    Map<String, ODataCallback> callbacks = new HashMap<String, ODataCallback>();
View Full Code Here

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

    class EntryCallback implements OnWriteEntryContent {
      @Override
      public WriteEntryCallbackResult retrieveEntryResult(final WriteEntryCallbackContext context)
          throws ODataApplicationException {
        WriteEntryCallbackResult result = new WriteEntryCallbackResult();
        result.setEntryData(new HashMap<String, Object>());
        result.setInlineProperties(DEFAULT_PROPERTIES);
        return result;
      }
    }
    EntryCallback callback = new EntryCallback();
    Map<String, ODataCallback> callbacks = new HashMap<String, ODataCallback>();
View Full Code Here

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

    this.expandList = expandList;
  }

  @Override
  public WriteEntryCallbackResult retrieveEntryResult(final WriteEntryCallbackContext context) {
    WriteEntryCallbackResult result = new WriteEntryCallbackResult();
    Map<String, Object> entry = context.getEntryData();
    Map<String, Object> edmPropertyValueMap = null;
    List<EdmNavigationProperty> currentNavPropertyList = null;
    Map<String, ExpandSelectTreeNode> navigationLinks = null;
    JPAEntityParser jpaResultParser = new JPAEntityParser();
    EdmNavigationProperty currentNavigationProperty = context.getNavigationProperty();
    try {
      Object inlinedEntry = entry.get(currentNavigationProperty.getName());
      if (nextEntitySet == null) {
        nextEntitySet = context.getSourceEntitySet().getRelatedEntitySet(currentNavigationProperty);
      }
      edmPropertyValueMap = jpaResultParser.parse2EdmPropertyValueMap(inlinedEntry, nextEntitySet.getEntityType());
      result.setEntryData(edmPropertyValueMap);
      navigationLinks = context.getCurrentExpandSelectTreeNode().getLinks();
      if (navigationLinks.size() > 0) {
        currentNavPropertyList = new ArrayList<EdmNavigationProperty>();
        currentNavPropertyList.add(getNextNavigationProperty(context.getSourceEntitySet().getEntityType(), context
            .getNavigationProperty()));
        HashMap<String, Object> navigationMap =
            jpaResultParser.parse2EdmNavigationValueMap(inlinedEntry, currentNavPropertyList);
        edmPropertyValueMap.putAll(navigationMap);
        result.setEntryData(edmPropertyValueMap);
      }
      result.setInlineProperties(getInlineEntityProviderProperties(context));
    } catch (EdmException e) {

    } catch (ODataJPARuntimeException e) {

    }
View Full Code Here

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

      @Override
      public WriteEntryCallbackResult retrieveEntryResult(final WriteEntryCallbackContext context)
          throws ODataApplicationException {
        Map<String, Object> buildingData = new HashMap<String, Object>();
        buildingData.put("Id", "1");
        WriteEntryCallbackResult result = new WriteEntryCallbackResult();
        result.setEntryData(buildingData);
        result.setInlineProperties(DEFAULT_PROPERTIES);
        return result;
      }
    }
    EntryCallback callback = new EntryCallback();
    Map<String, ODataCallback> callbacks = new HashMap<String, ODataCallback>();
View Full Code Here

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

    class EntryCallback implements OnWriteEntryContent {
      @Override
      public WriteEntryCallbackResult retrieveEntryResult(final WriteEntryCallbackContext context)
          throws ODataApplicationException {
        WriteEntryCallbackResult result = new WriteEntryCallbackResult();
        result.setEntryData(null);
        result.setInlineProperties(DEFAULT_PROPERTIES);
        return result;
      }
View Full Code Here

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

    class EntryCallback implements OnWriteEntryContent {
      @Override
      public WriteEntryCallbackResult retrieveEntryResult(final WriteEntryCallbackContext context)
          throws ODataApplicationException {
        WriteEntryCallbackResult result = new WriteEntryCallbackResult();
        result.setEntryData(new HashMap<String, Object>());
        result.setInlineProperties(DEFAULT_PROPERTIES);
        return result;
      }
View Full Code Here

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

      @Override
      public WriteEntryCallbackResult retrieveEntryResult(final WriteEntryCallbackContext context)
          throws ODataApplicationException {
        Map<String, Object> buildingData = new HashMap<String, Object>();
        buildingData.put("Id", "1");
        WriteEntryCallbackResult result = new WriteEntryCallbackResult();
        result.setEntryData(buildingData);
        result.setInlineProperties(DEFAULT_PROPERTIES);
        return result;
      }
View Full Code Here

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

    public WriteEntryCallbackResult retrieveEntryResult(final WriteEntryCallbackContext context)
        throws ODataApplicationException {
      try {
        final EdmEntityType entityType =
            context.getSourceEntitySet().getRelatedEntitySet(context.getNavigationProperty()).getEntityType();
        WriteEntryCallbackResult result = new WriteEntryCallbackResult();
        Object relatedData;
        try {
          relatedData = readRelatedData(context);
        } catch (final ODataNotFoundException e) {
          relatedData = null;
        }

        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);
        }
        return result;
      } catch (final ODataException e) {
        throw new ODataApplicationException(e.getLocalizedMessage(), Locale.ROOT, 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.