public ACL createACL(Resource resource) { return this.createACL(resource, new ArrayList<ACLEntry>()); }
public ACL getACL(Resource resource) { // check the cache first. ACL acl = this.aclMap.get(resource); if (acl == null) { EntityManager entityManager = this.managerFactory.createEntityManager(); try { acl = this.findACLByResource(resource, entityManager); if (acl != null) this.aclMap.put(resource, acl); } finally { entityManager.close(); } } return acl; }
public boolean removeACL(ACL acl) { return this.removeACL(acl.getResource()); }
public ACL getACL(Resource resource) { // check the cache first. ACL acl = this.aclMap.get(resource); if (acl == null) { EntityManager entityManager = this.managerFactory.createEntityManager(); try { acl = this.findACLByResource(resource, entityManager); if (acl != null) this.aclMap.put(resource, acl); } finally { entityManager.close(); } } return acl; }
public boolean removeACL(ACL acl) { return this.removeACL(acl.getResource()); }
public boolean removeACL(Resource resource) { boolean result = false; EntityManager entityManager = this.managerFactory.createEntityManager(); EntityTransaction transaction = entityManager.getTransaction(); transaction.begin(); try { // find the ACL associated with the specified resource and remove it from the database. ACL acl = this.findACLByResource(resource, entityManager); if (acl != null) { entityManager.remove(acl); // remove the ACL from the cache. result = this.aclMap.remove(resource) != null; } transaction.commit(); } catch (RuntimeException re) { re.printStackTrace(); transaction.rollback(); } finally { entityManager.close(); } return result; }
public ACL createACL(Resource resource) { return this.createACL(resource, new ArrayList<ACLEntry>()); }
public boolean removeACL(Resource resource) { boolean result = false; EntityManager entityManager = this.managerFactory.createEntityManager(); EntityTransaction transaction = entityManager.getTransaction(); transaction.begin(); try { // find the ACL associated with the specified resource and remove it from the database. ACL acl = this.findACLByResource(resource, entityManager); if (acl != null) { entityManager.remove(acl); // remove the ACL from the cache. result = this.aclMap.remove(resource) != null; } transaction.commit(); } catch (RuntimeException re) { re.printStackTrace(); transaction.rollback(); } finally { entityManager.close(); } return result; }