@Override public Object readRelatedData(final EdmEntitySet sourceEntitySet, final Object sourceData, final EdmEntitySet targetEntitySet, final Map<String, Object> targetKeys) throws ODataNotImplementedException, ODataNotFoundException, EdmException, ODataApplicationException { DataStore<?> sourceStore = dataStores.get(sourceEntitySet.getName()); DataStore<?> targetStore = dataStores.get(targetEntitySet.getName()); AnnotatedNavInfo navInfo = ANNOTATION_HELPER.getCommonNavigationInfo( sourceStore.getDataTypeClass(), targetStore.getDataTypeClass()); Field sourceField = navInfo.getFromField(); if (sourceField == null) { throw new ODataRuntimeException("Missing source field for related data (sourceStore='" + sourceStore + "', targetStore='" + targetStore + "')."); } List<Object> resultData = readResultData(targetStore, sourceData, sourceField); return extractResultData(targetStore, targetKeys, navInfo, resultData); }
@Override public Object readRelatedData(final EdmEntitySet sourceEntitySet, final Object sourceData, final EdmEntitySet targetEntitySet, final Map<String, Object> targetKeys) throws ODataNotImplementedException, ODataNotFoundException, EdmException, ODataApplicationException { DataStore<?> sourceStore = dataStores.get(sourceEntitySet.getName()); DataStore<?> targetStore = dataStores.get(targetEntitySet.getName()); AnnotatedNavInfo navInfo = ANNOTATION_HELPER.getCommonNavigationInfo( sourceStore.getDataTypeClass(), targetStore.getDataTypeClass()); final Field sourceField; if(navInfo.isBiDirectional()) { sourceField = navInfo.getToField(); } else { sourceField = navInfo.getFromField(); } if (sourceField == null) { throw new AnnotationRuntimeException("Missing source field for related data (sourceStore='" + sourceStore + "', targetStore='" + targetStore + "')."); } List<Object> resultData = readResultData(targetStore, sourceData, sourceField); return extractResultData(targetStore, targetKeys, navInfo, resultData); }
@Override public Object readRelatedData(final EdmEntitySet sourceEntitySet, final Object sourceData, final EdmEntitySet targetEntitySet, final Map<String, Object> targetKeys) throws ODataNotImplementedException, ODataNotFoundException, EdmException, ODataApplicationException { DataStore<?> sourceStore = dataStores.get(sourceEntitySet.getName()); DataStore<?> targetStore = dataStores.get(targetEntitySet.getName()); AnnotatedNavInfo navInfo = ANNOTATION_HELPER.getCommonNavigationInfo( sourceStore.getDataTypeClass(), targetStore.getDataTypeClass()); final Field sourceField; if(navInfo.isBiDirectional()) { sourceField = navInfo.getToField(); } else { sourceField = navInfo.getFromField(); } if (sourceField == null) { throw new AnnotationRuntimeException("Missing source field for related data (sourceStore='" + sourceStore + "', targetStore='" + targetStore + "')."); } List<Object> resultData = readResultData(targetStore, sourceData, sourceField); return extractResultData(targetStore, targetKeys, navInfo, resultData); }