Esempio n. 1
0
 public static WriteEntryCallbackContext getWriteEntryCallBackContext() {
   WriteEntryCallbackContext writeContext = new WriteEntryCallbackContext();
   writeContext.setCurrentExpandSelectTreeNode(mockCurrentExpandSelectTreeNode());
   writeContext.setNavigationProperty(mockNavigationProperty());
   writeContext.setSourceEntitySet(mockSourceEntitySet());
   writeContext.setEntryData(getEntryData());
   return writeContext;
 }
Esempio n. 2
0
 @Override
 public WriteEntryCallbackResult retrieveEntryResult(final WriteEntryCallbackContext context) {
   WriteEntryCallbackResult result = new WriteEntryCallbackResult();
   try {
     if ("Employees".equals(context.getSourceEntitySet().getName())) {
       if ("ne_Room".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())
                 .build();
         result.setEntryData(dataProvider.getRoomData());
         result.setInlineProperties(inlineProperties);
       } else if ("ne_Team".equals(context.getNavigationProperty().getName())) {
         result.setEntryData(null);
       }
     }
   } catch (EdmException e) {
     throw new ODataRuntimeException("EdmException:", e);
   }
   return result;
 }