Package com.jgcomptech.tools.authz
Class Permission
- java.lang.Object
-
- com.jgcomptech.tools.events.EventTarget<PermissionEvent>
-
- com.jgcomptech.tools.authz.Permission
-
- All Implemented Interfaces:
java.io.Serializable
public final class Permission extends EventTarget<PermissionEvent> implements java.io.Serializable
An object representing a permission.- Since:
- 1.4.0, 1.5.0 Changed implementation
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddAndEnableNewChildPermission(java.lang.String name)Adds new permission with the specified name, enabled by default.booleanaddNewChildPermission(java.lang.String name)Adds new permission with the specified name, disabled by default.booleancopyToNewParent(java.lang.String newParentName)Attempts to inclusively copy a permission to another parent.voiddisable()Disables the permission and all child permissions.voiddisableDebugLogging()Disables basic event handlers with System.Out logging for all events.voidenable()Enables the permission and all child permissions.voidenableDebugLogging()Enables basic event handlers with System.Out logging for all events.javafx.beans.property.BooleanPropertyenabledProperty()booleanequals(java.lang.Object o)java.util.Set<java.lang.String>getChildPermissions()Returns a list of child permissions.java.lang.StringgetName()Returns the name of the permission.EventHandler<PermissionEvent>getOnDisabled()Returns the event handler that will fire when the permission is disabled.EventHandler<PermissionEvent>getOnEnabled()Returns the event handler that will fire when the permission is disabled.booleanhasChildPermission(java.lang.String name)Checks if the permission has the specified child permission.booleanhasChildPermissions(java.util.HashSet<java.lang.String> names)Checks if the permission has the specified child permissions.inthashCode()booleanisDisabled()Returns true if the permission is disabled.booleanisEnabled()Returns true if the permission is enabled.javafx.beans.property.StringPropertynameProperty()javafx.beans.property.ObjectProperty<PermissionEvent>onDisabledProperty()javafx.beans.property.ObjectProperty<PermissionEvent>onEnabledProperty()booleanremoveChildPermission(java.lang.String name)Removes the specified permission as a child.voidsetEnabled(boolean enabled)Sets the permission status.voidsetOnDisabled(EventHandler<PermissionEvent> e)Sets the event handler that will fire when the permission is disabled.voidsetOnEnabled(EventHandler<PermissionEvent> e)Sets the event handler that will fire when the permission is enabled.java.lang.StringtoString()-
Methods inherited from class com.jgcomptech.tools.events.EventTarget
addEventHandler, fire, getEventHandler, removeEventHandler
-
-
-
-
Method Detail
-
getName
public java.lang.String getName()
Returns the name of the permission.- Returns:
- the name of the permission
-
nameProperty
public javafx.beans.property.StringProperty nameProperty()
-
enabledProperty
public javafx.beans.property.BooleanProperty enabledProperty()
-
setOnEnabled
public void setOnEnabled(EventHandler<PermissionEvent> e)
Sets the event handler that will fire when the permission is enabled.- Parameters:
e- the event handler
-
setOnDisabled
public void setOnDisabled(EventHandler<PermissionEvent> e)
Sets the event handler that will fire when the permission is disabled.- Parameters:
e- the event handler
-
getOnEnabled
public EventHandler<PermissionEvent> getOnEnabled()
Returns the event handler that will fire when the permission is disabled.- Returns:
- the event handler that will fire when the permission is disabled
-
onEnabledProperty
public javafx.beans.property.ObjectProperty<PermissionEvent> onEnabledProperty()
-
getOnDisabled
public EventHandler<PermissionEvent> getOnDisabled()
Returns the event handler that will fire when the permission is disabled.- Returns:
- the event handler that will fire when the permission is disabled
-
onDisabledProperty
public javafx.beans.property.ObjectProperty<PermissionEvent> onDisabledProperty()
-
enable
public void enable()
Enables the permission and all child permissions.
-
disable
public void disable()
Disables the permission and all child permissions.
-
setEnabled
public void setEnabled(boolean enabled)
Sets the permission status.- Parameters:
enabled- the boolean to set
-
isEnabled
public boolean isEnabled()
Returns true if the permission is enabled.- Returns:
- true if the permission is enabled
-
isDisabled
public boolean isDisabled()
Returns true if the permission is disabled.- Returns:
- true if the permission is disabled
-
getChildPermissions
public java.util.Set<java.lang.String> getChildPermissions()
Returns a list of child permissions.- Returns:
- a list of child permissions
-
hasChildPermission
public boolean hasChildPermission(java.lang.String name)
Checks if the permission has the specified child permission.- Parameters:
name- the name of the permission to check- Returns:
- true if the permission has the specified child permission
- Since:
- 1.5.0
-
hasChildPermissions
public boolean hasChildPermissions(java.util.HashSet<java.lang.String> names)
Checks if the permission has the specified child permissions.- Parameters:
names- the names of the permissions to check- Returns:
- true if the permission has the specified child permissions
- Since:
- 1.5.0
-
addNewChildPermission
public boolean addNewChildPermission(java.lang.String name)
Adds new permission with the specified name, disabled by default.- Parameters:
name- the name of the new permission- Returns:
- false if permission already exists
-
addAndEnableNewChildPermission
public boolean addAndEnableNewChildPermission(java.lang.String name)
Adds new permission with the specified name, enabled by default.- Parameters:
name- the name of the new permission- Returns:
- false if permission already exists
-
removeChildPermission
public boolean removeChildPermission(java.lang.String name)
Removes the specified permission as a child.- Parameters:
name- the name of the permission to remove- Returns:
- false if the permission is not a child
-
copyToNewParent
public boolean copyToNewParent(java.lang.String newParentName)
Attempts to inclusively copy a permission to another parent. This method copies all child permissions and all event handlers.- Parameters:
newParentName- the name of the new parent to copy to- Returns:
- true if copy succeeds
- Since:
- 1.5.0
-
enableDebugLogging
public void enableDebugLogging()
Enables basic event handlers with System.Out logging for all events.- Since:
- 1.5.0
-
disableDebugLogging
public void disableDebugLogging()
Disables basic event handlers with System.Out logging for all events.- Since:
- 1.5.0
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classEventTarget<PermissionEvent>
-
hashCode
public int hashCode()
- Overrides:
hashCodein classEventTarget<PermissionEvent>
-
toString
public java.lang.String toString()
- Overrides:
toStringin classEventTarget<PermissionEvent>
-
-