Jive API (3.0.13) Core Javadocs

com.jivesoftware.community
Class Ban

java.lang.Object
  extended by com.jivesoftware.community.Ban
All Implemented Interfaces:
JiveObject, Serializable

public class Ban
extends Object
implements Serializable, JiveObject

Represents a ban object. Both user accounts and IP addresses can be banned at a specific BanLevel. Bans can be permanent or have a specific expiration date. The administrator who created the ban will be stored as well as an optional comment explaining the reason for the ban.

See Also:
BanLevel, Serialized Form

Constructor Summary
Ban(long ID, int banType)
          Creates a new Ban object with the specified ban ID and ban type
Ban(long bannedUserID, long adminID, int banLevel, Date expirationDate, String comment)
          Creates a new Ban object for a user.
Ban(String ipAddress, long adminID, int banLevel, Date expirationDate, String comment)
          Creates a new Ban object for an IP address.
 
Method Summary
 boolean equals(Object o)
           
 long getAdminID()
          Gets the admin user that created this ban object.
 int getBanLevel()
          Gets the BanLevel for this ban.
 long getBannedUserID()
          Gets the banned user id.
 int getBanType()
          Returns BanManager.TYPE_BAN_USER for a user ban or BanManager.TYPE_BAN_IP for an IP address ban.
 int getCachedSize()
           
 String getComment()
          Gets a comment for this ban object.
 Date getCreationDate()
          Gets the date this ban object was created.
 Date getExpirationDate()
          Gets the date this ban object will expire, or null if it is a permanent ban object.
 long getID()
          Returns the unique ID that represents this ban object.
 String getIpAddress()
          Gets the IP address that is banned.
 int getObjectType()
          Return the BAN object type.
 int hashCode()
           
 void readExternal(DataInput in)
           
 void setAdminID(long adminID)
          Sets the admin user id that created this ban object.
 void setBanLevel(int banLevel)
          Sets the BanLevel for this ban.
 void setBannedUserID(long bannedUserID)
          Sets the banned user.
 void setComment(String comment)
          Sets a comment on this ban object.
 void setCreationDate(Date creationDate)
          Sets the date this ban object was created.
 void setExpirationDate(Date expirationDate)
          Sets the date this ban object will expire, or null if it is a permanent ban object.
 void setID(long ID)
          Set the ID for this ban object.
 void setIpAddress(String ipAddress)
          Sets the IP address to ban.
 String toString()
           
 void writeExternal(DataOutput out)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Ban

public Ban(long ID,
           int banType)
Creates a new Ban object with the specified ban ID and ban type

Parameters:
ID - the unique ID that represents this ban object
banType - the type of the ban, either BanManager.TYPE_BAN_USER or BanManager.TYPE_BAN_IP

Ban

public Ban(long bannedUserID,
           long adminID,
           int banLevel,
           Date expirationDate,
           String comment)
Creates a new Ban object for a user.

Parameters:
bannedUserID - the user id to ban
adminID - the user id that created the ban
banLevel - the BanLevel
expirationDate - the date the ban expires, or null for a permanent ban
comment - the comment explaining why the ban was created

Ban

public Ban(String ipAddress,
           long adminID,
           int banLevel,
           Date expirationDate,
           String comment)
Creates a new Ban object for an IP address.

Parameters:
ipAddress - the ip address to ban. A '*' can be used to denote all addresses, ex. 127.0.0.*
adminID - the user id that created the ban
banLevel - the BanLevel
expirationDate - the date the ban expires, or null for a permanent ban
comment - the comment explaining why the ban was created
Method Detail

getID

public long getID()
Returns the unique ID that represents this ban object.

Specified by:
getID in interface JiveObject
Returns:
the unique ID that represents this ban object

setID

public void setID(long ID)
Set the ID for this ban object.

Parameters:
ID - the ID for this ban object.

getObjectType

public int getObjectType()
Return the BAN object type.

Specified by:
getObjectType in interface JiveObject
Returns:
the BAN object type.

getBanType

public int getBanType()
Returns BanManager.TYPE_BAN_USER for a user ban or BanManager.TYPE_BAN_IP for an IP address ban.

Returns:
BanManager.TYPE_BAN_USER for a user ban or BanManager.TYPE_BAN_IP for an IP address ban.

setBannedUserID

public void setBannedUserID(long bannedUserID)
Sets the banned user.

Parameters:
bannedUserID - the banned user

getBannedUserID

public long getBannedUserID()
Gets the banned user id.

Returns:
the id of the banned user.

setIpAddress

public void setIpAddress(String ipAddress)
Sets the IP address to ban. The IP address should be in the format {0-255}.{0-255}.{0-255}.{0-255} and a '*' can be used to denote all addresses, ex. 127.0.0.*

Parameters:
ipAddress - the IP address that is banned.

getIpAddress

public String getIpAddress()
Gets the IP address that is banned. The IP address is in the format {0-255}.{0-255}.{0-255}.{0-255} and a '*' can be used to denote all addresses, ex. 127.0.0.*

Returns:
the IP address that is banned.

setAdminID

public void setAdminID(long adminID)
Sets the admin user id that created this ban object.

Parameters:
adminID - the admin user that created this ban

getAdminID

public long getAdminID()
Gets the admin user that created this ban object.

Returns:
the admin user id that created this ban.

setBanLevel

public void setBanLevel(int banLevel)
Sets the BanLevel for this ban.

Parameters:
banLevel - the BanLevel for this ban.

getBanLevel

public int getBanLevel()
Gets the BanLevel for this ban.

Returns:
the BanLevel for this ban.

setCreationDate

public void setCreationDate(Date creationDate)
Sets the date this ban object was created.

Parameters:
creationDate - the date this ban object was created.

getCreationDate

public Date getCreationDate()
Gets the date this ban object was created.

Returns:
the date this ban object was created.

setExpirationDate

public void setExpirationDate(Date expirationDate)
Sets the date this ban object will expire, or null if it is a permanent ban object.

Parameters:
expirationDate - the date this ban object will expire, or null if it is permanent

getExpirationDate

public Date getExpirationDate()
Gets the date this ban object will expire, or null if it is a permanent ban object.

Returns:
the date this ban object will expire, or null if it is permanent

setComment

public void setComment(String comment)
Sets a comment on this ban object.

Parameters:
comment - the comment for this ban.

getComment

public String getComment()
Gets a comment for this ban object.

Returns:
the comment for this ban.

getCachedSize

public int getCachedSize()

readExternal

public void readExternal(DataInput in)
                  throws IOException
Throws:
IOException

writeExternal

public void writeExternal(DataOutput out)
                   throws IOException
Throws:
IOException

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

Jive Product Page

Copyright © 1999-2007 Jive Software.