public class JPAPersistenceStrategy extends Object implements ACLPersistenceStrategy
Implementation of ACLPersistenceStrategy
that uses the Java Persistence API (JPA) to
persist the ACL
s.
Constructor and Description |
---|
JPAPersistenceStrategy() |
JPAPersistenceStrategy(ACLResourceFactory resourceFactory) |
Modifier and Type | Method and Description |
---|---|
ACL |
createACL(Resource resource)
Creates a new
ACL and associates it to the given resource. |
ACL |
createACL(Resource resource,
Collection<ACLEntry> entries)
Creates a new
ACL with the specified entries and associates it to the given resource. |
ACL |
getACL(Resource resource)
Obtains a reference to the
ACL associated to the given resource. |
Collection<ACL> |
getACLs()
Obtains all
ACL s that are managed by this ACLPersistenceStrategy . |
boolean |
removeACL(ACL acl)
Removes the given
ACL , breaking the existing association with the resource it relates to. |
boolean |
removeACL(Resource resource)
Removes the
ACL associated with the specified resource. |
boolean |
updateACL(ACL acl)
Updates the given
ACL . |
public JPAPersistenceStrategy()
public JPAPersistenceStrategy(ACLResourceFactory resourceFactory)
public ACL createACL(Resource resource)
ACLPersistenceStrategy
Creates a new ACL
and associates it to the given resource.
createACL
in interface ACLPersistenceStrategy
resource
- the Resource
for which an ACL is to be created.ACL
.public ACL createACL(Resource resource, Collection<ACLEntry> entries)
ACLPersistenceStrategy
Creates a new ACL
with the specified entries and associates it to the given resource.
createACL
in interface ACLPersistenceStrategy
resource
- the Resource
for which an ACL is to be created.entries
- a Collection
containing the entries that must be added to the ACL
.ACL
.public boolean removeACL(ACL acl)
ACLPersistenceStrategy
Removes the given ACL
, breaking the existing association with the resource it relates to.
removeACL
in interface ACLPersistenceStrategy
acl
- a reference to the ACL
that is to be removed.true
if the ACL was removed; false
otherwise.public boolean removeACL(Resource resource)
ACLPersistenceStrategy
Removes the ACL
associated with the specified resource.
removeACL
in interface ACLPersistenceStrategy
resource
- the Resource
whose associated ACL is to be removed.true
if the ACL was removed; false
otherwise.public ACL getACL(Resource resource)
ACLPersistenceStrategy
Obtains a reference to the ACL
associated to the given resource.
getACL
in interface ACLPersistenceStrategy
resource
- the Resource
for which the associated ACL is wanted.ACL
associated with the resource, or null if no
ACL could be found.public Collection<ACL> getACLs()
ACLPersistenceStrategy
Obtains all ACL
s that are managed by this ACLPersistenceStrategy
.
getACLs
in interface ACLPersistenceStrategy
Collection
containing all ACL
s retrieved by this strategy.public boolean updateACL(ACL acl)
ACLPersistenceStrategy
Updates the given ACL
. This usually means updating the repository where the ACLs are stored.
updateACL
in interface ACLPersistenceStrategy
acl
- the ACL
that needs to be updated.true
if the ACL was updated; false
otherwise.Copyright © 2016 JBoss by Red Hat. All rights reserved.