Class JpaRole
- java.lang.Object
-
- org.apache.archiva.redback.rbac.AbstractRole
-
- org.apache.archiva.redback.rbac.jpa.model.JpaRole
-
- All Implemented Interfaces:
Serializable
,Role
@Entity public class JpaRole extends AbstractRole implements Serializable
Created by martin on 25.09.16.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description JpaRole()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addChildRoleId(String id)
Adds a child role idvoid
addChildRoleName(String name)
Adds a role to the list of child rolesvoid
addPermission(Permission permission)
Adds a permission to the listboolean
equals(Object o)
Method equals.List<String>
getChildRoleIds()
Returns the child role idsList<String>
getChildRoleNames()
Returns the list of child rolesString
getDescription()
Long description of the role.String
getId()
The role identifier.String
getModelId()
Returns the model the role is derived from.String
getName()
Get the name.List<? extends Permission>
getPermissions()
Returns the list of permissions assigned to this role.String
getResource()
Returns the resource that is used to build this role from a template.int
hashCode()
boolean
isAssignable()
True
, if this role is available to be assigned to a user, otherwisefalse
.boolean
isPermanent()
Test to see if the object is a permanent object or not.boolean
isTemplateInstance()
Returnstrue
, if this role is a instance of a template role, otherwisefalse
.void
removePermission(Permission permission)
Removes the given permission from the list.void
setAssignable(boolean assignable)
Set totrue
, if this role should available to be assigned to a uservoid
setChildRoleIds(List<String> childRoleIds)
Sets the list of child role idsvoid
setChildRoleNames(List<String> names)
Sets the names of children roles.void
setDescription(String description)
Set the Descriptionvoid
setId(String id)
Sets the role idvoid
setModelId(String modelId)
Sets the model id.void
setName(String name)
Set the role name NOTE: This field is considered the Primary Key for this object.void
setPermanent(boolean permanent)
Set flag indicating if the object is a permanent object or not.void
setPermissions(List<Permission> permissions)
Set role permissions.void
setResource(String resource)
Sets the resource, this template instance is attached to.void
setTemplateInstance(boolean templateInstanceFlag)
Sets the template instance flag.-
Methods inherited from class org.apache.archiva.redback.rbac.AbstractRole
addChildRole, hasChildRoles
-
-
-
-
Constructor Detail
-
JpaRole
public JpaRole()
-
-
Method Detail
-
addPermission
public void addPermission(Permission permission)
Description copied from interface:Role
Adds a permission to the list- Specified by:
addPermission
in interfaceRole
- Parameters:
permission
- the permission to add to the list
-
addChildRoleName
public void addChildRoleName(String name)
Description copied from interface:Role
Adds a role to the list of child roles- Specified by:
addChildRoleName
in interfaceRole
- Parameters:
name
- the name of the child role.
-
addChildRoleId
public void addChildRoleId(String id)
Description copied from interface:Role
Adds a child role id- Specified by:
addChildRoleId
in interfaceRole
- Parameters:
id
- the id
-
getChildRoleNames
public List<String> getChildRoleNames()
Description copied from interface:Role
Returns the list of child roles- Specified by:
getChildRoleNames
in interfaceRole
-
getChildRoleIds
public List<String> getChildRoleIds()
Description copied from interface:Role
Returns the child role ids- Specified by:
getChildRoleIds
in interfaceRole
- Returns:
- the list of child role ids
-
getDescription
public String getDescription()
Description copied from interface:Role
Long description of the role.- Specified by:
getDescription
in interfaceRole
- Returns:
- the role description
-
getName
public String getName()
Description copied from interface:Role
Get the name. Must be unique. NOTE: This field is considered the Primary Key for this object.
-
getPermissions
public List<? extends Permission> getPermissions()
Description copied from interface:Role
Returns the list of permissions assigned to this role.- Specified by:
getPermissions
in interfaceRole
- Returns:
- the list of permissions assigned to this role
-
isAssignable
public boolean isAssignable()
Description copied from interface:Role
True
, if this role is available to be assigned to a user, otherwisefalse
.- Specified by:
isAssignable
in interfaceRole
- Returns:
true
, if this role can be assigned to users, otherwisefalse
-
removePermission
public void removePermission(Permission permission)
Description copied from interface:Role
Removes the given permission from the list. If the permission does not exist in the list of assigned permissions, nothing happens.- Specified by:
removePermission
in interfaceRole
- Parameters:
permission
- the permission to remove.
-
setAssignable
public void setAssignable(boolean assignable)
Description copied from interface:Role
Set totrue
, if this role should available to be assigned to a user- Specified by:
setAssignable
in interfaceRole
- Parameters:
assignable
- the assignable flag
-
setChildRoleNames
public void setChildRoleNames(List<String> names)
Description copied from interface:Role
Sets the names of children roles. Children roles inherit the permissions of the parent role.- Specified by:
setChildRoleNames
in interfaceRole
- Parameters:
names
- the list of names of child roles.
-
setChildRoleIds
public void setChildRoleIds(List<String> childRoleIds)
Description copied from interface:Role
Sets the list of child role ids- Specified by:
setChildRoleIds
in interfaceRole
-
setDescription
public void setDescription(String description)
Description copied from interface:Role
Set the Description- Specified by:
setDescription
in interfaceRole
- Parameters:
description
- the role description
-
setName
public void setName(String name)
Description copied from interface:Role
Set 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:Role
Set role permissions. The list of assigned permissions is replaced by this list.- Specified by:
setPermissions
in interfaceRole
- Parameters:
permissions
- the permissions to set
-
isPermanent
public boolean isPermanent()
Description copied from interface:Role
Test to see if the object is a permanent object or not.- Specified by:
isPermanent
in interfaceRole
- Returns:
true
, if the object is permanent.
-
setPermanent
public void setPermanent(boolean permanent)
Description copied from interface:Role
Set flag indicating if the object is a permanent object or not.- Specified by:
setPermanent
in interfaceRole
- Parameters:
permanent
- true if the object is permanent.
-
getId
public String getId()
Description copied from interface:Role
The role identifier. Should be built from the modelId and the resource. And must be unique.
-
setModelId
public void setModelId(String modelId)
Description copied from interface:Role
Sets the model id.- Specified by:
setModelId
in interfaceRole
- Parameters:
modelId
- the identifier of the model, or empty string. Should not be null.
-
getModelId
public String getModelId()
Description copied from interface:Role
Returns the model the role is derived from.- Specified by:
getModelId
in interfaceRole
- Returns:
- The model id or empty string, if this role was not created from a model
-
setTemplateInstance
public void setTemplateInstance(boolean templateInstanceFlag)
Description copied from interface:Role
Sets the template instance flag.- Specified by:
setTemplateInstance
in interfaceRole
- Parameters:
templateInstanceFlag
- Set totrue
, if this is a template instance, otherwisefalse
-
isTemplateInstance
public boolean isTemplateInstance()
Description copied from interface:Role
Returnstrue
, 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:
isTemplateInstance
in interfaceRole
- Returns:
true
, if this role is a templated role, otherwisefalse
-
setResource
public void setResource(String resource)
Description copied from interface:Role
Sets the resource, this template instance is attached to.- Specified by:
setResource
in interfaceRole
- Parameters:
resource
- the resource identifier. Must not be null.
-
getResource
public String getResource()
Description copied from interface:Role
Returns 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:
getResource
in interfaceRole
- Returns:
- the resource identifier, used to build this role or a empty string, if this role is not templated
-
equals
public boolean equals(Object o)
Description copied from class:AbstractRole
Method equals.- Overrides:
equals
in classAbstractRole
- Returns:
- boolean
-
-