private ProcessorResult processEntity ( ) throws ODataException { TargetType targetType = getTargetType ( ) ; if ( ! targetType . isCollection ( ) ) { Option < String > singletonName = ODataUriUtil . getSingletonName ( getoDataUri ( ) ) ; if ( singletonName . isDefined ( ) ) { throw new ODataBadRequestException ( "The URI refers to the singleton '" + singletonName . get ( ) + "'. Singletons cannot be deleted." ) ; } Type type = getEntityDataModel ( ) . getType ( targetType . typeName ( ) ) ; DataSource dataSource = getDataSource ( type . getFullyQualifiedName ( ) ) ; log . debug ( "Data source found for entity type '{}'" , type . getFullyQualifiedName ( ) ) ; dataSource . delete ( getoDataUri ( ) , getEntityDataModel ( ) ) ; return new ProcessorResult ( NO_CONTENT ) ; } else { throw new ODataBadRequestException ( "The URI for a DELETE request should refer to the single entity " + "to be deleted, not to a collection of entities." ) ; } }
This method finds correct data source based on target type and executes delete operation on data source .