public abstract class FedoraTypesUtils extends Object implements FedoraTypes
Modifier and Type | Class and Description |
---|---|
static class |
FedoraTypesUtils.IsExposedJCRPropertyPredicate
A functional predicate to check whether a property is a JCR property that should be exposed.
|
Modifier and Type | Field and Description |
---|---|
static Predicate<String> |
hasInternalNamespace
Check whether a type should be internal.
|
static Predicate<javax.jcr.Node> |
isAcl
Predicate for determining whether this
Node is an Web ACL. |
static Predicate<javax.jcr.Node> |
isContainer
Predicate for determining whether this
Node is a Container . |
static Predicate<javax.jcr.Node> |
isExternalNode
Check if a node is externally managed.
|
static Predicate<javax.jcr.Node> |
isFedoraBinary
Predicate for determining whether this
Node is a Fedora
binary. |
static Predicate<javax.jcr.Node> |
isInternalNode
Check if a node is "internal" and should not be exposed e.g.
|
static Predicate<javax.jcr.Property> |
isInternalProperty
Check whether a property is an internal property that should be suppressed
from external output.
|
static Predicate<javax.jcr.Property> |
isInternalReferenceProperty
Check if a property is a reference property.
|
static Predicate<URI> |
isInternalType
Check whether a type is an internal type that should be suppressed from external output.
|
static Predicate<javax.jcr.Node> |
isMemento
Predicate for determining whether this
Node is a Memento. |
static Predicate<javax.jcr.Node> |
isNonRdfSourceDescription
Predicate for determining whether this
Node is a
NonRdfSourceDescription . |
static Predicate<javax.jcr.Node> |
isSkolemNode
Predicate for determining whether this
Node is a Fedora Skolem node. |
static Predicate<javax.jcr.Node> |
isTimeMap
Predicate for determining whether this
Node is a TimeMap. |
CONTENT_DIGEST, CONTENT_SIZE, DEFAULT_DIGEST_ALGORITHM, FCR_ACL, FCR_FIXITY, FCR_METADATA, FCR_VERSIONS, FEDORA_BINARY, FEDORA_CONTAINER, FEDORA_CREATED, FEDORA_CREATEDBY, FEDORA_LASTMODIFIED, FEDORA_LASTMODIFIEDBY, FEDORA_NON_RDF_SOURCE_DESCRIPTION, FEDORA_PAIRTREE, FEDORA_REPOSITORY_ROOT, FEDORA_RESOURCE, FEDORA_SKOLEM, FEDORA_TIME_MAP, FEDORA_TOMBSTONE, FEDORA_WEBAC_ACL, FILENAME, HAS_MIME_TYPE, LDP_BASIC_CONTAINER, LDP_CONTAINER, LDP_DIRECT_CONTAINER, LDP_HAS_MEMBER_RELATION, LDP_INDIRECT_CONTAINER, LDP_INSERTED_CONTENT_RELATION, LDP_IS_MEMBER_OF_RELATION, LDP_MEMBER_RESOURCE, LDP_NON_RDF_SOURCE, LDP_RDF_SOURCE, MEMENTO, MEMENTO_DATETIME, MEMENTO_ORIGINAL, PROXY_FOR, REDIRECTS_TO
Constructor and Description |
---|
FedoraTypesUtils() |
Modifier and Type | Method and Description |
---|---|
static javax.jcr.Node |
getClosestExistingAncestor(javax.jcr.Session session,
String path)
Get the closest ancestor that current exists
|
static Optional<javax.jcr.Node> |
getContainingNode(javax.jcr.Node node)
Get the JCR Node that corresponds to the containing node in the repository.
|
static javax.jcr.Node |
getJcrNode(FedoraResource resource)
Retrieve the underlying JCR Node from the FedoraResource
|
static Optional<Integer> |
getPropertyType(javax.jcr.Node node,
String propertyName)
Get the JCR property type ID for a given property name.
|
static String |
getReferencePropertyName(String propertyName)
When we add certain URI properties, we also want to leave a reference node
|
static String |
getReferencePropertyOriginalName(String refPropertyName)
Given an internal reference node property, get the original name
|
static boolean |
isMultivaluedProperty(javax.jcr.Node node,
String propertyName)
Determine if a given JCR property name is single- or multi- valued.
|
static boolean |
isReferenceProperty(javax.jcr.Node node,
String propertyName)
Check if a property definition is a reference property
|
static Optional<org.apache.jena.rdf.model.Resource> |
ldpInsertedContentProperty(javax.jcr.Node node)
Given a JCR Node, fetch the parent's ldp:insertedContentRelation value, if
one exists.
|
static Function<org.apache.jena.rdf.model.Resource,Optional<String>> |
resourceToProperty(javax.jcr.Session session)
Using a JCR session, return a function that maps an RDF Resource to a corresponding property name.
|
static void |
touch(javax.jcr.Node node)
Updates the LAST_MODIFIED_DATE and LAST_MODIFIED_BY properties to now, and the current user
respectively.
|
static void |
touch(javax.jcr.Node node,
Calendar created,
String creatingUser,
Calendar modified,
String modifyingUser)
Updates the LAST_MODIFIED_DATE, LAST_MODIFIED_BY, CREATED_DATE and CREATED_BY properties to the provided values.
|
static void |
touchLdpMembershipResource(javax.jcr.Node node)
Update the fedora:lastModified date and fedora:lastModifiedBy of the parent's ldp:membershipResource if that
node is a direct or indirect container, provided the LDP constraints are valid.
|
static void |
touchLdpMembershipResource(javax.jcr.Node node,
Calendar date,
String user)
Update the fedora:lastModified date and fedora:lastModifiedBy of the parent's ldp:membershipResource if that
node is a direct or indirect container, provided the LDP constraints are valid.
|
public static final Predicate<javax.jcr.Node> isContainer
Node
is a Container
.public static final Predicate<javax.jcr.Node> isNonRdfSourceDescription
Node
is a
NonRdfSourceDescription
.public static final Predicate<javax.jcr.Node> isFedoraBinary
Node
is a Fedora
binary.public static final Predicate<javax.jcr.Node> isSkolemNode
Node
is a Fedora Skolem node.public static final Predicate<javax.jcr.Node> isMemento
Node
is a Memento.public static final Predicate<javax.jcr.Node> isTimeMap
Node
is a TimeMap.public static final Predicate<javax.jcr.Node> isAcl
Node
is an Web ACL.public static final Predicate<javax.jcr.Property> isInternalReferenceProperty
public static final Predicate<String> hasInternalNamespace
public static final Predicate<javax.jcr.Property> isInternalProperty
public static final Predicate<URI> isInternalType
public static final Predicate<javax.jcr.Node> isInternalNode
public static final Predicate<javax.jcr.Node> isExternalNode
public FedoraTypesUtils()
public static Optional<Integer> getPropertyType(javax.jcr.Node node, String propertyName) throws javax.jcr.RepositoryException
node
- the JCR node to add the property onpropertyName
- the property namejavax.jcr.RepositoryException
- if repository exception occurredpublic static boolean isMultivaluedProperty(javax.jcr.Node node, String propertyName) throws javax.jcr.RepositoryException
node
- the JCR node to checkpropertyName
- the property name (which may or may not already exist)javax.jcr.RepositoryException
- if repository exception occurredpublic static String getReferencePropertyName(String propertyName)
propertyName
- the property namepublic static String getReferencePropertyOriginalName(String refPropertyName)
refPropertyName
- the reference node property namepublic static boolean isReferenceProperty(javax.jcr.Node node, String propertyName) throws javax.jcr.RepositoryException
node
- the given nodepropertyName
- the property namejavax.jcr.RepositoryException
- if repository exception occurredpublic static javax.jcr.Node getClosestExistingAncestor(javax.jcr.Session session, String path) throws javax.jcr.RepositoryException
session
- the given sessionpath
- the given pathjavax.jcr.RepositoryException
- if repository exception occurredpublic static javax.jcr.Node getJcrNode(FedoraResource resource)
resource
- the Fedora resourcepublic static Optional<org.apache.jena.rdf.model.Resource> ldpInsertedContentProperty(javax.jcr.Node node)
node
- the JCR Nodepublic static Function<org.apache.jena.rdf.model.Resource,Optional<String>> resourceToProperty(javax.jcr.Session session)
session
- The JCR sessionpublic static void touchLdpMembershipResource(javax.jcr.Node node)
node
- The JCR nodepublic static void touchLdpMembershipResource(javax.jcr.Node node, Calendar date, String user)
node
- The JCR nodedate
- the date the modification was supposed to have occurred or null to indicate nowuser
- the user who performed the action or null to indicate the user associated with the current sessionpublic static void touch(javax.jcr.Node node)
node
- The JCR nodepublic static void touch(javax.jcr.Node node, Calendar created, String creatingUser, Calendar modified, String modifyingUser)
node
- The JCR nodecreated
- the date the resource was created, or null if not explicitly setcreatingUser
- the userID of created this resource or null if not explicitly setmodified
- the modification date, or null if not explicitly setmodifyingUser
- the userID who modified this resource or null if not explicitly setpublic static Optional<javax.jcr.Node> getContainingNode(javax.jcr.Node node)
node
- the JCR nodeCopyright © 2013–2019 DuraSpace, Inc.. All rights reserved.