private boolean overridesNamespaceMappings ( JcrSession session ) { NamespaceRegistry registry = session . context ( ) . getNamespaceRegistry ( ) ; if ( registry instanceof LocalNamespaceRegistry ) { Set < Namespace > localNamespaces = ( ( LocalNamespaceRegistry ) registry ) . getLocalNamespaces ( ) ; if ( localNamespaces . isEmpty ( ) ) { // There are no local mappings ... return false ; } for ( Namespace namespace : localNamespaces ) { if ( prefixesByUris . containsKey ( namespace . getNamespaceUri ( ) ) ) return true ; } // None of the local namespace mappings overrode any namespaces used by this schemata ... return false ; } // We can't find the local mappings, so brute-force it ... for ( Namespace namespace : registry . getNamespaces ( ) ) { String expectedPrefix = prefixesByUris . get ( namespace . getNamespaceUri ( ) ) ; if ( expectedPrefix == null ) { // This namespace is not used by this schemata ... continue ; } if ( ! namespace . getPrefix ( ) . equals ( expectedPrefix ) ) return true ; } return false ; }
Determine if the session overrides any namespace mappings used by this schemata .