org.benow.repository.security
Class PermissionImpl

java.lang.Object
  extended by org.benow.security.SecureObject
      extended by org.benow.repository.util.PersistentObjectImpl
          extended by org.benow.repository.mapping.JSQLObject
              extended by org.benow.repository.mapping.JSQLNamed
                  extended by org.benow.repository.security.PermissionImpl
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable, PersistentObject, org.benow.security.permission.Permission, org.benow.util.Named

public class PermissionImpl
extends JSQLNamed
implements org.benow.security.permission.Permission

Used by castor to map users to roles.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.benow.repository.mapping.JSQLObject
JSQLObject.XSQLVersionDesc, JSQLObject.XSQLVersioned
 
Nested classes/interfaces inherited from interface org.benow.security.permission.Permission
org.benow.security.permission.Permission.AnonymousAccess, org.benow.security.permission.Permission.AnyUserAccess, org.benow.security.permission.Permission.RequiresPermission, org.benow.security.permission.Permission.RestrictOnField
 
Field Summary
protected  java.lang.String params
           
 
Fields inherited from class org.benow.repository.mapping.JSQLNamed
description, FIELD_NAME_NAME, name
 
Fields inherited from class org.benow.repository.util.PersistentObjectImpl
conn, recycled
 
Fields inherited from class org.benow.security.SecureObject
admin
 
Fields inherited from interface org.benow.repository.util.PersistentObject
FIELD_NAME_KEY
 
Constructor Summary
PermissionImpl()
          for castor
PermissionImpl(java.lang.Class forClass, java.lang.String suffix)
           
PermissionImpl(java.lang.Class forClass, java.lang.String suffix, java.lang.String description)
           
PermissionImpl(java.lang.Class forClass, java.lang.String suffix, java.lang.String[] params)
           
PermissionImpl(java.lang.String name)
           
PermissionImpl(java.lang.String name, java.lang.String description)
           
PermissionImpl(java.lang.String name, java.lang.String description, java.lang.String params)
           
 
Method Summary
 void absorb(org.benow.security.permission.Permission perm)
          Copies the contents of the given role into this role.
 void assertPermission()
           
 boolean equals(java.lang.Object obj)
          PermissionImpls are equal,
 boolean equals(org.benow.security.permission.Permission perm)
           
static QueryContext getByClassQuery(java.lang.Class<?> forClass)
           
 java.lang.Class getDeclarator()
           
 java.lang.Class<?> getDeclaringClass()
           
protected  java.lang.String getDeclaringClassName()
           
 java.lang.String getParams()
           
static QueryContext getPermissionsQuery()
           
 java.util.Collection getRoles()
           
static QueryContext getStartingWithQuery(java.lang.String prefix)
           
 boolean hasPermission()
           
 void refresh(Transaction tx)
          Updates the object in the repository with the same name as this object to reflect the settings of this object.
protected  void setDeclaringClassByName(java.lang.String declaringClassName)
           
 void setName(java.lang.String name)
           
 void setParams(java.lang.String params)
           
 java.lang.String toString()
           
 void update(Transaction tx)
          Overridden update method.
 
Methods inherited from class org.benow.repository.mapping.JSQLNamed
absorb, getDescription, getName, setDescription
 
Methods inherited from class org.benow.repository.mapping.JSQLObject
fetchExpectedField, fetchField, fetchFieldQuiet, forgetField, isFetched, isLocked, lock, refetchFieldQuiet, setFetched
 
Methods inherited from class org.benow.repository.util.PersistentObjectImpl
compareTo, doIsTransient, getKey, isTransient, recycle, remove, remove, repositoryAfterLoad, repositoryAfterPersist, repositoryAfterTransient, repositoryBeforePersist, repositoryBeforeTransient, setKey, update
 
Methods inherited from class org.benow.security.SecureObject
assertOnePermission, assertPermission, assertPermission, declarePermission, declareViewPermission, declareViewPermission
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.benow.security.permission.Permission
getDescription, getName
 

Field Detail

params

protected java.lang.String params
Constructor Detail

PermissionImpl

public PermissionImpl()
for castor


PermissionImpl

public PermissionImpl(java.lang.String name)
Parameters:
name -

PermissionImpl

public PermissionImpl(java.lang.String name,
                      java.lang.String description)
Parameters:
name -
description -

PermissionImpl

public PermissionImpl(java.lang.String name,
                      java.lang.String description,
                      java.lang.String params)
Parameters:
name -
description -
params -

PermissionImpl

public PermissionImpl(java.lang.Class forClass,
                      java.lang.String suffix,
                      java.lang.String description)

PermissionImpl

public PermissionImpl(java.lang.Class forClass,
                      java.lang.String suffix)

PermissionImpl

public PermissionImpl(java.lang.Class forClass,
                      java.lang.String suffix,
                      java.lang.String[] params)
Method Detail

getRoles

public java.util.Collection getRoles()
Specified by:
getRoles in interface org.benow.security.permission.Permission

getParams

public java.lang.String getParams()
Specified by:
getParams in interface org.benow.security.permission.Permission

setParams

public void setParams(java.lang.String params)
Specified by:
setParams in interface org.benow.security.permission.Permission

equals

public boolean equals(org.benow.security.permission.Permission perm)

refresh

public void refresh(Transaction tx)
             throws ObjectRepositoryException
Updates the object in the repository with the same name as this object to reflect the settings of this object.

Parameters:
tx -
Throws:
ObjectRepositoryException

absorb

public void absorb(org.benow.security.permission.Permission perm)
Copies the contents of the given role into this role.

Parameters:
perm -

update

public void update(Transaction tx)
            throws ObjectRepositoryException
Overridden update method. Ensures only one name uniqueness.

Specified by:
update in interface PersistentObject
Overrides:
update in class PersistentObjectImpl
Parameters:
tx -
Throws:
ObjectRepositoryException

equals

public boolean equals(java.lang.Object obj)
PermissionImpls are equal,

Overrides:
equals in class PersistentObjectImpl
Parameters:
obj -
Returns:
true if equal

getDeclarator

public java.lang.Class getDeclarator()
Specified by:
getDeclarator in interface org.benow.security.permission.Permission

toString

public java.lang.String toString()
Overrides:
toString in class JSQLNamed

setName

public void setName(java.lang.String name)
             throws java.lang.ClassNotFoundException
Throws:
java.lang.ClassNotFoundException

getDeclaringClass

public java.lang.Class<?> getDeclaringClass()

getDeclaringClassName

protected java.lang.String getDeclaringClassName()
Returns:
Returns the declaringClass.

setDeclaringClassByName

protected void setDeclaringClassByName(java.lang.String declaringClassName)
Parameters:
declaringClassName - The declaringClass to set.

assertPermission

public void assertPermission()
                      throws java.lang.SecurityException
Specified by:
assertPermission in interface org.benow.security.permission.Permission
Throws:
java.lang.SecurityException

hasPermission

public boolean hasPermission()
                      throws java.lang.SecurityException
Specified by:
hasPermission in interface org.benow.security.permission.Permission
Throws:
java.lang.SecurityException

getByClassQuery

public static QueryContext getByClassQuery(java.lang.Class<?> forClass)
                                    throws ObjectRepositoryException
Throws:
ObjectRepositoryException

getStartingWithQuery

public static QueryContext getStartingWithQuery(java.lang.String prefix)
                                         throws ObjectRepositoryException
Throws:
ObjectRepositoryException

getPermissionsQuery

public static QueryContext getPermissionsQuery()