}
@Override
public WriteEntryCallbackResult retrieveEntryResult(final WriteEntryCallbackContext context)
throws ODataApplicationException {
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>();
EdmNavigationProperty nextNavProperty =
getNextNavigationProperty(context.getSourceEntitySet().getEntityType(), context.getNavigationProperty());
if (nextNavProperty != null) {
currentNavPropertyList.add(nextNavProperty);
}
HashMap<String, Object> navigationMap =
jpaResultParser.parse2EdmNavigationValueMap(inlinedEntry, currentNavPropertyList);
edmPropertyValueMap.putAll(navigationMap);
result.setEntryData(edmPropertyValueMap);
}
result.setInlineProperties(getInlineEntityProviderProperties(context));
} catch (EdmException e) {
throw new ODataApplicationException(e.getMessage(), Locale.getDefault(), e);
} catch (ODataJPARuntimeException e) {
throw new ODataApplicationException(e.getMessage(), Locale.getDefault(), e);
}