public static void validateKeys(Object entity, EntityType type, ODataUri oDataUri,
                                EntityDataModel entityDataModel) throws ODataClientException, ODataProcessorException {

        final Map<String, Object> oDataUriKeyValues = asJavaMap(getEntityKeyMap(oDataUri, entityDataModel));
        final Map<String, Object> keyValues = getKeyValues(entity, type);

        if (oDataUriKeyValues.size() != keyValues.size()) {
            throw new ODataClientException(PROCESSOR_ERROR, "Number of keys don't match");
        }

        for (Map.Entry<String, Object> oDataUriEntry : oDataUriKeyValues.entrySet()) {
            String oDataUriKey = oDataUriEntry.getKey();
            Object value = keyValues.get(oDataUriKey);
            if (value == null || !normalize(value).equals(normalize(oDataUriEntry.getValue()))) {
                throw new ODataClientException(PROCESSOR_ERROR, "Key/Values in OData URI and the entity don't match");
            }
        }
    }
public static void validateKeys ( Object entity , EntityType type , ODataUri oDataUri , EntityDataModel entityDataModel ) throws ODataClientException , ODataProcessorException { final Map < String , Object > oDataUriKeyValues = asJavaMap ( getEntityKeyMap ( oDataUri , entityDataModel ) ) ; final Map < String , Object > keyValues = getKeyValues ( entity , type ) ; if ( oDataUriKeyValues . size ( ) != keyValues . size ( ) ) { throw new ODataClientException ( PROCESSOR_ERROR , "Number of keys don't match" ) ; } for ( Map . Entry < String , Object > oDataUriEntry : oDataUriKeyValues . entrySet ( ) ) { String oDataUriKey = oDataUriEntry . getKey ( ) ; Object value = keyValues . get ( oDataUriKey ) ; if ( value == null || ! normalize ( value ) . equals ( normalize ( oDataUriEntry . getValue ( ) ) ) ) { throw new ODataClientException ( PROCESSOR_ERROR , "Key/Values in OData URI and the entity don't match" ) ; } } }
Performs the validation of keys.
The key(s) in the 'OData URI' should match the existing key(s) in the passed entity.

@param entity The passed entity.
@param type   The entity type of the passed entity.
@throws com.sdl.odata.api.ODataClientException
@throws com.sdl.odata.api.processor.ODataProcessorException