public class SecureDocument extends java.lang.Object implements Document
Document
interface for use with
ACLs. Instances are created using the static factory methods. There
are no public constructors. Implementors may use this directly or
for reference.Modifier and Type | Method and Description |
---|---|
void |
addPrincipal(java.lang.String name,
SpiConstants.AclScope scope,
SpiConstants.AclAccess access)
Adds a user or group to the ACL.
|
static SecureDocument |
createAcl(java.util.Map<java.lang.String,java.util.List<Value>> properties)
Constructs a
SecureDocument representing a stand-alone ACL whose
metadata consists of the supplied Map of properties,
associating property names with their Values . |
static SecureDocument |
createAcl(java.lang.String docId,
java.lang.String searchUrl)
Constructs a
SecureDocument representing a stand-alone ACL. |
static SecureDocument |
createDocumentWithAcl(Document document)
Constructs a
SecureDocument representing a document with
an ACL whose metadata consists of the properties of the given
Document . |
static SecureDocument |
createDocumentWithAcl(java.util.Map<java.lang.String,java.util.List<Value>> properties)
Constructs a
SecureDocument representing a document with
an ACL whose metadata consists of the supplied Map of
properties, associating property names with their Values . |
Property |
findProperty(java.lang.String name)
Finds a
Property by name. |
java.util.Set<java.lang.String> |
getPropertyNames()
Gets the set of names of all
Properties in this
Document . |
void |
setInheritanceType(SpiConstants.AclInheritanceType type)
Sets the inheritance type.
|
void |
setInheritFrom(java.lang.String url)
Sets the URL for an inherited ACL.
|
void |
setInheritFrom(java.lang.String docid,
SpiConstants.FeedType feedType)
Sets the components needed to construct the inherit-from URL of an ACL
that was fed using FeedType.CONTENT, FeedType.CONTENTURL, or FeedType.ACL.
|
public static SecureDocument createAcl(java.lang.String docId, java.lang.String searchUrl)
SecureDocument
representing a stand-alone ACL.
Implies a document type of ACL
.docId
- the unique document IDsearchUrl
- the repository URL, may be null
SpiConstants.PROPNAME_DOCID
,
SpiConstants.PROPNAME_SEARCHURL
public static SecureDocument createAcl(java.util.Map<java.lang.String,java.util.List<Value>> properties)
SecureDocument
representing a stand-alone ACL whose
metadata consists of the supplied Map
of properties,
associating property names with their Values
.
Implies a document type of ACL
.properties
- a Map
of document metadatapublic static SecureDocument createDocumentWithAcl(Document document) throws RepositoryException
SecureDocument
representing a document with
an ACL whose metadata consists of the properties of the given
Document
. The document may represent a stand-alone ACL or
an indexable document.document
- a base document whose properties are included in
the return SecureDocument
RepositoryException
- if an error occurs accessing the
underlying documentpublic static SecureDocument createDocumentWithAcl(java.util.Map<java.lang.String,java.util.List<Value>> properties)
SecureDocument
representing a document with
an ACL whose metadata consists of the supplied Map
of
properties, associating property names with their Values
. Implies a document type of RECORD
.properties
- a Map
of document metadatapublic Property findProperty(java.lang.String name) throws RepositoryException
Property
by name. If the current document has a property
then that property is returned.findProperty
in interface Document
name
- the name of the Property
to findProperty
, if found; null
otherwiseRepositoryException
- if an error occurs accessing the
underlying documentpublic java.util.Set<java.lang.String> getPropertyNames() throws RepositoryException
Properties
in this
Document
.getPropertyNames
in interface Document
Set
of StringsRepositoryException
- if an error occurs accessing the
underlying documentpublic void setInheritFrom(java.lang.String url)
Only one of setInheritFrom(String url)
or
setInheritFrom(String docid, SpiConstants.FeedType feedType)
should be called. If both are called the inherit-from
docid
and feedType
will be ignored in favor
of the inherit-from url
.
url
- the URL of the parent ACLSpiConstants.PROPNAME_ACLINHERITFROM
public void setInheritFrom(java.lang.String docid, SpiConstants.FeedType feedType)
Only one of setInheritFrom(String url)
or
setInheritFrom(String docid, SpiConstants.FeedType feedType)
should be called. If both are called the inherit-from
docid
and feedType
will be ignored in favor
of the inherit-from url
.
docid
- the docid of the parent ACL documentfeedType
- the FeedType of the parent ACL document, or null
if this document's FeedType should be used.SpiConstants.PROPNAME_ACLINHERITFROM
public void setInheritanceType(SpiConstants.AclInheritanceType type)
type
- one of the SpiConstants.AclInheritanceType
valuesSpiConstants.PROPNAME_ACLINHERITANCETYPE
public void addPrincipal(java.lang.String name, SpiConstants.AclScope scope, SpiConstants.AclAccess access) throws RepositoryException
name
- the user or group namescope
- whether the principal is a user or group name, one
of the SpiConstants.AclScope
valuesaccess
- whether access is permitted or denied, one of the
SpiConstants.AclAccess
valuesRepositoryException
- if an error occurs accessing the
underlying documentSpiConstants.PROPNAME_ACLGROUPS
,
SpiConstants.PROPNAME_ACLUSERS
,
SpiConstants.PROPNAME_ACLDENYGROUPS
,
SpiConstants.PROPNAME_ACLDENYUSERS