Package org.mycore.datamodel.ifs2
Class MCRStoredNode
java.lang.Object
org.mycore.datamodel.ifs2.MCRNode
org.mycore.datamodel.ifs2.MCRStoredNode
- Direct Known Subclasses:
MCRDirectory
,MCRFile
A file or directory really stored by importing it from outside the system.
Can be modified, updated and deleted, in contrast to virtual nodes.
- Author:
- Frank Lützenkirchen
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
MCRStoredNode
(MCRDirectory parent, String name, String type) Creates a new stored nodeprotected
MCRStoredNode
(MCRDirectory parent, Path fo, Element data) Returns a stored node instance that already exists -
Method Summary
Modifier and TypeMethodDescriptionvoid
Removes all labels setvoid
delete()
Deletes this node with all its data and childrenReturns the label in the current language, otherwise in default language, otherwise the first label defined, if any at all.Returns the label in the given languageReturns a map of all labels, sorted by xml:lang, Key is xml:lang, value is the label for that language.Deprecated.Returns the localPath
representing this stored file or directory.protected <T> T
void
Renames this node.void
Sets a label for this nodevoid
setLastModified
(Date time) Sets last modification time of this file to a custom value.protected <T> void
Methods inherited from class org.mycore.datamodel.ifs2.MCRNode
buildChildNode, getChild, getChildren, getContent, getLastModified, getName, getNodeByPath, getNumChildren, getParent, getPath, getRandomAccessContent, getRoot, getSize, hasChildren, isDirectory, isFile
-
Constructor Details
-
MCRStoredNode
Returns a stored node instance that already exists- Parameters:
parent
- the parent directory containing this nodefo
- the file object in local filesystem representing this nodedata
- the additional data of this node that is not stored in the file object
-
MCRStoredNode
Creates a new stored node- Parameters:
parent
- the parent directoryname
- the name of the nodetype
- the node type, dir or file
-
-
Method Details
-
getLocalFile
Deprecated.usegetLocalPath()
insteadReturns the localFile
representing this stored file or directory. Be careful to use this only for reading data, do never modify directly!- Returns:
- the file in the local filesystem representing this file
-
getLocalPath
Returns the localPath
representing this stored file or directory. Be careful to use this only for reading data, do never modify directly!- Returns:
- the file in the local filesystem representing this file
-
delete
Deletes this node with all its data and children- Throws:
IOException
-
renameTo
Renames this node.- Parameters:
name
- the new file name- Throws:
IOException
-
setLastModified
Sets last modification time of this file to a custom value.- Parameters:
time
- the time to be stored as last modification time- Throws:
IOException
-
setLabel
Sets a label for this node- Parameters:
lang
- the xml:lang language IDlabel
- the label in this language- Throws:
IOException
-
clearLabels
Removes all labels set- Throws:
IOException
-
getLabels
Returns a map of all labels, sorted by xml:lang, Key is xml:lang, value is the label for that language. -
getLabel
Returns the label in the given language- Parameters:
lang
- the xml:lang language ID- Returns:
- the label, or null if there is no label for that language
-
getCurrentLabel
Returns the label in the current language, otherwise in default language, otherwise the first label defined, if any at all.- Returns:
- the label
-
readData
-
writeData
-
getBasicFileAttributes
- Throws:
IOException
-
getLocalPath()
instead