Class PrivacyList
java.lang.Object
org.jivesoftware.openfire.privacy.PrivacyList
- All Implemented Interfaces:
Externalizable,Serializable,Cacheable
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:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor added for Externalizable.PrivacyList(String username, String name, boolean isDefault, org.dom4j.Element listElement) -
Method Summary
Modifier and TypeMethodDescriptionorg.dom4j.ElementReturns an Element with the privacy list XML representation.booleanSet<org.xmpp.packet.JID>Returns all JIDs that are on the blocklist (as defined in XEP-0191).intReturns the approximate size of the Object in bytes.getItems()Returns the 'raw' items on the privacy list.getName()Returns the name that uniquely identifies this list among the users lists.org.xmpp.packet.JIDReturns the JID of the user that owns this privacy list.inthashCode()booleanReturns true if this privacy list is the default list to apply for the user.voidvoidsetDefaultList(boolean isDefault) Sets if this privacy list is the default list to apply for the user.booleanshouldBlockPacket(org.xmpp.packet.Packet packet) Returns true if the specified packet must be blocked based on this privacy list rules.voidupdateList(org.dom4j.Element listElement) Sets the new list items based on the specified Element.void
-
Constructor Details
-
PrivacyList
public PrivacyList()Constructor added for Externalizable. Do not use this constructor. -
PrivacyList
-
-
Method Details
-
getUserJID
public org.xmpp.packet.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
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 overridden 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 overridden 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(org.xmpp.packet.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.
-
getBlockedJIDs
Returns all JIDs that are on the blocklist (as defined in XEP-0191).- Returns:
- a collection of JIDs (possibly empty, never null)
-
getItems
Returns the 'raw' items on the privacy list.- Returns:
- privacy list items.
-
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
Description copied from interface:CacheableReturns 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:
getCachedSizein interfaceCacheable- Returns:
- the size of the Object in bytes.
- Throws:
CannotCalculateSizeException- if the size cannot be calculated
-
hashCode
public int hashCode() -
equals
-
writeExternal
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readExternal
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-