@Override public void deleteData(final EdmEntitySet entitySet, final Map<String, Object> keys) throws ODataNotImplementedException, ODataNotFoundException, EdmException, ODataApplicationException { DataStore<Object> dataStore = getDataStore(entitySet); Object keyInstance = dataStore.createInstance(); ANNOTATION_HELPER.setKeyFields(keyInstance, keys); dataStore.delete(keyInstance); }
@Override public Object newDataObject(final EdmEntitySet entitySet) throws ODataNotImplementedException, EdmException, ODataApplicationException { DataStore<Object> dataStore = getDataStore(entitySet); if (dataStore != null) { return dataStore.createInstance(); } throw new ODataRuntimeException("No DataStore found for entitySet with name: " + entitySet.getName()); }
@Override public Object newDataObject(final EdmEntitySet entitySet) throws ODataNotImplementedException, EdmException, ODataApplicationException { DataStore<Object> dataStore = getDataStore(entitySet); if (dataStore != null) { return dataStore.createInstance(); } throw new AnnotationRuntimeException("No DataStore found for entitySet with name: " + entitySet.getName()); }
@Override public void deleteData(final EdmEntitySet entitySet, final Map<String, Object> keys) throws ODataNotImplementedException, ODataNotFoundException, EdmException, ODataApplicationException { DataStore<Object> dataStore = getDataStore(entitySet); Object keyInstance = dataStore.createInstance(); ANNOTATION_HELPER.setKeyFields(keyInstance, keys); dataStore.delete(keyInstance); }
return resultData; } else { Object keyInstance = targetStore.createInstance(); ANNOTATION_HELPER.setKeyFields(keyInstance, targetKeys); for (Object result : resultData) {
return resultData; } else { Object keyInstance = targetStore.createInstance(); ANNOTATION_HELPER.setKeyFields(keyInstance, targetKeys); for (Object result : resultData) {
@Override public Object newDataObject(final EdmEntitySet entitySet) throws ODataNotImplementedException, EdmException, ODataApplicationException { DataStore<Object> dataStore = getDataStore(entitySet); if (dataStore != null) { return dataStore.createInstance(); } throw new AnnotationRuntimeException("No DataStore found for entitySet with name: " + entitySet.getName()); }
@Override public void deleteData(final EdmEntitySet entitySet, final Map<String, Object> keys) throws ODataNotImplementedException, ODataNotFoundException, EdmException, ODataApplicationException { DataStore<Object> dataStore = getDataStore(entitySet); Object keyInstance = dataStore.createInstance(); ANNOTATION_HELPER.setKeyFields(keyInstance, keys); dataStore.delete(keyInstance); }
return resultData; } else { Object keyInstance = targetStore.createInstance(); ANNOTATION_HELPER.setKeyFields(keyInstance, targetKeys); for (Object result : resultData) {
@Override public Object readData(final EdmEntitySet entitySet, final Map<String, Object> keys) throws ODataNotFoundException, EdmException, ODataApplicationException { DataStore<Object> store = getDataStore(entitySet); if (store != null) { Object keyInstance = store.createInstance(); ANNOTATION_HELPER.setKeyFields(keyInstance, keys); Object result = store.read(keyInstance); if (result != null) { return result; } } throw new ODataNotFoundException(ODataNotFoundException.ENTITY); }
@Override public Object readData(final EdmEntitySet entitySet, final Map<String, Object> keys) throws ODataNotFoundException, EdmException, ODataApplicationException { DataStore<Object> store = getDataStore(entitySet); if (store != null) { Object keyInstance = store.createInstance(); ANNOTATION_HELPER.setKeyFields(keyInstance, keys); Object result = store.read(keyInstance); if (result != null) { return result; } } throw new ODataNotFoundException(ODataNotFoundException.ENTITY); }
@Override public Object readData(final EdmEntitySet entitySet, final Map<String, Object> keys) throws ODataNotFoundException, EdmException, ODataApplicationException { DataStore<Object> store = getDataStore(entitySet); if (store != null) { Object keyInstance = store.createInstance(); ANNOTATION_HELPER.setKeyFields(keyInstance, keys); Object result = store.read(keyInstance); if (result != null) { return result; } } throw new ODataNotFoundException(ODataNotFoundException.ENTITY); }
@Override public void writeRelation(final EdmEntitySet sourceEntitySet, final Object sourceEntity, final EdmEntitySet targetEntitySet, final Map<String, Object> targetEntityValues) throws ODataNotImplementedException, ODataNotFoundException, EdmException, ODataApplicationException { // get common data DataStore<Object> sourceStore = dataStores.get(sourceEntitySet.getName()); DataStore<Object> targetStore = dataStores.get(targetEntitySet.getName()); AnnotatedNavInfo commonNavInfo = ANNOTATION_HELPER.getCommonNavigationInfo( sourceStore.getDataTypeClass(), targetStore.getDataTypeClass()); // get and validate source fields Field sourceField = commonNavInfo.getFromField(); if (sourceField == null) { throw new AnnotationRuntimeException("Missing source field for related data (sourceStore='" + sourceStore + "', targetStore='" + targetStore + "')."); } // get related target entity Object targetEntity = targetStore.createInstance(); ANNOTATION_HELPER.setKeyFields(targetEntity, targetEntityValues); targetEntity = targetStore.read(targetEntity); // set at source setValueAtNavigationField(sourceEntity, sourceField, targetEntity); // set at target Field targetField = commonNavInfo.getToField(); if (targetField != null) { setValueAtNavigationField(targetEntity, targetField, sourceEntity); } }
@Override public void writeRelation(final EdmEntitySet sourceEntitySet, final Object sourceEntity, final EdmEntitySet targetEntitySet, final Map<String, Object> targetEntityValues) throws ODataNotImplementedException, ODataNotFoundException, EdmException, ODataApplicationException { // get common data DataStore<Object> sourceStore = dataStores.get(sourceEntitySet.getName()); DataStore<Object> targetStore = dataStores.get(targetEntitySet.getName()); AnnotatedNavInfo commonNavInfo = ANNOTATION_HELPER.getCommonNavigationInfo( sourceStore.getDataTypeClass(), targetStore.getDataTypeClass()); // get and validate source fields Field sourceField = commonNavInfo.getFromField(); if (sourceField == null) { throw new ODataRuntimeException("Missing source field for related data (sourceStore='" + sourceStore + "', targetStore='" + targetStore + "')."); } // get related target entity Object targetEntity = targetStore.createInstance(); ANNOTATION_HELPER.setKeyFields(targetEntity, targetEntityValues); targetEntity = targetStore.read(targetEntity); // set at source setValueAtNavigationField(sourceEntity, sourceField, targetEntity); // set at target Field targetField = commonNavInfo.getToField(); if (targetField != null) { setValueAtNavigationField(targetEntity, targetField, sourceEntity); } }
@Override public void writeRelation(final EdmEntitySet sourceEntitySet, final Object sourceEntity, final EdmEntitySet targetEntitySet, final Map<String, Object> targetEntityValues) throws ODataNotImplementedException, ODataNotFoundException, EdmException, ODataApplicationException { // get common data DataStore<Object> sourceStore = dataStores.get(sourceEntitySet.getName()); DataStore<Object> targetStore = dataStores.get(targetEntitySet.getName()); AnnotatedNavInfo commonNavInfo = ANNOTATION_HELPER.getCommonNavigationInfo( sourceStore.getDataTypeClass(), targetStore.getDataTypeClass()); // get and validate source fields Field sourceField = commonNavInfo.getFromField(); if (sourceField == null) { throw new AnnotationRuntimeException("Missing source field for related data (sourceStore='" + sourceStore + "', targetStore='" + targetStore + "')."); } // get related target entity Object targetEntity = targetStore.createInstance(); ANNOTATION_HELPER.setKeyFields(targetEntity, targetEntityValues); targetEntity = targetStore.read(targetEntity); // set at source setValueAtNavigationField(sourceEntity, sourceField, targetEntity); // set at target Field targetField = commonNavInfo.getToField(); if (targetField != null) { setValueAtNavigationField(targetEntity, targetField, sourceEntity); } }