@PermitAll public class ResourceServiceImpl extends BaseServiceImpl<Resource> implements ResourceService
ResourceService. Consumers should get an instance of
this via CDI. This class should not be directly instantiated by the consumers.| Constructor and Description |
|---|
ResourceServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
PersonaResourceRole |
addRoleToPersona(Resource resource,
Persona persona,
Role role)
Adds a Role to a Persona into a Resource
|
Resource |
create(String id,
Persona persona)
|
Resource |
create(String id,
Resource parent)
Creates a new sub resource, based on a given ID and owning resource
|
Resource |
create(String id,
Resource parent,
Persona persona)
Creates a new sub resource, based on a given ID, parent and owned by the specified
Persona |
void |
delete(String id)
Removes a
Resource based on its ID. |
Resource |
get(String id)
Retrieves a
Resource based on its ID. |
Resource |
getById(UUID id)
Retrieves a
Resource based on its ID. |
List<Resource> |
getByPersona(Persona persona)
Lists all the resources that belong to a given persona.
|
List<PersonaResourceRole> |
getRolesForPersona(Resource resource,
Persona persona)
Retrieves the roles that a given persona has on the given resource.
|
void |
revokeAllForPersona(Resource resource,
Persona persona)
Revoke all roles that the given persona has on the resource.
|
void |
transfer(Resource resource,
Persona persona)
Transfers the resource to the given persona.
|
getByIdpublic Resource getById(UUID id)
ResourceServiceResource based on its ID.getById in interface ResourceServiceid - the resource's IDResource or null if the resource doesn't exists.public Resource get(String id)
ResourceServiceResource based on its ID. If the ID is not "UUID-like", then a new UUID is created based
on the bytes of the given ID. By "UUID-like", we mean a string that matches a regular expression for the
appearance of an UUID such as 'eb66fa08-7cbf-11e5-8cdd-3c970e9648d7'.get in interface ResourceServiceid - the resource's IDResource or null if the resource doesn't exists.UUID.nameUUIDFromBytes(byte[])public Resource create(String id, Persona persona)
ResourceServicecreate in interface ResourceServiceid - the ID to be assigned to this resource or null for a new UUIDpersona - a valid owner for this resourceResourcepublic Resource create(String id, Resource parent)
ResourceServicecreate in interface ResourceServiceid - the ID to be assigned to this resource or null for a new UUIDparent - a valid resource to serve as the parent of this sub resourceResourcepublic Resource create(String id, Resource parent, Persona persona)
ResourceServicePersonacreate in interface ResourceServiceid - the ID to be assigned to this resource or null for a new UUIDparent - the resource's parent or null if the owner is providedpersona - the resource's owner or null if the parent is providedResourcepublic void delete(String id)
ResourceServiceResource based on its ID.delete in interface ResourceServiceid - the resource's IDpublic List<Resource> getByPersona(Persona persona)
ResourceServicegetByPersona in interface ResourceServicepersona - the persona that owns the resourcespublic void transfer(Resource resource, Persona persona)
ResourceServiceResourceService.revokeAllForPersona(Resource, Persona) if it's
appropriate. This method also revokes all the current permissions of the new owner, replacing all of them by a
single "SuperUser" role on the resource.transfer in interface ResourceServiceresource - the resource to receive the new ownerpersona - the persona that will be the new ownerpublic void revokeAllForPersona(Resource resource, Persona persona)
ResourceServicerevokeAllForPersona in interface ResourceServiceresource - the resource that the person currently has rolespersona - the persona to get the access revokedpublic PersonaResourceRole addRoleToPersona(Resource resource, Persona persona, Role role)
ResourceServiceaddRoleToPersona in interface ResourceServiceresource - the resourcepersona - the persona to get access to the resourcerole - the role of the persona on the resourcepublic List<PersonaResourceRole> getRolesForPersona(Resource resource, Persona persona)
ResourceServicegetRolesForPersona in interface ResourceServiceresource - the resource to checkpersona - the persona to checkPersonaResourceRole, with one entry per combination.Copyright © 2015 Red Hat, Inc.. All rights reserved.