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);
}