Style Intelligence v12.0

inetsoft.uql
Class XPrincipal

java.lang.Object
  extended by inetsoft.uql.XPrincipal
All Implemented Interfaces:
Serializable, Cloneable, Principal
Direct Known Subclasses:
SRPrincipal

public class XPrincipal
extends Object
implements Principal, Serializable, Cloneable

A Principal implementation used to identify a user to the query engine.

Since:
6.1
See Also:
Serialized Form

Field Summary
static String ADMIN
          Property name for admin.
static String ADMINISTRATOR
          The built-in adminstator role.
static String ADMINISTRATOR_R
          The built-in adminstator role which is read-only.
static String ALIAS
          The property name for alias.
static String ANONYMOUS
          Anonymous user name.
static String EVERYONE
          The built-in everyone role.
protected  String[] groups
           
static String LOCALE
          Property name for user locale.
protected  String name
           
protected  Hashtable params
           
protected  Properties prop
           
protected  String[] roles
           
protected  String sessionID
           
 
Constructor Summary
XPrincipal(String name)
          Creates a new instance of XPrincipal.
XPrincipal(String name, String[] roles, String[] groups)
          Creates a new instance of XPrincipal.
 
Method Summary
 int addr()
          Returns the original hashCode.
 Object clone()
          Clone the object.
 void copyRoleGroups(XPrincipal others)
          Copy role and groups from another principal.
 boolean equals(Object another)
          Determines if this XPrincipal is equivelent to another object.
 String getAlias()
          Get the alias of the specified user.
 String getFullName()
          Get the full identifier of this specified user (ip, session, etc.)
 String[] getGroups()
          Gets the groups assigned to the user.
 String getName()
          Gets the name of the user.
 String getProperty(String name)
          Get a property value.
 Enumeration getPropertyNames()
          Get all attribute names.
 String[] getRoles()
          Gets the roles assigned to the user.
 String getSessionID()
          Get the session id.
 int hashCode()
          Gets a hash code for this object.
 boolean isAdmin()
          Check if is admin.
static boolean isAdmin(String roleid)
          Check if is admin.
 boolean isIgnoreLogin()
          Check if should not check login status.
 void parseXML(Element elem)
          Parse xml element representation.
 void setAdmin(boolean admin)
          Set whether is admin.
 void setAlias(String alias)
          Set the alias to this specified user.
 void setGroups(String[] groups)
          Sets the groups assigned to the user.
 void setIgnoreLogin(boolean ignoreLogin)
          Set ignore login status.
 void setProperty(String name, String val)
          Set a property.
 void setRoles(String[] roles)
          Sets roles assigned to the user.
 String toString()
          Gets a string representation of this object.
 String toView()
          Get the view of this specified user (alias will be used if any).
 void writeXML(PrintWriter writer)
          Write xml element representation to a print writer.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

LOCALE

public static final String LOCALE
Property name for user locale. The user locale information can be set or accessed using this property name and getProperty or setProperty methods. For example, XPrincipal can be localized for US-English as follows: setProperty(XPrincipal.LOCALE,"en_US").

See Also:
Constant Field Values

ADMIN

public static final String ADMIN
Property name for admin.

See Also:
Constant Field Values

ANONYMOUS

public static final String ANONYMOUS
Anonymous user name.

See Also:
Constant Field Values

ADMINISTRATOR

public static String ADMINISTRATOR
The built-in adminstator role.


ADMINISTRATOR_R

public static String ADMINISTRATOR_R
The built-in adminstator role which is read-only.


EVERYONE

public static String EVERYONE
The built-in everyone role.


ALIAS

public static String ALIAS
The property name for alias.


name

protected String name

roles

protected String[] roles

groups

protected String[] groups

sessionID

protected String sessionID

prop

protected Properties prop

params

protected Hashtable params
Constructor Detail

XPrincipal

public XPrincipal(String name)
Creates a new instance of XPrincipal.

Parameters:
name - the name of the user.

XPrincipal

public XPrincipal(String name,
                  String[] roles,
                  String[] groups)
Creates a new instance of XPrincipal.

Parameters:
name - the name of the user.
roles - the roles assigned to the user.
Method Detail

isAdmin

public static boolean isAdmin(String roleid)
Check if is admin.


getName

public String getName()
Gets the name of the user.

Specified by:
getName in interface Principal
Returns:
the name of the user.

setRoles

public void setRoles(String[] roles)
Sets roles assigned to the user.

Parameters:
roles - an array of the names of the roles assigned to the user.

setGroups

public void setGroups(String[] groups)
Sets the groups assigned to the user.

Parameters:
groups - an array of the names of the groups assigned to the user.

getRoles

public String[] getRoles()
Gets the roles assigned to the user.

Returns:
an array of the names of the roles assigned to the user.

getGroups

public String[] getGroups()
Gets the groups assigned to the user.

Returns:
an array of the names of the groups assigned to the user.

getSessionID

public String getSessionID()
Get the session id.

Returns:
the session id if any, null otherwise.

setAdmin

public void setAdmin(boolean admin)
Set whether is admin.

Parameters:
admin - true if is admin, false otherwise.

isAdmin

public boolean isAdmin()
Check if is admin.

Returns:
true if is admin, false otherwise.

setProperty

public void setProperty(String name,
                        String val)
Set a property.

Parameters:
name - property name.
val - property value.

getProperty

public String getProperty(String name)
Get a property value.

Parameters:
name - property name.
Returns:
property value.

getPropertyNames

public Enumeration getPropertyNames()
Get all attribute names.


equals

public boolean equals(Object another)
Determines if this XPrincipal is equivelent to another object.

Specified by:
equals in interface Principal
Overrides:
equals in class Object
Parameters:
another - the object to compare.
Returns:
true if the objects are equivelent; false otherwise.

hashCode

public int hashCode()
Gets a hash code for this object.

Specified by:
hashCode in interface Principal
Overrides:
hashCode in class Object
Returns:
a hash code.

toString

public String toString()
Gets a string representation of this object.

Specified by:
toString in interface Principal
Overrides:
toString in class Object
Returns:
a string representation of this object.

addr

public int addr()
Returns the original hashCode.


writeXML

public void writeXML(PrintWriter writer)
Write xml element representation to a print writer.

Parameters:
writer - the specified print writer

parseXML

public void parseXML(Element elem)
              throws Exception
Parse xml element representation.

Parameters:
elem - the specified xml element representation
Throws:
Exception

clone

public Object clone()
Clone the object.

Overrides:
clone in class Object

copyRoleGroups

public void copyRoleGroups(XPrincipal others)
Copy role and groups from another principal.


setIgnoreLogin

public void setIgnoreLogin(boolean ignoreLogin)
Set ignore login status.

Parameters:
ignoreLogin - true if should not check login status of this principal, false otherwise.

isIgnoreLogin

public boolean isIgnoreLogin()
Check if should not check login status.

Returns:
true if hould not check login status of this principal, false otherwise.

setAlias

public void setAlias(String alias)
Set the alias to this specified user.


getAlias

public String getAlias()
Get the alias of the specified user.


toView

public String toView()
Get the view of this specified user (alias will be used if any).


getFullName

public String getFullName()
Get the full identifier of this specified user (ip, session, etc.)


Copyright © 1996-2014 InetSoft Technology Corp. All Rights Reserved.