public List < Revision > getDiscussionArchiveRevisionsForArticleRevision ( int revisionId ) throws WikiApiException , WikiPageNotFoundException { List < Revision > result = new LinkedList < Revision > ( ) ; //get article revision Revision rev = revApi . getRevision ( revisionId ) ; Timestamp revTime = rev . getTimeStamp ( ) ; //get corresponding discussion archives Iterable < Page > discArchives = wiki . getDiscussionArchives ( rev . getArticleID ( ) ) ; /* * for each discussion archive, find correct revision of discussion page */ for ( Page discArchive : discArchives ) { //get revision timestamps for the current discussion archive List < Timestamp > discussionTs = revApi . getRevisionTimestamps ( discArchive . getPageId ( ) ) ; // sort in reverse order - newest first Collections . sort ( discussionTs , new Comparator < Timestamp > ( ) { public int compare ( Timestamp ts1 , Timestamp ts2 ) { return ts2 . compareTo ( ts1 ) ; } } ) ; //find first timestamp equal to or before the article revision timestamp for ( Timestamp curDiscTime : discussionTs ) { if ( curDiscTime == revTime || curDiscTime . before ( revTime ) ) { result . add ( revApi . getRevision ( discArchive . getPageId ( ) , curDiscTime ) ) ; break ; } } } return result ; }
For a given article revision the method returns the revisions of the archived article discussion pages which were available at the time of the article revision