ca.sqlpower.wabit.enterprise.client
Class Grant

java.lang.Object
  extended by ca.sqlpower.wabit.AbstractWabitObject
      extended by ca.sqlpower.wabit.enterprise.client.Grant
All Implemented Interfaces:
WabitObject

public class Grant
extends AbstractWabitObject

A Grant object represents a set of permissions on a single object, or class of objects. Due to restrictions in the JCR, Grants should remain immutable. To change a User's permissions, remove the old Grant, and create a new one.


Constructor Summary
Grant(Grant grant)
          Copy constructor
Grant(java.lang.String subject, java.lang.String type, boolean create, boolean modify, boolean delete, boolean execute, boolean grant)
          Creates a grant object.
 
Method Summary
 boolean allowsChildren()
          Returns true if this object may contain children.
 int childPositionOffset(java.lang.Class<? extends WabitObject> childType)
          Returns the position in the list that would be returned by getChildren() that the first object of type childClass is, or where it would be if there were any children of that type.
 java.util.List<? extends WabitObject> getChildren()
          Returns an unmodifiable list of the children in this WabitObject.
 java.util.List<WabitObject> getDependencies()
          Returns a list of all WabitObjects that this Wabit object is dependent on.
 java.lang.String getName()
          Returns the short name for this object.
 java.lang.String getSubject()
           
 java.lang.String getType()
           
 boolean hasPermissions()
           
 boolean isCreatePrivilege()
           
 boolean isDeletePrivilege()
           
 boolean isExecutePrivilege()
           
 boolean isGrantPrivilege()
           
 boolean isModifyPrivilege()
           
 boolean isReadOnly()
           
protected  boolean removeChildImpl(WabitObject child)
          This is the object specific implementation of removeChild.
 void removeDependency(WabitObject dependency)
          Removes the given object as a dependency of this object.
 void setName(java.lang.String name)
          Sets the name for this object
 
Methods inherited from class ca.sqlpower.wabit.AbstractWabitObject
addChild, addChildImpl, addWabitListener, begin, beginTransaction, cleanup, commit, commitTransaction, equals, fireChildAdded, fireChildRemoved, firePropertyChange, firePropertyChange, firePropertyChange, fireTransactionEnded, fireTransactionRollback, fireTransactionStarted, generateNewUUID, getChildren, getParent, getSession, getUUID, isForegroundThread, removeChild, removeWabitListener, rollback, rollbackTransaction, runInBackground, runInForeground, setParent, setUUID, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Grant

public Grant(@Nonnull
             Grant grant)
Copy constructor

Parameters:
grant - Grant to copy

Grant

public Grant(@Nullable
             java.lang.String subject,
             @Nonnull
             java.lang.String type,
             boolean create,
             boolean modify,
             boolean delete,
             boolean execute,
             boolean grant)
Creates a grant object.

Parameters:
subject - The object we want to grant access to. Can be null if the type parameter is used.
type - The class of wabit object to grant access to. Can be null if the subject parameter is used.
create -
modify -
delete -
execute -
grant -
Method Detail

setName

public void setName(java.lang.String name)
Description copied from interface: WabitObject
Sets the name for this object

Specified by:
setName in interface WabitObject
Overrides:
setName in class AbstractWabitObject

getName

public java.lang.String getName()
Description copied from interface: WabitObject
Returns the short name for this object.

Specified by:
getName in interface WabitObject
Overrides:
getName in class AbstractWabitObject

removeChildImpl

protected boolean removeChildImpl(WabitObject child)
Description copied from class: AbstractWabitObject
This is the object specific implementation of removeChild. There are checks in the removeChild method to ensure the child being removed has no dependencies and is a child of this object.

Specified by:
removeChildImpl in class AbstractWabitObject
See Also:
AbstractWabitObject.removeChild(WabitObject)

allowsChildren

public boolean allowsChildren()
Description copied from interface: WabitObject
Returns true if this object may contain children. Not all types of WabitObjects can be a child to any WabitObject.

See Also:
WabitObject.childPositionOffset(Class)

childPositionOffset

public int childPositionOffset(java.lang.Class<? extends WabitObject> childType)
Description copied from interface: WabitObject
Returns the position in the list that would be returned by getChildren() that the first object of type childClass is, or where it would be if there were any children of that type.


getChildren

public java.util.List<? extends WabitObject> getChildren()
Description copied from interface: WabitObject
Returns an unmodifiable list of the children in this WabitObject. If there are no children in this WabitObject an empty list should be returned.


getDependencies

public java.util.List<WabitObject> getDependencies()
Description copied from interface: WabitObject
Returns a list of all WabitObjects that this Wabit object is dependent on. Children of a WabitObject are not dependencies and will not be returned in this list. If there are no objects this Wabit object is dependent on an empty list should be returned. These are only the immediate dependencies of this object. If you want to find the dependencies of this object's dependencies as well it may be useful to look at WorkspaceGraphModel to make a full graph of all of the dependencies.


removeDependency

public void removeDependency(WabitObject dependency)
Description copied from interface: WabitObject
Removes the given object as a dependency of this object. For this object to no longer be dependent on the given dependency all of its children must also not be dependent on the given dependency when this method returns. This may remove this object from its parent if necessary.


isCreatePrivilege

public boolean isCreatePrivilege()

isModifyPrivilege

public boolean isModifyPrivilege()

isDeletePrivilege

public boolean isDeletePrivilege()

isExecutePrivilege

public boolean isExecutePrivilege()

isGrantPrivilege

public boolean isGrantPrivilege()

isReadOnly

public boolean isReadOnly()

hasPermissions

public boolean hasPermissions()

getType

public java.lang.String getType()

getSubject

public java.lang.String getSubject()


Copyright © 2009. All Rights Reserved.