Type enum is now public.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@6026 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Gaston Dombiak 2006-11-09 23:19:54 +00:00 committed by gato
parent 0e0f1701a4
commit 97824ebc1c
1 changed files with 99 additions and 99 deletions

View File

@ -1,15 +1,15 @@
package org.jivesoftware.smack.packet;
/**
* A privacy item acts a rule that when matched defines if a packet should be blocked or not.
* A privacy item acts a rule that when matched defines if a packet should be blocked or not.
*
* Privacy Items can handle different kind of blocking communications based on JID, group,
* Privacy Items can handle different kind of blocking communications based on JID, group,
* subscription type or globally by:<ul>
* <li>Allowing or blocking messages.
* <li>Allowing or blocking inbound presence notifications.
* <li>Allowing or blocking outbound presence notifications.
* <li>Allowing or blocking IQ stanzas.
* <li>Allowing or blocking all communications.
* <li>Allowing or blocking messages.
* <li>Allowing or blocking inbound presence notifications.
* <li>Allowing or blocking outbound presence notifications.
* <li>Allowing or blocking IQ stanzas.
* <li>Allowing or blocking all communications.
* </ul>
* @author Francisco Vives
*/
@ -18,12 +18,12 @@ public class PrivacyItem {
private boolean allow;
/** order is a non-negative integer that is unique among all items in the list. */
private int order;
/** rule hold the kind of communication ([jid|group|subscription]) it will allow or block and
/** rule hold the kind of communication ([jid|group|subscription]) it will allow or block and
* identifier to apply the action.
* If the type is "jid", then the 'value' attribute MUST contain a valid Jabber ID.
* If the type is "group", then the 'value' attribute SHOULD contain the name of a group
* If the type is "group", then the 'value' attribute SHOULD contain the name of a group
* in the user's roster.
* If the type is "subscription", then the 'value' attribute MUST be one of "both", "to",
* If the type is "subscription", then the 'value' attribute MUST be one of "both", "to",
* "from", or "none". */
private PrivacyRule rule;
@ -47,19 +47,19 @@ public class PrivacyItem {
this.setOrder(order);
}
/**
* Returns the action associated with the item, it MUST be filled and will allow or deny
/**
* Returns the action associated with the item, it MUST be filled and will allow or deny
* the communication.
*
*
* @return the allow communication status.
*/
public boolean isAllow() {
return allow;
}
/**
/**
* Sets the action associated with the item, it can allow or deny the communication.
*
*
* @param allow indicates if the receiver allow or deny the communication.
*/
private void setAllow(boolean allow) {
@ -67,9 +67,9 @@ public class PrivacyItem {
}
/**
/**
* Returns whether the receiver allow or deny incoming IQ stanzas or not.
*
*
* @return the iq filtering status.
*/
public boolean isFilterIQ() {
@ -77,9 +77,9 @@ public class PrivacyItem {
}
/**
/**
* Sets whether the receiver allows or denies incoming IQ stanzas or not.
*
*
* @param filterIQ indicates if the receiver allows or denies incoming IQ stanzas.
*/
public void setFilterIQ(boolean filterIQ) {
@ -87,9 +87,9 @@ public class PrivacyItem {
}
/**
/**
* Returns whether the receiver allows or denies incoming messages or not.
*
*
* @return the message filtering status.
*/
public boolean isFilterMessage() {
@ -97,9 +97,9 @@ public class PrivacyItem {
}
/**
/**
* Sets wheather the receiver allows or denies incoming messages or not.
*
*
* @param filterMessage indicates if the receiver allows or denies incoming messages or not.
*/
public void setFilterMessage(boolean filterMessage) {
@ -107,9 +107,9 @@ public class PrivacyItem {
}
/**
/**
* Returns whether the receiver allows or denies incoming presence or not.
*
*
* @return the iq filtering incoming presence status.
*/
public boolean isFilterPresence_in() {
@ -117,9 +117,9 @@ public class PrivacyItem {
}
/**
/**
* Sets whether the receiver allows or denies incoming presence or not.
*
*
* @param filterPresence_in indicates if the receiver allows or denies filtering incoming presence.
*/
public void setFilterPresence_in(boolean filterPresence_in) {
@ -127,9 +127,9 @@ public class PrivacyItem {
}
/**
/**
* Returns whether the receiver allows or denies incoming presence or not.
*
*
* @return the iq filtering incoming presence status.
*/
public boolean isFilterPresence_out() {
@ -137,9 +137,9 @@ public class PrivacyItem {
}
/**
/**
* Sets whether the receiver allows or denies outgoing presence or not.
*
*
* @param filterPresence_out indicates if the receiver allows or denies filtering outgoing presence
*/
public void setFilterPresence_out(boolean filterPresence_out) {
@ -147,13 +147,13 @@ public class PrivacyItem {
}
/**
* Returns the order where the receiver is processed. List items are processed in
* ascending order.
*
* The order MUST be filled and its value MUST be a non-negative integer
/**
* Returns the order where the receiver is processed. List items are processed in
* ascending order.
*
* The order MUST be filled and its value MUST be a non-negative integer
* that is unique among all items in the list.
*
*
* @return the order number.
*/
public int getOrder() {
@ -161,27 +161,27 @@ public class PrivacyItem {
}
/**
/**
* Sets the order where the receiver is processed.
*
* The order MUST be filled and its value MUST be a non-negative integer
*
* The order MUST be filled and its value MUST be a non-negative integer
* that is unique among all items in the list.
*
*
* @param order indicates the order in the list.
*/
private void setOrder(int order) {
this.order = order;
}
/**
/**
* Sets the element identifier to apply the action.
*
*
* If the type is "jid", then the 'value' attribute MUST contain a valid Jabber ID.
* If the type is "group", then the 'value' attribute SHOULD contain the name of a group
* If the type is "group", then the 'value' attribute SHOULD contain the name of a group
* in the user's roster.
* If the type is "subscription", then the 'value' attribute MUST be one of "both", "to",
* If the type is "subscription", then the 'value' attribute MUST be one of "both", "to",
* "from", or "none".
*
*
* @param value is the identifier to apply the action.
*/
public void setValue(String value) {
@ -189,11 +189,11 @@ public class PrivacyItem {
this.getRule().setValue(value);
}
}
/**
* Returns the type hold the kind of communication it will allow or block.
* It MUST be filled with one of these values: jid, group or subscription.
*
/**
* Returns the type hold the kind of communication it will allow or block.
* It MUST be filled with one of these values: jid, group or subscription.
*
* @return the type of communication it represent.
*/
public Type getType() {
@ -203,16 +203,16 @@ public class PrivacyItem {
return this.getRule().getType();
}
}
/**
/**
* Returns the element identifier to apply the action.
*
*
* If the type is "jid", then the 'value' attribute MUST contain a valid Jabber ID.
* If the type is "group", then the 'value' attribute SHOULD contain the name of a group
* If the type is "group", then the 'value' attribute SHOULD contain the name of a group
* in the user's roster.
* If the type is "subscription", then the 'value' attribute MUST be one of "both", "to",
* If the type is "subscription", then the 'value' attribute MUST be one of "both", "to",
* "from", or "none".
*
*
* @return the identifier to apply the action.
*/
public String getValue() {
@ -224,12 +224,12 @@ public class PrivacyItem {
}
/**
/**
* Returns whether the receiver allows or denies every kind of communication.
*
* When filterIQ, filterMessage, filterPresence_in and filterPresence_out are not set
*
* When filterIQ, filterMessage, filterPresence_in and filterPresence_out are not set
* the receiver will block all communications.
*
*
* @return the all communications status.
*/
public boolean isFilterEverything() {
@ -245,9 +245,9 @@ public class PrivacyItem {
private void setRule(PrivacyRule rule) {
this.rule = rule;
}
/**
/**
* Answer an xml representation of the receiver according to the RFC 3921.
*
*
* @return the text xml representation.
*/
public String toXML() {
@ -285,11 +285,11 @@ public class PrivacyItem {
}
return buf.toString();
}
/**
* Privacy Rule represents the kind of action to apply.
* It holds the kind of communication ([jid|group|subscription]) it will allow or block and
* Privacy Rule represents the kind of action to apply.
* It holds the kind of communication ([jid|group|subscription]) it will allow or block and
* identifier to apply the action.
*/
@ -299,18 +299,18 @@ public class PrivacyItem {
* Available values are: [jid|group|subscription]
*/
private Type type;
/**
/**
* The value hold the element identifier to apply the action.
* If the type is "jid", then the 'value' attribute MUST contain a valid Jabber ID.
* If the type is "group", then the 'value' attribute SHOULD contain the name of a group
* If the type is "group", then the 'value' attribute SHOULD contain the name of a group
* in the user's roster.
* If the type is "subscription", then the 'value' attribute MUST be one of "both", "to",
* "from", or "none".
* If the type is "subscription", then the 'value' attribute MUST be one of "both", "to",
* "from", or "none".
*/
private String value;
/**
* If the type is "subscription", then the 'value' attribute MUST be one of "both",
* If the type is "subscription", then the 'value' attribute MUST be one of "both",
* "to", "from", or "none"
*/
public static final String SUBSCRIPTION_BOTH = "both";
@ -329,50 +329,50 @@ public class PrivacyItem {
rule.setType(Type.valueOf(value.toLowerCase()));
return rule;
}
/**
* Returns the type hold the kind of communication it will allow or block.
* It MUST be filled with one of these values: jid, group or subscription.
*
/**
* Returns the type hold the kind of communication it will allow or block.
* It MUST be filled with one of these values: jid, group or subscription.
*
* @return the type of communication it represent.
*/
public Type getType() {
return type;
}
/**
/**
* Sets the action associated with the item, it can allow or deny the communication.
*
*
* @param type indicates if the receiver allows or denies the communication.
*/
private void setType(Type type) {
this.type = type;
}
/**
/**
* Returns the element identifier to apply the action.
*
*
* If the type is "jid", then the 'value' attribute MUST contain a valid Jabber ID.
* If the type is "group", then the 'value' attribute SHOULD contain the name of a group
* If the type is "group", then the 'value' attribute SHOULD contain the name of a group
* in the user's roster.
* If the type is "subscription", then the 'value' attribute MUST be one of "both", "to",
* If the type is "subscription", then the 'value' attribute MUST be one of "both", "to",
* "from", or "none".
*
*
* @return the identifier to apply the action.
*/
public String getValue() {
return value;
}
/**
/**
* Sets the element identifier to apply the action.
*
*
* If the type is "jid", then the 'value' attribute MUST contain a valid Jabber ID.
* If the type is "group", then the 'value' attribute SHOULD contain the name of a group
* If the type is "group", then the 'value' attribute SHOULD contain the name of a group
* in the user's roster.
* If the type is "subscription", then the 'value' attribute MUST be one of "both", "to",
* If the type is "subscription", then the 'value' attribute MUST be one of "both", "to",
* "from", or "none".
*
*
* @param value is the identifier to apply the action.
*/
protected void setValue(String value) {
@ -382,12 +382,12 @@ public class PrivacyItem {
this.value = value;
}
}
/**
/**
* Sets the element identifier to apply the action.
*
*
* The 'value' attribute MUST be one of "both", "to", "from", or "none".
*
*
* @param value is the identifier to apply the action.
*/
private void setSuscriptionValue(String value) {
@ -403,7 +403,7 @@ public class PrivacyItem {
}
else if (SUBSCRIPTION_FROM.equalsIgnoreCase(value)) {
setValue = SUBSCRIPTION_FROM;
}
}
else if (SUBSCRIPTION_NONE.equalsIgnoreCase(value)) {
setValue = SUBSCRIPTION_NONE;
}
@ -413,21 +413,21 @@ public class PrivacyItem {
}
this.value = setValue;
}
/**
/**
* Returns if the receiver represents a subscription rule.
*
*
* @return if the receiver represents a subscription rule.
*/
public boolean isSuscription () {
return this.getType() == Type.subscription;
}
}
/**
* Type defines if the rule is based on JIDs, roster groups or presence subscription types.
*/
protected static enum Type {
public static enum Type {
/**
* JID being analyzed should belong to a roster group of the list's owner.
*/