org.astrogrid.community
Class User

java.lang.Object
  extended byorg.astrogrid.community.User

public class User
extends java.lang.Object

A bean to hold what is passed in the "community snippet". Note that the current interpretation of this is that the account contains an identifier of the form user@community - The group relates to the group that the user wishes to use for its credentials, this may be a cross community group. note that this should really be merged with the @link org.astrogrid.community.common.util.CommunityMessage class, which effectively does xml deserializtion (should be deprecated From iteration 5 - use @link org.astrogrid.community.beans.v1.Credentials, but may still be needed)

Since:
iteration4
Version:
$Name: $
Author:
Paul Harrison (pah@jb.man.ac.uk), mch

Field Summary
static User ANONYMOUS
           
 
Constructor Summary
User()
          Default constructor - creates null user
User(java.lang.String snippet)
          Creates a user from "community snippet" representation.
User(java.lang.String givenAccount, java.lang.String givenGroup, java.lang.String givenToken)
          Creates a user from the given account group & token.
User(java.lang.String userId, java.lang.String community, java.lang.String group, java.lang.String token)
           
 
Method Summary
 boolean equals(User user)
          Checks to see if this user refers to the same account as the given user
 java.lang.String getAccount()
           
 java.lang.String getCommunity()
          Return the community part of the account string
 java.lang.String getGroup()
           
 java.lang.String getToken()
           
 java.lang.String getUserId()
          gets the userid part of the account string - i.e.
 void setAccount(java.lang.String string)
           
 void setGroup(java.lang.String string)
           
 void setToken(java.lang.String string)
           
 java.lang.String toSnippet()
          Create a "community snippet" from this User.
 java.lang.String toString()
          Returns a string with the 'normal' representation of account@community
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ANONYMOUS

public static final User ANONYMOUS
Constructor Detail

User

public User()
Default constructor - creates null user


User

public User(java.lang.String givenAccount,
            java.lang.String givenGroup,
            java.lang.String givenToken)
Creates a user from the given account group & token. The account & group cannot be null

Parameters:
givenAccount - the account in the form userid@community.
givenGroup - The group credential.
givenToken - The security token.

User

public User(java.lang.String userId,
            java.lang.String community,
            java.lang.String group,
            java.lang.String token)
Parameters:
userId - the user part of the account
community - the community part of the account
group - the group
token - the security token

User

public User(java.lang.String snippet)
Creates a user from "community snippet" representation.

Parameters:
snippet - The community snippet - this is an xml fragment.
Method Detail

getAccount

public java.lang.String getAccount()
Returns:

getGroup

public java.lang.String getGroup()
Returns:

getToken

public java.lang.String getToken()
Returns:

setAccount

public void setAccount(java.lang.String string)
Parameters:
string -

setGroup

public void setGroup(java.lang.String string)
Parameters:
string -

setToken

public void setToken(java.lang.String string)
Parameters:
string -

equals

public boolean equals(User user)
Checks to see if this user refers to the same account as the given user


toString

public java.lang.String toString()
Returns a string with the 'normal' representation of account@community


toSnippet

public java.lang.String toSnippet()
Create a "community snippet" from this User.

Returns:
The XML string that is the community snippet.

getCommunity

public java.lang.String getCommunity()
Return the community part of the account string

Returns:
will return null if the account is null or the community part does not exist - i.e. there is no @ in the string.

getUserId

public java.lang.String getUserId()
gets the userid part of the account string - i.e. that before the @

Returns:


Copyright © 2002-2007 AstroGrid. All Rights Reserved.