private void updateCachedLayout ( Document layout , IUserProfile profile , FragmentDefinition fragment ) { final Locale locale = profile . getLocaleManager ( ) . getLocales ( ) . get ( 0 ) ; // need to make a copy that we can fragmentize layout = ( Document ) layout . cloneNode ( true ) ; // Fix later to handle multiple profiles final Element root = layout . getDocumentElement ( ) ; final UserView userView = this . fragmentUtils . getUserView ( fragment , locale ) ; if ( userView == null ) { throw new IllegalStateException ( "No UserView found for fragment: " + fragment . getName ( ) ) ; } root . setAttribute ( Constants . ATT_ID , Constants . FRAGMENT_ID_USER_PREFIX + userView . getUserId ( ) + Constants . FRAGMENT_ID_LAYOUT_PREFIX + "1" ) ; try { this . fragmentActivator . clearChacheForOwner ( fragment . getOwnerId ( ) ) ; this . fragmentUtils . getUserView ( fragment , locale ) ; } catch ( final Exception e ) { logger . error ( "An exception occurred attempting to update a layout." , e ) ; } }
Replaces the layout Document stored on a fragment definition with a new version . This is called when a fragment owner updates their layout .