jsdai.lang
Class SdaiPermission

java.lang.Object
  extended byjsdai.lang.SdaiPermission
All Implemented Interfaces:
java.lang.Comparable

public class SdaiPermission
extends java.lang.Object
implements java.lang.Comparable

Enumeration class for representing access rights to remote SdaiRepositories, SdaiModels and SchemaInstances. On JSDAI-DB access rights can be assigned to above mentioned SDAI objects as well as to user groups.

Since:
4.0.0

Field Summary
static SdaiPermission ADMIN
          Administrative permission as SdaiPermission object.
static int ADMIN_INT
          Administrative permission as integer value.
static SdaiPermission DEFAULT
          Default permission as SdaiPermission object.
static int DEFAULT_INT
          Default permission as integer value.
static SdaiPermission HIDDEN
          Hidden permission as SdaiPermission object.
static int HIDDEN_INT
          No access permission as integer value.
static SdaiPermission NOACCESS
          No access permission as SdaiPermission object.
static int NOACCESS_INT
          No access permission as integer value.
static SdaiPermission READ
          Read only permission as SdaiPermission object.
static int READ_INT
          Read only permission as integer value.
static SdaiPermission WRITE
          Read and write permission as SdaiPermission object.
static int WRITE_INT
          Read and write permission as integer value.
 
Method Summary
 int compareTo(java.lang.Object other)
          Compares this SdaiPermission object to another object.
 boolean equals(java.lang.Object other)
          Compares this object against the specified object.
static SdaiPermission getPermissionByType(int type)
          Returns a SdaiPermission corresponding to specified integer value.
 int getType()
          Returns type of the permission.
 int hashCode()
          Returns a hash code for this SdaiPermission object.
 java.lang.String toString()
          Returns a string representation of this SdaiPermission object.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ADMIN_INT

public static final int ADMIN_INT
Administrative permission as integer value. ADMIN_INT is greater than WRITE_INT

See Also:
Constant Field Values

ADMIN

public static final SdaiPermission ADMIN
Administrative permission as SdaiPermission object.


WRITE_INT

public static final int WRITE_INT
Read and write permission as integer value. WRITE_INT is less than ADMIN_INT and greater than READ_INT

See Also:
Constant Field Values

WRITE

public static final SdaiPermission WRITE
Read and write permission as SdaiPermission object.


READ_INT

public static final int READ_INT
Read only permission as integer value. READ_INT is less than WRITE_INT and greater than NOACCESS_INT

See Also:
Constant Field Values

READ

public static final SdaiPermission READ
Read only permission as SdaiPermission object.


NOACCESS_INT

public static final int NOACCESS_INT
No access permission as integer value. NOACCESS_INT is less than READ_INT and greater than HIDDEN_INT

See Also:
Constant Field Values

NOACCESS

public static final SdaiPermission NOACCESS
No access permission as SdaiPermission object.


HIDDEN_INT

public static final int HIDDEN_INT
No access permission as integer value. HIDDEN_INT is less than NOACCESS_INT and greater than HIDDEN_INT

See Also:
Constant Field Values

HIDDEN

public static final SdaiPermission HIDDEN
Hidden permission as SdaiPermission object.


DEFAULT_INT

public static final int DEFAULT_INT
Default permission as integer value. See DEFAULT for more information on default permission.

See Also:
Constant Field Values

DEFAULT

public static final SdaiPermission DEFAULT
Default permission as SdaiPermission object. Default permission can be used as assigned permission to reflect the fact that effective permission is inherited from higher level assigned permission. Default permission can be returned by checkPermission methods when the effective permission can not be known more specifically at the moment, eg. if remote SdaiModel was just created and not yet committed to JSDAI-DB.

Method Detail

getType

public final int getType()
Returns type of the permission.

Returns:
type of the permission as integer value
See Also:
ADMIN_INT, WRITE_INT, READ_INT, NOACCESS_INT, HIDDEN_INT, DEFAULT_INT

compareTo

public int compareTo(java.lang.Object other)
Compares this SdaiPermission object to another object. If the object is a SdaiPermission, permission type values are compared numerically as returned by method getType. Otherwise it throws a ClassCastException.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
other - the object to be compared
Returns:
the value 0 if other permission is of the same type; a value less than 0 is this permission's type is numerically less than other permission's type; and a value greater than 0 if this permission's type is numerically greater than other permission's type.
Throws:
java.lang.ClassCastException - if the argument is not a SdaiPermission

toString

public java.lang.String toString()
Returns a string representation of this SdaiPermission object.

Returns:
a string representation of this object.

hashCode

public int hashCode()
Returns a hash code for this SdaiPermission object. The result is this permission's type XORed with prime number 21101..

Returns:
a hash value for this object.

equals

public boolean equals(java.lang.Object other)
Compares this object against the specified object. The result is true if and only if the argument is a SdaiPermission and is of type equal to this permission's type.

Parameters:
other - the object to be compared
Returns:
true if objects are equal; false otherwise.

getPermissionByType

public static SdaiPermission getPermissionByType(int type)
Returns a SdaiPermission corresponding to specified integer value. The following is true for any returned object except DEFAULT: getPermissionByType(type).getType() == type. If no SdaiPermission matches the specified integer value, DEFAULT is returned.

Parameters:
type - the type of SdaiPermission
Returns:
the corresponding SdaiPermission.

Copyright © LKSoftWare GmbH, 1999-2008