@ Nonnegative public int checkInternalMappings ( @ Nonnull final IMenuTree aMenuTree , @ Nonnull final Consumer < GoMappingItem > aErrorCallback ) { ValueEnforcer . notNull ( aMenuTree , "MenuTree" ) ; ValueEnforcer . notNull ( aErrorCallback , "ErrorCallback" ) ; final IRequestParameterManager aRPM = RequestParameterManager . getInstance ( ) ; int nCount = 0 ; int nErrors = 0 ; m_aRWLock . readLock ( ) . lock ( ) ; try { for ( final GoMappingItem aItem : m_aMap . values ( ) ) if ( aItem . isInternal ( ) ) { // Get value of "menu item" parameter and check for existence final String sParamValue = aRPM . getMenuItemFromURL ( aItem . getTargetURLReadonly ( ) , aMenuTree ) ; if ( sParamValue != null ) { ++ nCount ; if ( aMenuTree . getItemWithID ( sParamValue ) == null ) { ++ nErrors ; aErrorCallback . accept ( aItem ) ; } } } } finally { m_aRWLock . readLock ( ) . unlock ( ) ; } if ( nErrors == 0 ) LOGGER . info ( "Successfully checked " + nCount + " internal go-mappings for consistency" ) ; else LOGGER . warn ( "Checked " + nCount + " internal go-mappings for consistency and found " + nErrors + " errors!" ) ; return nErrors ; }
Check whether all internal go links that point to a page use existing menu item IDs