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 irrelevantorg.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 |
---|---|
protected javax.jcr.Node |
node |
CONTENT_DIGEST, CONTENT_SIZE, DEFAULT_DIGEST_ALGORITHM, FCR_METADATA, FCR_VERSIONS, FEDORA_BINARY, FEDORA_CONTAINER, FEDORA_LASTMODIFIED, FEDORA_NON_RDF_SOURCE_DESCRIPTION, FEDORA_PAIRTREE, FEDORA_REPOSITORY_ROOT, FEDORA_RESOURCE, FEDORA_SKOLEM, FEDORA_TOMBSTONE, 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
Constructor and Description |
---|
FedoraResourceImpl(javax.jcr.Node node)
Construct a
FedoraResource from an existing JCR Node |
Modifier and Type | Method and Description |
---|---|
void |
delete()
Delete this resource, and any inbound references to it
|
void |
disableVersioning()
Disable versioning
|
void |
enableVersioning()
Enable versioning
|
boolean |
equals(Object object) |
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.
|
javax.jcr.version.Version |
getBaseVersion()
Get the JCR Base version for the node
|
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
|
Date |
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
|
String |
getEtagValue()
Construct an ETag value from the last modified date and path.
|
Date |
getLastModifiedDate()
This method gets the last modified date for this FedoraResource.
|
javax.jcr.Node |
getNode()
Return the underlying JCR Node for this resource
|
String |
getPath()
Get the path to the JCR node
|
protected javax.jcr.Property |
getProperty(String relPath) |
protected javax.jcr.Session |
getSession() |
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
|
FedoraResource |
getUnfrozenResource()
Get the unfrozen equivalent of a frozen versioned node
|
FedoraResource |
getVersion(String label)
Get a resource version for this object with the provided label.
|
FedoraResource |
getVersionedAncestor()
When this is a frozen node, get the ancestor that was explicitly versioned
|
javax.jcr.version.VersionHistory |
getVersionHistory()
Get JCR VersionHistory for the node.
|
String |
getVersionLabelOfFrozenResource()
This method returns the version label of this frozen resource.
|
protected javax.jcr.version.VersionManager |
getVersionManager() |
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 |
isFrozenResource()
Check if a resource is frozen (a historic version).
|
Boolean |
isNew()
Check if a resource was created in this session
|
boolean |
isVersioned()
Check if a resource is versioned
|
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()
Set the last-modified date to the current date.
|
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, withSession
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getChildren
protected 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()
FedoraResource
getPath
in interface FedoraResource
public Stream<FedoraResource> getChildren(Boolean recursive)
FedoraResource
getChildren
in interface FedoraResource
recursive
- whether to recursively fetch child resourcespublic FedoraResource getDescription()
FedoraResource
getDescription
in interface FedoraResource
public FedoraResource getDescribedResource()
FedoraResource
getDescribedResource
in interface FedoraResource
public FedoraResource getContainer()
FedoraResource
getContainer
in interface FedoraResource
public FedoraResource getChild(String relPath)
FedoraResource
getChild
in interface FedoraResource
relPath
- the given pathpublic boolean hasProperty(String relPath)
FedoraResource
hasProperty
in interface FedoraResource
relPath
- the given pathpublic void delete()
FedoraResource
delete
in interface FedoraResource
public Date getCreatedDate()
FedoraResource
getCreatedDate
in interface FedoraResource
public Date getLastModifiedDate()
getLastModifiedDate
in interface FedoraResource
public void touch()
public boolean hasType(String type)
FedoraResource
Note: 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:frozenNode") is a valid use of this method.
hasType
in interface FedoraResource
type
- the given typepublic List<URI> getTypes()
FedoraResource
getTypes
in interface FedoraResource
public void updateProperties(IdentifierConverter<org.apache.jena.rdf.model.Resource,FedoraResource> idTranslator, String sparqlUpdateStatement, RdfStream originalTriples) throws MalformedRdfException, AccessDeniedException
FedoraResource
updateProperties
in interface FedoraResource
idTranslator
- 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)
FedoraResource
getTriples
in interface FedoraResource
idTranslator
- the property of idTranslatorcontext
- the contextpublic RdfStream getTriples(IdentifierConverter<org.apache.jena.rdf.model.Resource,FedoraResource> idTranslator, Set<? extends TripleCategory> contexts)
FedoraResource
getTriples
in interface FedoraResource
idTranslator
- the property of idTranslatorcontexts
- the provided contextspublic javax.jcr.version.Version getBaseVersion()
FedoraResource
getBaseVersion
in interface FedoraResource
public javax.jcr.version.VersionHistory getVersionHistory()
FedoraResource
getVersionHistory
in interface FedoraResource
public Boolean isNew()
FedoraResource
isNew
in interface FedoraResource
public void replaceProperties(IdentifierConverter<org.apache.jena.rdf.model.Resource,FedoraResource> idTranslator, org.apache.jena.rdf.model.Model inputModel, RdfStream originalTriples) throws MalformedRdfException
FedoraResource
replaceProperties
in interface FedoraResource
idTranslator
- the given property of idTranslatorinputModel
- the input modeloriginalTriples
- the original triplesMalformedRdfException
- if malformed rdf exception occurredpublic String getEtagValue()
FedoraResource
getEtagValue
in interface FedoraResource
public void enableVersioning()
FedoraResource
enableVersioning
in interface FedoraResource
public void disableVersioning()
FedoraResource
disableVersioning
in interface FedoraResource
public boolean isVersioned()
FedoraResource
isVersioned
in interface FedoraResource
public boolean isFrozenResource()
FedoraResource
isFrozenResource
in interface FedoraResource
public FedoraResource getVersionedAncestor()
FedoraResource
getVersionedAncestor
in interface FedoraResource
public FedoraResource getUnfrozenResource()
FedoraResource
getUnfrozenResource
in interface FedoraResource
public FedoraResource getVersion(String label)
FedoraResource
getVersion
in interface FedoraResource
label
- the labelpublic String getVersionLabelOfFrozenResource()
FedoraResource
getVersionLabelOfFrozenResource
in interface FedoraResource
protected javax.jcr.version.VersionManager getVersionManager()
protected javax.jcr.Session getSession()
protected 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 nodeCopyright © 2013–2016 DuraSpace, Inc.. All rights reserved.