okapi.coreobjects
Class OkapiGroup

java.lang.Object
  extended by okapi.coreobjects.OkapiObject
      extended by okapi.coreobjects.OkapiGroup
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable

public class OkapiGroup
extends OkapiObject
implements java.lang.Comparable

Group/list object.

Version:
$Revision: 31044 $, $Date: 2008-09-02 17:08:01 -0400 (Tue, 02 Sep 2008) $
Author:
MIT Stellar team
See Also:
Serialized Form

Field Summary
static OkapiGroup anyUserGroup
           
static OkapiGroup authUserGroup
           
protected  int update_rows_affected
          Rows affected by updateDB.
static OkapiGroup worldGroup
           
 
Fields inherited from class okapi.coreobjects.OkapiObject
createdBy, createdDate, description, lastModifiedBy, lastModifiedDate, longName, name, objectID, status
 
Constructor Summary
OkapiGroup()
          Create a new empty Group.
OkapiGroup(int groupCode)
          Return the Group object for this groupCode
 
Method Summary
 void addMember(OkapiGroup group)
          Add a Group to this group.
 void addMember(OkapiUser user)
          Add a User to this group.
static int cacheCheck()
          Method cacheCheck
static int cacheNameCheck()
          Method cacheNameCheck
 boolean checkAuthorization(OkapiUser user, OkapiOperation operation)
          Checks to see if the specified user is authorized to perform the specified operation on this object.
 int compareTo(java.lang.Object o)
          implement Comparable interface
 int compareTo(OkapiGroup group)
          Method compareTo
 boolean equals(java.lang.Object o)
          override Object equals method to compare two groups
 java.lang.String getAsXml(java.util.Map options, java.lang.String tag, int indent)
          Overrides the method in OkapiObject to add Group specific information.
 java.lang.String getDatasource()
          Method getDatasource
 java.lang.String getDatasourceKey()
          Method getDatasourceKey
static OkapiGroup getGroup(int groupCode)
          Get a group from the cache if cached, instantiate and add to cache if not.
 int getGroupCode()
          Return groupCode of this group.
 java.util.Vector getMembers(boolean expand)
          Return the list of users and groups in this group.
 OkapiRole getRole()
          Return the role for this group.
protected static java.util.List groupsForUser(OkapiUser user, boolean recurse)
          Return a List of all Groups the User is in, recursively if recurse is true.
 int hashCode()
          override hashCode to use the database table sequence number
 void refreshFromDB()
          Refresh this object with the data currently stored in the DB.
 void removeMember(OkapiGroup group)
          Remove a member from this group.
 void removeMember(OkapiUser user)
          Remove a member from this group.
 void setDataSource(javax.sql.DataSource dataSource)
          Set the dataSource to be used for data access.
 void setDatasource(java.lang.String datasource)
          Method setDatasource
 void setDatasourceKey(java.lang.String datasource_key)
          Method setDatasourceKey
 void setDescription(java.lang.String newDescription)
          Method setDescription
protected  void setLastModifiedBy(OkapiUser newLastModifiedBy)
           
protected  void setLastModifiedBy(java.lang.String newLastModifiedBy)
           
protected  void setLastModifiedDate(java.util.Date newLastModifiedDate)
           
 void setLongName(java.lang.String newLongName)
          Method setLongName
 void setName(java.lang.String newName)
          overwrote OkapiObject's set methods to set db_action
 void setRole(OkapiRole role)
          Set the Role to which all members of the group belong.
 void updateDB()
          Update the database record for this object.
static java.util.List userGroups(OkapiUser user, boolean expand)
          Return a List of all Groups the User is in, recursively if the boolean is set to true.
 
Methods inherited from class okapi.coreobjects.OkapiObject
currentDateTimeOracle, getAsXml, getAsXml, getAsXml, getCreatedBy, getCreatedDate, getDescription, getLastModifiedBy, getLastModifiedDate, getLongName, getName, getObjectID, getStatus, isEncryptionRequired, setAuthorization, setCreatedBy, setCreatedDate, setStatus
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

update_rows_affected

protected int update_rows_affected
Rows affected by updateDB. This might be removed if updateDB is changed to return an int


authUserGroup

public static OkapiGroup authUserGroup

anyUserGroup

public static OkapiGroup anyUserGroup

worldGroup

public static OkapiGroup worldGroup
Constructor Detail

OkapiGroup

public OkapiGroup()
Create a new empty Group. We assume that they are here to change the group data itself. If they want to add or delete members, they'll have to say so explicitly


OkapiGroup

public OkapiGroup(int groupCode)
Return the Group object for this groupCode

Method Detail

cacheCheck

public static int cacheCheck()
Method cacheCheck

Returns:
int

cacheNameCheck

public static int cacheNameCheck()
Method cacheNameCheck

Returns:
int

getGroup

public static OkapiGroup getGroup(int groupCode)
Get a group from the cache if cached, instantiate and add to cache if not.


getGroupCode

public int getGroupCode()
Return groupCode of this group.


setName

public void setName(java.lang.String newName)
overwrote OkapiObject's set methods to set db_action

Overrides:
setName in class OkapiObject

setLongName

public void setLongName(java.lang.String newLongName)
Method setLongName

Overrides:
setLongName in class OkapiObject
Parameters:
newLongName -

setDescription

public void setDescription(java.lang.String newDescription)
Method setDescription

Overrides:
setDescription in class OkapiObject
Parameters:
newDescription -

setLastModifiedDate

protected void setLastModifiedDate(java.util.Date newLastModifiedDate)
Overrides:
setLastModifiedDate in class OkapiObject

setLastModifiedBy

protected void setLastModifiedBy(OkapiUser newLastModifiedBy)
Overrides:
setLastModifiedBy in class OkapiObject

setLastModifiedBy

protected void setLastModifiedBy(java.lang.String newLastModifiedBy)
Overrides:
setLastModifiedBy in class OkapiObject

setRole

public void setRole(OkapiRole role)
Set the Role to which all members of the group belong.


getRole

public OkapiRole getRole()
Return the role for this group.


setDatasource

public void setDatasource(java.lang.String datasource)
Method setDatasource

Parameters:
datasource -

getDatasource

public java.lang.String getDatasource()
Method getDatasource

Returns:
String

setDatasourceKey

public void setDatasourceKey(java.lang.String datasource_key)
Method setDatasourceKey

Parameters:
datasource_key -

getDatasourceKey

public java.lang.String getDatasourceKey()
Method getDatasourceKey

Returns:
String

addMember

public void addMember(OkapiUser user)
               throws java.lang.Exception
Add a User to this group. May not be permitted if the group is generated from a one-way datafeed.

Throws:
java.lang.Exception

addMember

public void addMember(OkapiGroup group)
               throws java.lang.Exception
Add a Group to this group. May not be permitted if the group is generated from a one-way datafeed.

Throws:
java.lang.Exception

removeMember

public void removeMember(OkapiUser user)
                  throws java.lang.Exception
Remove a member from this group. May not be permitted if the group is generated from a one-way datafeed.

Throws:
java.lang.Exception

removeMember

public void removeMember(OkapiGroup group)
                  throws java.lang.Exception
Remove a member from this group. May not be permitted if the group is generated from a one-way datafeed.

Throws:
java.lang.Exception

getMembers

public java.util.Vector getMembers(boolean expand)
                            throws java.lang.Exception
Return the list of users and groups in this group.

Throws:
java.lang.Exception

userGroups

public static java.util.List userGroups(OkapiUser user,
                                        boolean expand)
                                 throws java.lang.Exception
Return a List of all Groups the User is in, recursively if the boolean is set to true.

Throws:
java.lang.Exception

groupsForUser

protected static java.util.List groupsForUser(OkapiUser user,
                                              boolean recurse)
Return a List of all Groups the User is in, recursively if recurse is true.


equals

public boolean equals(java.lang.Object o)
override Object equals method to compare two groups

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
override hashCode to use the database table sequence number

Overrides:
hashCode in class java.lang.Object

compareTo

public int compareTo(java.lang.Object o)
implement Comparable interface

Specified by:
compareTo in interface java.lang.Comparable

compareTo

public int compareTo(OkapiGroup group)
Method compareTo

Parameters:
group -
Returns:
int

updateDB

public void updateDB()
Update the database record for this object.

Overrides:
updateDB in class OkapiObject

refreshFromDB

public void refreshFromDB()
Refresh this object with the data currently stored in the DB.

Overrides:
refreshFromDB in class OkapiObject

checkAuthorization

public boolean checkAuthorization(OkapiUser user,
                                  OkapiOperation operation)
Checks to see if the specified user is authorized to perform the specified operation on this object.

Overrides:
checkAuthorization in class OkapiObject

getAsXml

public java.lang.String getAsXml(java.util.Map options,
                                 java.lang.String tag,
                                 int indent)
Overrides the method in OkapiObject to add Group specific information. See OkapiObject.getAsXml(String tag, int indent) for more information about using the getAsXml methods.

Overrides:
getAsXml in class OkapiObject

setDataSource

public void setDataSource(javax.sql.DataSource dataSource)
Set the dataSource to be used for data access.

Parameters:
dataSource -


Copyright ? 2001-2009 MIT. All Rights Reserved.