Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.RuntimeCollective.webapps.tag
Class BelongsToTag  view BelongsToTag download BelongsToTag.java

java.lang.Object
  extended byjavax.servlet.jsp.tagext.TagSupport
      extended bycom.RuntimeCollective.webapps.tag.BelongsToTag
All Implemented Interfaces:
javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, java.io.Serializable, javax.servlet.jsp.tagext.Tag

public class BelongsToTag
extends javax.servlet.jsp.tagext.TagSupport

Evaluate the body of this tag only if the user specified by name, property and scope (or the currently logged-on user, if name is not specified) is a member (or not!) of the given group, or is a member of any group with the given group type.

This tag takes the following optional parameters. Either group or groupType must be specified:

An example of how to use the groups parameter to allow only members of the Administrators or Editors group:

<rs:belongsTo groups='<%= new String[]{"Administrators", "Editors"} %>'>

Version:
$Id: BelongsToTag.java,v 1.13 2003/09/30 15:13:16 joe Exp $

Field Summary
private  java.lang.String iGroup
          The name of the group that the user must be a member of [Optional]
private  java.lang.String[] iGroups
          The names of the groups, at least one of which the user must be a member of [Optional]
private  java.lang.String iGroupType
          The user must be a member of at least one group that has this group type [Optional]
private  boolean iNotIn
          Whether the user should be in or not [Optional]
protected  java.lang.String name
          Name of the bean that contains the user to check groups for.
protected  java.lang.String property
          Name of the property to be accessed on the specified bean.
protected  java.lang.String scope
          The scope to be searched to retrieve the specified bean.
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext
 
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
BelongsToTag()
           
 
Method Summary
private  boolean checkBelongs(com.RuntimeCollective.webapps.bean.User user)
          If the group attribute is set, check the user is in the specified group.
 int doEndTag()
          Evaluate the remainder of the current page normally.
 int doStartTag()
          Check if the user specified by name, property and scope (or the session user, if name is not specified) belongs to the appropriate group/group type, and evaluate the body of this tag if they do.
 java.lang.String getGroup()
          Get the name of the group that the user must be a member of [Optional]
 java.lang.String[] getGroups()
          Get the names of the groups, at least one of which the user user must be a member of [Optional]
 java.lang.String getGroupType()
          Get the name of the group type containing a group that the user must be a member of [Optional]
 java.lang.String getName()
           
 boolean getNotIn()
          Get whether the user should be in or not [Optional]
 java.lang.String getProperty()
           
 java.lang.String getScope()
           
 void release()
          Release all allocated resources.
 void setGroup(java.lang.String group)
          Set the name of the group that the user must be a member of [Optional]
 void setGroups(java.lang.String[] groups)
          Set the names of the groups, at least one of which the user user must be a member of [Optional]
 void setGroupType(java.lang.String groupType)
          Set the name of the group type containing a group that the user must be a member of [Optional]
 void setName(java.lang.String name)
           
 void setNotIn(boolean notIn)
          Set whether the user should be in or not [Optional]
 void setProperty(java.lang.String property)
           
 void setScope(java.lang.String scope)
           
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
doAfterBody, findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

iGroup

private java.lang.String iGroup
The name of the group that the user must be a member of [Optional]


iGroups

private java.lang.String[] iGroups
The names of the groups, at least one of which the user must be a member of [Optional]


iGroupType

private java.lang.String iGroupType
The user must be a member of at least one group that has this group type [Optional]


iNotIn

private boolean iNotIn
Whether the user should be in or not [Optional]


name

protected java.lang.String name
Name of the bean that contains the user to check groups for.


property

protected java.lang.String property
Name of the property to be accessed on the specified bean.


scope

protected java.lang.String scope
The scope to be searched to retrieve the specified bean.

Constructor Detail

BelongsToTag

public BelongsToTag()
Method Detail

getGroup

public java.lang.String getGroup()
Get the name of the group that the user must be a member of [Optional]


setGroup

public void setGroup(java.lang.String group)
Set the name of the group that the user must be a member of [Optional]


getGroups

public java.lang.String[] getGroups()
Get the names of the groups, at least one of which the user user must be a member of [Optional]


setGroups

public void setGroups(java.lang.String[] groups)
Set the names of the groups, at least one of which the user user must be a member of [Optional]


getGroupType

public java.lang.String getGroupType()
Get the name of the group type containing a group that the user must be a member of [Optional]


setGroupType

public void setGroupType(java.lang.String groupType)
Set the name of the group type containing a group that the user must be a member of [Optional]


getNotIn

public boolean getNotIn()
Get whether the user should be in or not [Optional]


setNotIn

public void setNotIn(boolean notIn)
Set whether the user should be in or not [Optional]


getName

public java.lang.String getName()

setName

public void setName(java.lang.String name)

getProperty

public java.lang.String getProperty()

setProperty

public void setProperty(java.lang.String property)

getScope

public java.lang.String getScope()

setScope

public void setScope(java.lang.String scope)

doStartTag

public int doStartTag()
               throws javax.servlet.jsp.JspException
Check if the user specified by name, property and scope (or the session user, if name is not specified) belongs to the appropriate group/group type, and evaluate the body of this tag if they do.


doEndTag

public int doEndTag()
             throws javax.servlet.jsp.JspException
Evaluate the remainder of the current page normally.


release

public void release()
Release all allocated resources.


checkBelongs

private boolean checkBelongs(com.RuntimeCollective.webapps.bean.User user)
                      throws javax.servlet.jsp.JspException
If the group attribute is set, check the user is in the specified group.

Otherwise, if the groupType attribute is set, check the user is in at least one group of the given type.