Acl.Builder

public static class Acl.Builder extends Object

Mutable ACL for creating instances of Acl.

Public Constructor Summary

Acl.Builder()
Creates new empty builder.
Acl.Builder(Acl acl)
Creates and initializes the builder with ACL information provided in acl.

Public Method Summary

Acl
build()
Creates an immutable Acl instance of the current state.
Acl.Builder
setDeniedReaders(Collection<Principal> deniedReaders)
Replaces existing deniedReaders.
Acl.Builder
setInheritFrom(String inheritFrom)
Sets the parent to inherit ACLs from.
Acl.Builder
setInheritFrom(String inheritFrom, String fragment)
Sets the parent to inherit ACLs from.
Acl.Builder
setInheritanceType(Acl.InheritanceType inheritType)
Sets the type of Acl inheritance relationship between this id and any children.
Acl.Builder
setOwners(Collection<Principal> owners)
Replaces existing owners.
Acl.Builder
setReaders(Collection<Principal> readers)
Replaces existing readers.

Inherited Method Summary

Public Constructors

public Acl.Builder ()

Creates new empty builder.

All sets are empty, inheritFrom is null, and inheritType is CHILD_OVERRIDE.

public Acl.Builder (Acl acl)

Creates and initializes the builder with ACL information provided in acl.

Parameters
acl acl

Public Methods

public Acl build ()

Creates an immutable Acl instance of the current state.

Returns
  • a fully formed Acl

public Acl.Builder setDeniedReaders (Collection<Principal> deniedReaders)

Replaces existing deniedReaders.

Parameters
deniedReaders deniedReaders
Returns
  • the same instance of the builder, for chaining calls
Throws
NullPointerException if the collection is null or contains null
IllegalArgumentException if the collection contains "" or a value that has leading or trailing whitespace

public Acl.Builder setInheritFrom (String inheritFrom)

Sets the parent to inherit ACLs from.

Note that the parent's InheritanceType determines how to combine results with this ACL.

Parameters
inheritFrom inherit from parent "id"
Returns
  • the same instance of the builder, for chaining calls

public Acl.Builder setInheritFrom (String inheritFrom, String fragment)

Sets the parent to inherit ACLs from.

Note that the parent's InheritanceType determines how to combine results with this ACL.

The fragment facilitates a single parent id having multiple ACLs to inherit from. For example, a single parent document id could have ACLs inherited by sub-folder instances and different ACLs that are inherited by child files. The fragment allows specifying from which of the parent's ACLs to inherited.

Parameters
inheritFrom inherit from parent id
fragment combined with inheritFrom to form the ACL
Returns
  • the same instance of the builder, for chaining calls

public Acl.Builder setInheritanceType (Acl.InheritanceType inheritType)

Sets the type of Acl inheritance relationship between this id and any children.

ACL information is used to combine authorization decisions of this ACL with any of its children based on the Acl.InheritanceType.

Parameters
inheritType inheritance type (Acl.InheritanceType
Returns
  • the same instance of the builder, for chaining calls
Throws
NullPointerException if inheritType is null

public Acl.Builder setOwners (Collection<Principal> owners)

Replaces existing owners.

Parameters
owners owners
Returns
  • the same instance of the builder, for chaining calls
Throws
NullPointerException if the collection is null or contains null
IllegalArgumentException if the collection contains "" or a value that has leading or trailing whitespace

public Acl.Builder setReaders (Collection<Principal> readers)

Replaces existing readers.

Parameters
readers permit / readers
Returns
  • the same instance of the builder, for chaining calls
Throws
NullPointerException if the collection is null or contains null
IllegalArgumentException if the collection contains "" or a value that has leading or trailing whitespace