Class ACLImpl

    • Constructor Detail

      • ACLImpl

        public ACLImpl​(Resource resource)

        Builds an instance of ACLImpl for the specified resource.

        Parameters:
        resource - a reference to the Resource associated with the ACL being constructed.
      • ACLImpl

        public ACLImpl​(Resource resource,
                       Collection<ACLEntry> entries)

        Builds an instance of ACLImpl for the specified resource, and initialize it with the specified entries.

        Parameters:
        resource - a reference to the Resource associated with the ACL being constructed.
        entries - a Collection containing the ACL's initial entries.
    • Method Detail

      • getACLId

        public long getACLId()

        Obtains the persistent id of this ACLImpl.

        Returns:
        a long representing the persistent id this ACL.
      • addEntry

        public boolean addEntry​(ACLEntry entry)
        Description copied from interface: ACL

        Adds an entry to this ACL. If the ACL already has an ACLEntry associated to the new entry's identity, then the new entry will not be added.

        Specified by:
        addEntry in interface ACL
        Parameters:
        entry - the ACLEntry to be added.
        Returns:
        true if the entry was added; false otherwise.
      • removeEntry

        public boolean removeEntry​(ACLEntry entry)
        Description copied from interface: ACL

        Removes an entry from this ACL.

        Specified by:
        removeEntry in interface ACL
        Parameters:
        entry - the ACLEntry to be removed.
        Returns:
        true if the entry is removed; false if the entry can't be found in the ACL.
      • getEntries

        public Collection<? extends ACLEntry> getEntries()
        Description copied from interface: ACL

        Obtains the collection of all ACLEntries in this ACL.

        Specified by:
        getEntries in interface ACL
        Returns:
        a Collection containing all entries in this ACL.
      • getEntry

        public ACLEntry getEntry​(Identity identity)
        Description copied from interface: ACL

        Obtains the entry that corresponds to the specified identity. Calling this method is the same as doing getEntry(identity.getName()).

        Specified by:
        getEntry in interface ACL
        Parameters:
        identity - a reference to the Identity object.
        Returns:
        the ACLEntry that corresponds to the identity, or null if no entry could be found.
      • getEntry

        public ACLEntry getEntry​(String identityOrRole)
        Description copied from interface: ACL

        Obtains the entry that corresponds to the specified identity or role name.

        Specified by:
        getEntry in interface ACL
        Parameters:
        identityOrRole - a String representing an identity or role.
        Returns:
        the ACLEntry that corresponds to the identity or role or null if no entry could be found.
      • isGranted

        public boolean isGranted​(ACLPermission permission,
                                 Identity identity)
        Description copied from interface: ACL

        Verify if the given permission is assigned to the specified Identity.

        Specified by:
        isGranted in interface ACL
        Parameters:
        permission - the ACLPermission to be checked for.
        identity - the Identity being verified.
        Returns:
        true if the specified permission is assigned to the identity; false otherwise.
      • getResourceAsString

        public String getResourceAsString()

        Obtains the stringfied representation of the resource associated with this ACL.

        Returns:
        a String representation of the resource.
      • getResource

        public Resource getResource()
        Description copied from interface: ACL

        Obtains a reference to the resource being protected by this ACL.

        Specified by:
        getResource in interface ACL
        Returns:
        a reference to the Resource.
      • setResource

        public void setResource​(Resource resource)

        Sets the resource associated with this ACL.

        Parameters:
        resource - a reference to the Resource associated with this ACL.