Class MemoryRole
- java.lang.Object
-
- org.apache.archiva.redback.rbac.AbstractRole
-
- org.apache.archiva.redback.rbac.memory.MemoryRole
-
- All Implemented Interfaces:
Serializable,Role
public class MemoryRole extends AbstractRole implements Role, Serializable
MemoryRole- Author:
- Joakim Erdfelt, Martin Stockhammer
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description MemoryRole()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddChildRoleId(String id)Adds a child role idvoidaddChildRoleName(String name)Adds a role to the list of child rolesvoidaddPermission(Permission memoryPermission)Adds a permission to the listbooleanequals(Object o)Method equals.List<String>getChildRoleIds()Returns the child role idsList<String>getChildRoleNames()Returns the list of child rolesStringgetDescription()Long description of the role.StringgetId()The role identifier.StringgetModelId()Returns the model the role is derived from.StringgetName()Get the name.List<Permission>getPermissions()Returns the list of permissions assigned to this role.StringgetResource()Returns the resource that is used to build this role from a template.inthashCode()booleanisAssignable()True, if this role is available to be assigned to a user, otherwisefalse.booleanisPermanent()Test to see if the object is a permanent object or not.booleanisTemplateInstance()Returnstrue, if this role is a instance of a template role, otherwisefalse.voidremovePermission(Permission memoryPermission)Removes the given permission from the list.voidsetAssignable(boolean assignable)Set totrue, if this role should available to be assigned to a uservoidsetChildRoleIds(List<String> ids)Sets the list of child role idsvoidsetChildRoleNames(List<String> names)Sets the names of children roles.voidsetDescription(String description)Set the DescriptionvoidsetId(String id)Sets the role idvoidsetModelId(String modelId)Sets the model id.voidsetName(String name)Set the role name NOTE: This field is considered the Primary Key for this object.voidsetPermanent(boolean permanent)Set flag indicating if the object is a permanent object or not.voidsetPermissions(List<Permission> permissions)Set role permissions.voidsetResource(String resource)Sets the resource, this template instance is attached to.voidsetTemplateInstance(boolean templateInstance)Sets the template instance flag.StringtoString()-
Methods inherited from class org.apache.archiva.redback.rbac.AbstractRole
addChildRole, hasChildRoles
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.archiva.redback.rbac.Role
addChildRole, hasChildRoles
-
-
-
-
Constructor Detail
-
MemoryRole
public MemoryRole()
-
-
Method Detail
-
addPermission
public void addPermission(Permission memoryPermission)
Description copied from interface:RoleAdds a permission to the list- Specified by:
addPermissionin interfaceRole- Parameters:
memoryPermission- the permission to add to the list
-
equals
public boolean equals(Object o)
Description copied from class:AbstractRoleMethod equals.- Overrides:
equalsin classAbstractRole- Returns:
- boolean
-
getChildRoleNames
public List<String> getChildRoleNames()
Description copied from interface:RoleReturns the list of child roles- Specified by:
getChildRoleNamesin interfaceRole
-
addChildRoleId
public void addChildRoleId(String id)
Description copied from interface:RoleAdds a child role id- Specified by:
addChildRoleIdin interfaceRole- Parameters:
id- the id
-
getChildRoleIds
public List<String> getChildRoleIds()
Description copied from interface:RoleReturns the child role ids- Specified by:
getChildRoleIdsin interfaceRole- Returns:
- the list of child role ids
-
getDescription
public String getDescription()
Description copied from interface:RoleLong description of the role.- Specified by:
getDescriptionin interfaceRole- Returns:
- the role description
-
getName
public String getName()
Description copied from interface:RoleGet the name. Must be unique. NOTE: This field is considered the Primary Key for this object.
-
getPermissions
public List<Permission> getPermissions()
Description copied from interface:RoleReturns the list of permissions assigned to this role.- Specified by:
getPermissionsin interfaceRole- Returns:
- the list of permissions assigned to this role
-
isAssignable
public boolean isAssignable()
Description copied from interface:RoleTrue, if this role is available to be assigned to a user, otherwisefalse.- Specified by:
isAssignablein interfaceRole- Returns:
true, if this role can be assigned to users, otherwisefalse
-
removePermission
public void removePermission(Permission memoryPermission)
Description copied from interface:RoleRemoves the given permission from the list. If the permission does not exist in the list of assigned permissions, nothing happens.- Specified by:
removePermissionin interfaceRole- Parameters:
memoryPermission- the permission to remove.
-
setAssignable
public void setAssignable(boolean assignable)
Description copied from interface:RoleSet totrue, if this role should available to be assigned to a user- Specified by:
setAssignablein interfaceRole- Parameters:
assignable- the assignable flag
-
setDescription
public void setDescription(String description)
Description copied from interface:RoleSet the Description- Specified by:
setDescriptionin interfaceRole- Parameters:
description- the role description
-
setName
public void setName(String name)
Description copied from interface:RoleSet the role name NOTE: This field is considered the Primary Key for this object.
-
setPermissions
public void setPermissions(List<Permission> permissions)
Description copied from interface:RoleSet role permissions. The list of assigned permissions is replaced by this list.- Specified by:
setPermissionsin interfaceRole- Parameters:
permissions- the permissions to set
-
addChildRoleName
public void addChildRoleName(String name)
Description copied from interface:RoleAdds a role to the list of child roles- Specified by:
addChildRoleNamein interfaceRole- Parameters:
name- the name of the child role.
-
setChildRoleNames
public void setChildRoleNames(List<String> names)
Description copied from interface:RoleSets the names of children roles. Children roles inherit the permissions of the parent role.- Specified by:
setChildRoleNamesin interfaceRole- Parameters:
names- the list of names of child roles.
-
setChildRoleIds
public void setChildRoleIds(List<String> ids)
Description copied from interface:RoleSets the list of child role ids- Specified by:
setChildRoleIdsin interfaceRole
-
isPermanent
public boolean isPermanent()
Description copied from interface:RoleTest to see if the object is a permanent object or not.- Specified by:
isPermanentin interfaceRole- Returns:
true, if the object is permanent.
-
setPermanent
public void setPermanent(boolean permanent)
Description copied from interface:RoleSet flag indicating if the object is a permanent object or not.- Specified by:
setPermanentin interfaceRole- Parameters:
permanent- true if the object is permanent.
-
getId
public String getId()
Description copied from interface:RoleThe role identifier. Should be built from the modelId and the resource. And must be unique.
-
getModelId
public String getModelId()
Description copied from interface:RoleReturns the model the role is derived from.- Specified by:
getModelIdin interfaceRole- Returns:
- The model id or empty string, if this role was not created from a model
-
setModelId
public void setModelId(String modelId)
Description copied from interface:RoleSets the model id.- Specified by:
setModelIdin interfaceRole- Parameters:
modelId- the identifier of the model, or empty string. Should not be null.
-
getResource
public String getResource()
Description copied from interface:RoleReturns the resource that is used to build this role from a template. If this is not a templated role, a empty string should be returned.- Specified by:
getResourcein interfaceRole- Returns:
- the resource identifier, used to build this role or a empty string, if this role is not templated
-
setResource
public void setResource(String resource)
Description copied from interface:RoleSets the resource, this template instance is attached to.- Specified by:
setResourcein interfaceRole- Parameters:
resource- the resource identifier. Must not be null.
-
isTemplateInstance
public boolean isTemplateInstance()
Description copied from interface:RoleReturnstrue, if this role is a instance of a template role, otherwisefalse. Templated roles are built from a template together with a resource identifier.- Specified by:
isTemplateInstancein interfaceRole- Returns:
true, if this role is a templated role, otherwisefalse
-
setTemplateInstance
public void setTemplateInstance(boolean templateInstance)
Description copied from interface:RoleSets the template instance flag.- Specified by:
setTemplateInstancein interfaceRole- Parameters:
templateInstance- Set totrue, if this is a template instance, otherwisefalse
-
-