protected void setEntityNavigationProperties ( Object entity , StructuredType entityType ) throws ODataException { for ( Map . Entry < String , Object > entry : links . entrySet ( ) ) { String propertyName = entry . getKey ( ) ; Object entryLinks = entry . getValue ( ) ; LOG . debug ( "Found link for navigation property: {}" , propertyName ) ; StructuralProperty property = entityType . getStructuralProperty ( propertyName ) ; if ( ! ( property instanceof NavigationProperty ) ) { throw new ODataUnmarshallingException ( "The request contains a navigation link '" + propertyName + "' but the entity type '" + entityType + "' does not contain a navigation property " + "with this name." ) ; } // Note: The links are processed a bit differently depending on whether we are parsing in the context // of a 'write operation' or 'read operation'. Only in the case of a 'write operation' it is necessary // to resolve the referenced entity. if ( isWriteOperation ( ) ) { // Get the referenced entity(es), but only with the key fields filled in if ( entryLinks instanceof List ) { List < String > linksList = ( List < String > ) entryLinks ; for ( String link : linksList ) { Object referencedEntity = getReferencedEntity ( link , propertyName ) ; LOG . debug ( "Referenced entity: {}" , referencedEntity ) ; saveReferencedEntity ( entity , propertyName , property , referencedEntity ) ; } } else { Object referencedEntity = getReferencedEntity ( ( String ) entryLinks , propertyName ) ; LOG . debug ( "Referenced entity: {}" , referencedEntity ) ; saveReferencedEntity ( entity , propertyName , property , referencedEntity ) ; } } } }
Sets the given entity with navigation links .