@ Override public WebPage run ( WebPage initialPage ) { if ( getUser ( ) == null ) throw new IllegalStateException ( "the user set is null" ) ; WebPage currentPage = initialPage ; for ( WebTask task : this ) { logger . info ( "BEGIN subtask " + task . getClass ( ) . getSimpleName ( ) ) ; // before running the subtask, set the user task . setUser ( getUser ( ) ) ; currentPage = task . run ( currentPage ) ; logger . info ( "END subtask " + task . getClass ( ) . getSimpleName ( ) ) ; } return currentPage ; }
Runs each subtask in order and finally return the page that the last task was visiting . Each subtask will run with the same user as the composite .