Openfire 3.6.0 Javadoc

org.jivesoftware.openfire.privacy
Class PrivacyList

java.lang.Object
  extended by org.jivesoftware.openfire.privacy.PrivacyList
All Implemented Interfaces:
Externalizable, Serializable, Cacheable

public class PrivacyList
extends Object
implements Cacheable, Externalizable

A privacy list contains a set of rules that define if communication with the list owner is allowed or denied. Users may have zero, one or more privacy lists. When a list is the default list then that list is going to be used by default for all user sessions or analyze, when user is offline, if communication may proceed (e.g. define if a message should be stored offline). A user may configure is he wants to have a default list or not. When no default list is defined then communication will not be blocked. However, users may define an active list for a particular session. Active lists override default list (if there is one) and will be used only for the duration of the session.

Author:
Gaston Dombiak
See Also:
Serialized Form

Constructor Summary
PrivacyList()
          Constructor added for Externalizable.
PrivacyList(String username, String name, boolean isDefault, org.dom4j.Element listElement)
           
 
Method Summary
 org.dom4j.Element asElement()
          Returns an Element with the privacy list XML representation.
 boolean equals(Object object)
           
 int getCachedSize()
          Returns the approximate size of the Object in bytes.
 String getName()
          Returns the name that uniquely identifies this list among the users lists.
 JID getUserJID()
          Returns the JID of the user that owns this privacy list.
 int hashCode()
           
 boolean isDefault()
          Returns true if this privacy list is the default list to apply for the user.
 void readExternal(ObjectInput in)
           
 void setDefaultList(boolean isDefault)
          Sets if this privacy list is the default list to apply for the user.
 boolean shouldBlockPacket(Packet packet)
          Returns true if the specified packet must be blocked based on this privacy list rules.
 void updateList(org.dom4j.Element listElement)
          Sets the new list items based on the specified Element.
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PrivacyList

public PrivacyList()
Constructor added for Externalizable. Do not use this constructor.


PrivacyList

public PrivacyList(String username,
                   String name,
                   boolean isDefault,
                   org.dom4j.Element listElement)
Method Detail

getUserJID

public JID getUserJID()
Returns the JID of the user that owns this privacy list.

Returns:
the JID of the user that owns this privacy list.

getName

public String getName()
Returns the name that uniquely identifies this list among the users lists.

Returns:
the name that uniquely identifies this list among the users lists.

isDefault

public boolean isDefault()
Returns true if this privacy list is the default list to apply for the user. Default privacy lists can be overriden per session by setting an active privacy list.

Returns:
true if this privacy list is the default list to apply for the user.

setDefaultList

public void setDefaultList(boolean isDefault)
Sets if this privacy list is the default list to apply for the user. Default privacy lists can be overriden per session by setting an active privacy list.

Parameters:
isDefault - true if this privacy list is the default list to apply for the user.

shouldBlockPacket

public boolean shouldBlockPacket(Packet packet)
Returns true if the specified packet must be blocked based on this privacy list rules. Rules are going to be analyzed based on their order (in ascending order). When a rule is matched then communication will be blocked or allowed based on that rule. No more further analysis is going to be made.

Parameters:
packet - the packet to analyze if it must be blocked.
Returns:
true if the specified packet must be blocked based on this privacy list rules.

asElement

public org.dom4j.Element asElement()
Returns an Element with the privacy list XML representation.

Returns:
an Element with the privacy list XML representation.

updateList

public void updateList(org.dom4j.Element listElement)
Sets the new list items based on the specified Element. The Element must contain a list of item elements.

Parameters:
listElement - the element containing a list of items.

getCachedSize

public int getCachedSize()
Description copied from interface: Cacheable
Returns the approximate size of the Object in bytes. The size should be considered to be a best estimate of how much memory the Object occupies and may be based on empirical trials or dynamic calculations.

Specified by:
getCachedSize in interface Cacheable
Returns:
the size of the Object in bytes.

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

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

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Specified by:
writeExternal in interface Externalizable
Throws:
IOException

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Specified by:
readExternal in interface Externalizable
Throws:
IOException
ClassNotFoundException

Openfire 3.6.0 Javadoc

Copyright © 2003-2008 Jive Software.