public class FedoraResourceImpl extends org.modeshape.jcr.api.JcrTools implements FedoraTypes, FedoraResource
Container and
NonRdfSourceDescription types; also used
when the exact type of an object is irrelevant| Modifier and Type | Class and Description |
|---|---|
protected static interface |
FedoraResourceImpl.RdfGenerator |
org.modeshape.jcr.api.JcrTools.BasicOperation, org.modeshape.jcr.api.JcrTools.BrowseContent, org.modeshape.jcr.api.JcrTools.CountNodes, org.modeshape.jcr.api.JcrTools.NodeOperation, org.modeshape.jcr.api.JcrTools.Operation, org.modeshape.jcr.api.JcrTools.PrintNodes, org.modeshape.jcr.api.JcrTools.Variable| Modifier and Type | Field and Description |
|---|---|
static String |
CONTAINER_WEBAC_ACL |
protected static Map<TripleCategory,FedoraResourceImpl.RdfGenerator> |
contextMap |
protected javax.jcr.Node |
node |
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 |
|---|
FedoraResourceImpl(javax.jcr.Node node)
Construct a
FedoraResource from an existing JCR Node |
| Modifier and Type | Method and Description |
|---|---|
void |
addType(String type)
Add an RDF:type value to the resource
|
protected static Function<org.apache.jena.graph.Triple,org.apache.jena.graph.Triple> |
convertMementoReferences(IdentifierConverter<org.apache.jena.rdf.model.Resource,FedoraResource> translator,
IdentifierConverter<org.apache.jena.rdf.model.Resource,FedoraResource> internalTranslator)
Returns a function that converts the subject to the original URI and the object of a triple from an
undereferenceable internal identifier back to it's original external resource path.
|
void |
delete()
Delete this resource, and any inbound references to it
|
boolean |
equals(Object object) |
FedoraResource |
findMementoByDatetime(Instant mementoDatetime)
Retrieve the Memento with the closest datetime to the request.
|
FedoraResource |
findOrCreateAcl()
Create the ACL for this resource if it doesn't exist
|
static Function<org.apache.jena.graph.Triple,org.apache.jena.graph.Triple> |
fixDatesIfNecessary(FedoraResource r,
com.google.common.base.Converter<javax.jcr.Node,org.apache.jena.rdf.model.Resource> translator)
A method that takes a Triple and returns a Triple that is the correct representation of
that triple for the given resource.
|
FedoraResource |
getAcl()
Get the ACL of this resource
|
FedoraResource |
getChild(String relPath)
Get the child of this resource at the given path
|
Stream<FedoraResource> |
getChildren(Boolean recursive)
Get the children of this resource, possibly recursively
|
FedoraResource |
getContainer()
Get the container of this resource
|
Instant |
getCreatedDate()
Get the date this resource was created
|
FedoraResource |
getDescribedResource()
Get the resource described by this resource
|
FedoraResource |
getDescription()
Get the description for this resource
|
protected javax.jcr.Node |
getDescriptionNode() |
String |
getEtagValue()
Construct an ETag value for the resource.
|
Instant |
getLastModifiedDate()
This method gets the last modified date for this FedoraResource.
|
Instant |
getMementoDatetime()
Retrieve the mementoDatetime property and return it as an Instant
|
javax.jcr.Node |
getNode()
Return the underlying JCR Node for this resource
|
FedoraResource |
getOriginalResource()
Get the Original Resource for which this resource is a memento.
|
String |
getPath()
Get the path to the resource
|
protected javax.jcr.Property |
getProperty(String relPath) |
protected javax.jcr.Session |
getSession() |
String |
getStateToken()
Construct a State Token value for the resource.
|
FedoraResource |
getTimeMap()
Get the TimeMap/LDPCv of this resource
|
RdfStream |
getTriples(IdentifierConverter<org.apache.jena.rdf.model.Resource,FedoraResource> idTranslator,
Set<? extends TripleCategory> contexts)
Return the RDF properties of this object using the provided contexts
|
RdfStream |
getTriples(IdentifierConverter<org.apache.jena.rdf.model.Resource,FedoraResource> idTranslator,
TripleCategory context)
Return the RDF properties of this object using the provided context
|
List<URI> |
getTypes()
Get the RDF:type values for this resource
|
int |
hashCode() |
boolean |
hasProperty(String relPath)
Does this resource have a property
|
boolean |
hasType(String type)
Check if this object uses a given RDF type
|
boolean |
isAcl()
Returns true if this resource is an ACL.
|
boolean |
isMemento()
Returns true if this resource is a Memento.
|
Boolean |
isNew()
Check if a resource was created in this session
|
boolean |
isOriginalResource()
Check if a resource is an original resource
(ie versionable, as opposed to non-versionable resources
like mementos, timemaps, and acls).
|
boolean |
isTimeMap()
Returns true if this resource is a TimeMap.
|
protected void |
removeReferences(javax.jcr.Node n) |
void |
replaceProperties(IdentifierConverter<org.apache.jena.rdf.model.Resource,FedoraResource> idTranslator,
org.apache.jena.rdf.model.Model inputModel,
RdfStream originalTriples)
Replace the properties of this object with the properties from the given
model
|
String |
toString() |
void |
touch(boolean includeMembershipResource,
Calendar createdDate,
String createdUser,
Calendar modifiedDate,
String modifyingUser)
Touches a resource to ensure that the implicitly updated properties are updated if
not explicitly set.
|
void |
updateProperties(IdentifierConverter<org.apache.jena.rdf.model.Resource,FedoraResource> idTranslator,
String sparqlUpdateStatement,
RdfStream originalTriples)
Update the provided properties with a SPARQL Update query.
|
findOrCreateChild, findOrCreateChild, findOrCreateNode, findOrCreateNode, findOrCreateNode, findOrCreateNode, getNode, getReadable, getStringValue, importContent, importContent, importContent, importContent, importContent, importContent, importContent, isDebug, onEachNode, onEachNodeBelow, print, printNode, printQuery, printQuery, printQuery, printQuery, printSubgraph, printSubgraph, printSubgraph, registerNodeTypes, removeAllChildren, removeAllChildren, repeatedlyWithSession, resourceUrl, setDebug, uploadFile, uploadFile, uploadFile, uploadFileAndBlock, uploadFileAndBlock, uploadFileAndBlock, uploadFilesAndBlock, var, vars, withSessionclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetChildrenpublic static final String CONTAINER_WEBAC_ACL
protected static final Map<TripleCategory,FedoraResourceImpl.RdfGenerator> contextMap
protected final javax.jcr.Node node
public FedoraResourceImpl(javax.jcr.Node node)
FedoraResource from an existing JCR Nodenode - an existing JCR node to treat as an fcrepo objectpublic javax.jcr.Node getNode()
public String getPath()
FedoraResourcegetPath in interface FedoraResourcepublic Stream<FedoraResource> getChildren(Boolean recursive)
FedoraResourcegetChildren in interface FedoraResourcerecursive - whether to recursively fetch child resourcespublic FedoraResource getDescription()
FedoraResourcegetDescription in interface FedoraResourceprotected javax.jcr.Node getDescriptionNode()
public FedoraResource getDescribedResource()
FedoraResourcegetDescribedResource in interface FedoraResourcepublic FedoraResource getContainer()
FedoraResourcegetContainer in interface FedoraResourcepublic FedoraResource getOriginalResource()
FedoraResourcegetOriginalResource in interface FedoraResourcepublic FedoraResource getTimeMap()
FedoraResourcegetTimeMap in interface FedoraResourcepublic Instant getMementoDatetime()
FedoraResourcegetMementoDatetime in interface FedoraResourcepublic boolean isOriginalResource()
FedoraResourceisOriginalResource in interface FedoraResourcepublic boolean isTimeMap()
FedoraResourceisTimeMap in interface FedoraResourcepublic boolean isMemento()
FedoraResourceisMemento in interface FedoraResourcepublic boolean isAcl()
FedoraResourceisAcl in interface FedoraResourcepublic FedoraResource getAcl()
FedoraResourcegetAcl in interface FedoraResourcepublic FedoraResource findOrCreateAcl()
FedoraResourcefindOrCreateAcl in interface FedoraResourcepublic FedoraResource getChild(String relPath)
FedoraResourcegetChild in interface FedoraResourcerelPath - the given pathpublic boolean hasProperty(String relPath)
FedoraResourcehasProperty in interface FedoraResourcerelPath - the given pathpublic void delete()
FedoraResourcedelete in interface FedoraResourceprotected void removeReferences(javax.jcr.Node n)
public Instant getCreatedDate()
FedoraResourcegetCreatedDate in interface FedoraResourcepublic Instant getLastModifiedDate()
getLastModifiedDate in interface FedoraResourcepublic boolean hasType(String type)
FedoraResourceNote: the type parameter should be in prefixed short form, so ldp:Container or ex:Image are both acceptable types. This method does not assume any jcr to fedora prefix mappings are managed by the implementation, so hasType("jcr:lastModified") is a valid use of this method.
hasType in interface FedoraResourcetype - the given typepublic List<URI> getTypes()
FedoraResourcegetTypes in interface FedoraResourcepublic void updateProperties(IdentifierConverter<org.apache.jena.rdf.model.Resource,FedoraResource> idTranslator, String sparqlUpdateStatement, RdfStream originalTriples) throws MalformedRdfException, AccessDeniedException
FedoraResourceupdateProperties in interface FedoraResourceidTranslator - the property of idTranslatorsparqlUpdateStatement - sparql update statementoriginalTriples - original triplesMalformedRdfException - if malformed rdf exception occurredAccessDeniedException - if access denied in updating propertiespublic RdfStream getTriples(IdentifierConverter<org.apache.jena.rdf.model.Resource,FedoraResource> idTranslator, TripleCategory context)
FedoraResourcegetTriples in interface FedoraResourceidTranslator - the property of idTranslatorcontext - the contextpublic RdfStream getTriples(IdentifierConverter<org.apache.jena.rdf.model.Resource,FedoraResource> idTranslator, Set<? extends TripleCategory> contexts)
FedoraResourcegetTriples in interface FedoraResourceidTranslator - the property of idTranslatorcontexts - the provided contextspublic Boolean isNew()
FedoraResourceisNew in interface FedoraResourcepublic void replaceProperties(IdentifierConverter<org.apache.jena.rdf.model.Resource,FedoraResource> idTranslator, org.apache.jena.rdf.model.Model inputModel, RdfStream originalTriples) throws MalformedRdfException
FedoraResourcereplaceProperties in interface FedoraResourceidTranslator - the given property of idTranslatorinputModel - the input modeloriginalTriples - the original triplesMalformedRdfException - if malformed rdf exception occurredpublic void touch(boolean includeMembershipResource, Calendar createdDate, String createdUser, Calendar modifiedDate, String modifyingUser) throws javax.jcr.RepositoryException
includeMembershipResource - true if this touch should propagate through to
ldp membership resourcescreatedDate - the date to which the created date should be set or null to leave it unchangedcreatedUser - the user to which the created by should be set or null to leave it unchangedmodifiedDate - the date to which the modified date should be set or null to use nowmodifyingUser - the user making the modification or null to use the current userjavax.jcr.RepositoryException - an error occurs while updating the repositorypublic String getEtagValue()
FedoraResourcegetEtagValue in interface FedoraResourcepublic String getStateToken()
FedoraResourcegetStateToken in interface FedoraResourceprotected static Function<org.apache.jena.graph.Triple,org.apache.jena.graph.Triple> convertMementoReferences(IdentifierConverter<org.apache.jena.rdf.model.Resource,FedoraResource> translator, IdentifierConverter<org.apache.jena.rdf.model.Resource,FedoraResource> internalTranslator)
translator - a converter to get the external resource identifier from a pathinternalTranslator - a converter to get the path from an internal identifierprotected javax.jcr.Session getSession()
public void addType(String type)
FedoraResourceNote: the type parameter should be in prefixed short form, so ldp:Container or ex:Image are both acceptable types. This method does not assume any jcr to fedora prefix mappings are managed by the implementation, so hasType("jcr:lastModified") is a valid use of this method.
addType in interface FedoraResourcetype - the type to addprotected javax.jcr.Property getProperty(String relPath)
public static Function<org.apache.jena.graph.Triple,org.apache.jena.graph.Triple> fixDatesIfNecessary(FedoraResource r, com.google.common.base.Converter<javax.jcr.Node,org.apache.jena.rdf.model.Resource> translator)
PropertiesRdfContext to replace the reported RdfLexicon.LAST_MODIFIED_DATE
with the one produced by getLastModifiedDate().r - the Fedora resourcetranslator - a converter to get the external identifier from a jcr nodepublic FedoraResource findMementoByDatetime(Instant mementoDatetime)
FedoraResourcefindMementoByDatetime in interface FedoraResourcemementoDatetime - The requested date time.Copyright © 2013–2019 DuraSpace, Inc.. All rights reserved.