com.starbase.starteam
Class GroupAccount

java.lang.Object
  |
  +--com.starbase.starteam.CacheRef
        |
        +--com.starbase.starteam.GroupAccount
All Implemented Interfaces:
java.lang.Cloneable

public class GroupAccount
extends CacheRef

This class represents a full StarTeam Group account. New groups can be added to a StarTeam Server and existing groups can be modified through this class. Whereas the Group class only provides access to a group's name and ID, the GroupAccount supports access to all information about a group. All users can obtain Group information but only users with the appropriate permissions can access GroupAccount information.

See Also:
ServerAdministration.getGroupAccounts(), Permission.SERVER_ADMIN_USER_ACCOUNTS, Group

Field Summary
static int ID_ALL_USERS
          The ID of the "All Users" group.
 
Constructor Summary
GroupAccount(Server server)
          Creates a new StarTeam Group object.
 
Method Summary
 void addPermission(int permission)
          Add this permission to the set of permissions for this GroupAccount.
 boolean canRemove()
          Returns true if this GroupAccount and all of its descendants can be deleted without leaving any "orphan" users (i.e., users with no group membership).
 GroupAccount copy()
          Creates a copy of this GroupAccount object.
 boolean equals(java.lang.Object source)
          returns true if this object instance is equal to the source
 java.lang.String getDescription()
          Returns the group description.
 java.lang.String getFullName()
          Returns a qualified name for the group, showing both the group and its parents.
 int getID()
          Returns this group's integer indentifier.
 java.lang.String getName()
          Returns the group name.
 GroupAccount getParent()
          Returns this groups's parent GroupAccount.
 int getPermissionsFlags()
          Returns the permissions flags for this group.
 Server getServer()
          Returns the Server object to which this GroupAccount belongs.
 GroupAccount[] getSubGroupAccounts()
          Returns all of the sub-GroupAccounts for which this GroupAccount is the parent.
 UserAccount[] getUserAccounts()
          Returns a list of UserAccount objects that directly belong to this group.
 int hashCode()
          returns a unique hash for all instances of this type
 boolean hasPermission(int permission)
          Returns true if this GroupAccount has the specified permission.
 boolean isBuiltin()
          Return true if this is a builtin GroupAccount.
 boolean isDeleted()
          Returns true if the GroupAccount has been deleted.
 boolean isEqualTo(GroupAccount account)
          Compares two GroupAccount objects.
 boolean isMember(int userID)
          Return true if the specified user can be considered a member of this GroupAccount.
 boolean isNew()
          Returns true if this GroupAccount has not yet been created on the Server.
 boolean isRoot()
          Returns true if this is a top-level group with no parent group.
 void remove()
          Removes this group from the StarTeam server, plus any direct or indirect subgroups of this group.
 void removePermission(int permission)
          Removes the specified permission from this GroupAccount.
 void setDescription(java.lang.String description)
          Changes the group description.
 void setName(java.lang.String name)
          Changes the group name.
 void setParent(GroupAccount parent)
          Change the parent GroupAccount for this group.
 void update()
          Persistently saves the changes to this GroupAccount in the server.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ID_ALL_USERS

public static final int ID_ALL_USERS
The ID of the "All Users" group.

See Also:
Constant Field Values
Constructor Detail

GroupAccount

public GroupAccount(Server server)
Creates a new StarTeam Group object. It is initially not a subgroup of any existing group and one should call setParent to change this. The name is initially the empty string. To create this group in the StarTeam server you must call update.

Parameters:
server - the StarTeam Server to which this group belongs.
Method Detail

copy

public GroupAccount copy()
Creates a copy of this GroupAccount object. Useful to applications that want to save a snapshot of the account information in a given state, for example, before calling ServerAdministration.refreshAccounts().

Returns:
A new copy of this GroupAccount object.
See Also:
GroupAccount.isEqualTo(GroupAccount)

isNew

public boolean isNew()
Returns true if this GroupAccount has not yet been created on the Server.

Returns:
true if this GroupAccount has not yet been created on the Server.

isDeleted

public boolean isDeleted()
Returns true if the GroupAccount has been deleted.

Returns:
true if the GroupAccount has been deleted.

getID

public int getID()
Returns this group's integer indentifier.

Returns:
this group's integer indentifier.

getName

public java.lang.String getName()
Returns the group name.

Returns:
the group name.
See Also:
GroupAccount.getFullName()

setName

public void setName(java.lang.String name)
Changes the group name. You must call update to save this change.

Parameters:
name - the new name for the group.
See Also:
GroupAccount.update()

getFullName

public java.lang.String getFullName()
Returns a qualified name for the group, showing both the group and its parents.

Returns:
A qualified name for the group, showing both the group and its parents.
See Also:
GroupAccount.getName(), GroupAccount.getParent()

getDescription

public java.lang.String getDescription()
Returns the group description.

Returns:
the group description.

setDescription

public void setDescription(java.lang.String description)
Changes the group description. You must call update to save this change.

Parameters:
description - the new description for the group.
See Also:
GroupAccount.update()

isRoot

public boolean isRoot()
Returns true if this is a top-level group with no parent group.

Returns:
true if this is a top-level group with no parent group.
See Also:
GroupAccount.getParent()

getParent

public GroupAccount getParent()
Returns this groups's parent GroupAccount. If the group is a top-level group then this may return null.

Returns:
the parent GroupAccount for this group.
See Also:
GroupAccount.isRoot()

setParent

public void setParent(GroupAccount parent)
Change the parent GroupAccount for this group. The parent may be null in which case the group will be a root group.

Parameters:
parent - the new parent GroupAccount for this group
See Also:
GroupAccount.isRoot()

getPermissionsFlags

public int getPermissionsFlags()
Returns the permissions flags for this group.

Returns:
the permissions flags for this group.
See Also:
Permission

hasPermission

public boolean hasPermission(int permission)
Returns true if this GroupAccount has the specified permission.

Parameters:
permission - the permission in question
Returns:
true if this GroupAccount has the specified permission.
See Also:
Permission

addPermission

public void addPermission(int permission)
Add this permission to the set of permissions for this GroupAccount.

Parameters:
permission - the permission to add
See Also:
Permission

removePermission

public void removePermission(int permission)
Removes the specified permission from this GroupAccount.

Parameters:
permission - the permission to remove
See Also:
Permission

getServer

public Server getServer()
Returns the Server object to which this GroupAccount belongs.

Returns:
the Server object to which this GroupAccount belongs.

getSubGroupAccounts

public GroupAccount[] getSubGroupAccounts()
Returns all of the sub-GroupAccounts for which this GroupAccount is the parent. The list may be empty but will never be null. The only way to change this list of sub groups is by modifying the parent GroupAccount of one of the children.

Returns:
the sub GroupAccounts of this GroupAccount
See Also:
GroupAccount.setParent(com.starbase.starteam.GroupAccount)

getUserAccounts

public UserAccount[] getUserAccounts()
Returns a list of UserAccount objects that directly belong to this group. The only way to change this list is through the UserAccount methods for adding and removing the UserAccount to a GroupAccount.

Returns:
the UserAccount objects directly belonging to this group.
See Also:
UserAccount.addToGroupAccount(com.starbase.starteam.GroupAccount), UserAccount.removeFromGroupAccount(com.starbase.starteam.GroupAccount)

isMember

public boolean isMember(int userID)
Return true if the specified user can be considered a member of this GroupAccount. A user is defined to be a member of a GroupAccount if it is directly a member of the GroupAccount or recusively of any sub-GroupAccount of this GroupAccount.

Parameters:
userID - the user ID being checked for group membership
Returns:
true if the specified user ID is a member of this or any sub group

update

public void update()
            throws java.lang.IllegalStateException
Persistently saves the changes to this GroupAccount in the server. If the GroupAccount is new it will be added, otherwise it will be modified.

Throws:
java.lang.IllegalStateException - if this is a new GroupAccount with no Parent assigned.

remove

public void remove()
            throws java.lang.IllegalStateException
Removes this group from the StarTeam server, plus any direct or indirect subgroups of this group. If the GroupAccount was never saved (isNew() returns true), if it is a builtin account, or if removing this group or any of its descendants would leave one or more users without any group membership, then an exception will be thrown. Note also that any affected UserAccounts will be updated, including any pending changes, as a side effect of this method.

Throws:
java.lang.IllegalStateException - if this GroupAccount was never saved, if it is a builtin account, or if removing it would result in a user having no group membership.
See Also:
GroupAccount.isNew()

canRemove

public boolean canRemove()
Returns true if this GroupAccount and all of its descendants can be deleted without leaving any "orphan" users (i.e., users with no group membership).

Returns:
true if this GroupAccount and all of its descendants can be deleted without leaving any users with no group membership.

isBuiltin

public boolean isBuiltin()
Return true if this is a builtin GroupAccount.

Returns:
true if this is a builtin GroupAccount.

isEqualTo

public boolean isEqualTo(GroupAccount account)
Compares two GroupAccount objects.

Parameters:
account - The GroupAccount to be compared with this one.
Returns:
true if no differences were found.
See Also:
GroupAccount.copy()

equals

public boolean equals(java.lang.Object source)
returns true if this object instance is equal to the source

Overrides:
equals in class java.lang.Object
Parameters:
source - Object the source to comapre with
Returns:
boolean true if this object is equal to the source

hashCode

public int hashCode()
returns a unique hash for all instances of this type

Overrides:
hashCode in class java.lang.Object
Returns:
int a unique hash for all instances of this type


StarTeam SDK 10.4, Build 36
Copyright © 2003-2008 Borland Software Corporation. All rights reserved.