public class Wiki.Revision extends Object implements Comparable<Wiki.Revision>
Constructor and Description |
---|
Wiki.Revision(long revid,
Calendar timestamp,
String title,
String summary,
String user,
boolean minor,
boolean bot,
boolean rvnew,
int size)
Constructs a new Revision object.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Wiki.Revision other)
Compares this revision to another revision based on the recentness of
their timestamps.
|
String |
diff(long oldid)
Returns a HTML rendered diff table; see the table at the example.
|
protected String |
diff(long oldid,
String text)
Fetches a HTML rendered diff table; see the table at the example.
|
String |
diff(String text)
Returns a HTML rendered diff table between this revision and the
given text.
|
String |
diff(Wiki.Revision other)
Returns a HTML rendered diff table; see the table at the example.
|
boolean |
equals(Object o)
Determines whether this Revision is equal to another object.
|
Wiki.Revision |
getNext()
Gets the next revision.
|
String |
getPage()
Returns the page to which this revision was made.
|
Wiki.Revision |
getPrevious()
Gets the previous revision.
|
long |
getRcid()
Gets the rcid of this revision for patrolling purposes.
|
String |
getRenderedText()
Gets the rendered text of this revision.
|
long |
getRevid()
Returns the oldid of this revision.
|
String |
getRollbackToken()
Gets the rollback token for this revision.
|
int |
getSize()
Gets the size of this revision in bytes.
|
int |
getSizeDiff()
Returns the change in page size caused by this revision.
|
String |
getSummary()
Returns the edit summary for this revision.
|
String |
getText()
Fetches the contents of this revision.
|
Calendar |
getTimestamp()
Gets the time that this revision was made.
|
String |
getUser()
Returns the user or anon who created this revision.
|
int |
hashCode()
Returns a hash code of this revision.
|
boolean |
isBot()
Determines whether this revision was made by a bot.
|
boolean |
isMinor()
Checks whether this edit was marked as minor.
|
boolean |
isNew()
Determines whether this revision created a new page.
|
void |
rollback()
Reverts this revision using the rollback method.
|
void |
rollback(boolean bot,
String reason)
Reverts this revision using the rollback method.
|
void |
setRcid(long rcid)
Sets the rcid of this revision, used for patrolling.
|
void |
setRollbackToken(String token)
Sets a rollback token for this revision.
|
String |
toString()
Returns a string representation of this revision.
|
public Wiki.Revision(long revid, Calendar timestamp, String title, String summary, String user, boolean minor, boolean bot, boolean rvnew, int size)
revid
- the id of the revision (this is a long since
{{NUMBEROFEDITS}} on en.wikipedia.org is now (January
2012) ~25% of Integer.MAX_VALUEtimestamp
- when this revision was madetitle
- the concerned articlesummary
- the edit summaryuser
- the user making this revision (may be anonymous, if not
use User.getUsername())minor
- whether this was a minor editbot
- whether this was a bot editrvnew
- whether this revision created a new pagesize
- the size of the revisionpublic String getText() throws IOException
IOException
- if a network error occursIllegalArgumentException
- if page == Special:Log/xxx.public String getRenderedText() throws IOException
IOException
- if a network error occursIllegalArgumentException
- if page == Special:Log/xxx.public String diff(Wiki.Revision other) throws IOException
other
- another revision on the same page.IOException
- if a network error occurspublic String diff(String text) throws IOException
text
- some wikitextIOException
- if a network error occurspublic String diff(long oldid) throws IOException
oldid
- the oldid of a revision on the same page. NEXT_REVISION,
PREVIOUS_REVISION and CURRENT_REVISION can be used here
for obvious effect.IOException
- if a network error occursprotected String diff(long oldid, String text) throws IOException
oldid
- the id of another revision; (exclusive) ortext
- some wikitext to compare againstIOException
- if a network error occurspublic boolean equals(Object o)
public int hashCode()
public boolean isMinor()
public boolean isBot()
public boolean isNew()
public String getSummary()
public String getUser()
public String getPage()
public long getRevid()
public Calendar getTimestamp()
public int getSize()
public int getSizeDiff()
public String toString()
public int compareTo(Wiki.Revision other)
compareTo
in interface Comparable<Wiki.Revision>
other
- the revision to comparepublic Wiki.Revision getPrevious() throws IOException
IOException
- if a network error occurspublic Wiki.Revision getNext() throws IOException
IOException
- if a network error occurspublic void setRcid(long rcid)
rcid
- the rcid of this revision (long)public long getRcid()
public void setRollbackToken(String token)
token
- a rollback tokenpublic String getRollbackToken()
public void rollback() throws IOException, LoginException
IOException
- if a network error occursCredentialNotFoundException
- if not logged in or user is not an adminCredentialExpiredException
- if cookies have expiredAccountLockedException
- if the user is blockedLoginException
public void rollback(boolean bot, String reason) throws IOException, LoginException
bot
- mark this and the reverted revision(s) as bot editsreason
- (optional) a custom reasonIOException
- if a network error occursCredentialNotFoundException
- if not logged in or user is not an adminCredentialExpiredException
- if cookies have expiredAccountLockedException
- if the user is blockedLoginException
Copyright © 2013. All rights reserved.