Class MCRStoredNode

java.lang.Object
org.mycore.datamodel.ifs2.MCRNode
org.mycore.datamodel.ifs2.MCRStoredNode
Direct Known Subclasses:
MCRDirectory, MCRFile

public abstract class MCRStoredNode extends MCRNode
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
  • Constructor Details

    • MCRStoredNode

      protected MCRStoredNode(MCRDirectory parent, Path fo, Element data)
      Returns a stored node instance that already exists
      Parameters:
      parent - the parent directory containing this node
      fo - the file object in local filesystem representing this node
      data - the additional data of this node that is not stored in the file object
    • MCRStoredNode

      protected MCRStoredNode(MCRDirectory parent, String name, String type)
      Creates a new stored node
      Parameters:
      parent - the parent directory
      name - the name of the node
      type - the node type, dir or file
  • Method Details

    • getLocalFile

      @Deprecated public File getLocalFile()
      Deprecated.
      use getLocalPath() instead
      Returns the local File 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

      public Path getLocalPath()
      Returns the local Path 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

      public void delete() throws IOException
      Deletes this node with all its data and children
      Throws:
      IOException
    • renameTo

      public void renameTo(String name) throws IOException
      Renames this node.
      Parameters:
      name - the new file name
      Throws:
      IOException
    • setLastModified

      public void setLastModified(Date time) throws IOException
      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

      public void setLabel(String lang, String label) throws IOException
      Sets a label for this node
      Parameters:
      lang - the xml:lang language ID
      label - the label in this language
      Throws:
      IOException
    • clearLabels

      public void clearLabels() throws IOException
      Removes all labels set
      Throws:
      IOException
    • getLabels

      public Map<String,String> getLabels()
      Returns a map of all labels, sorted by xml:lang, Key is xml:lang, value is the label for that language.
    • getLabel

      public String getLabel(String lang)
      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

      public String 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

      protected <T> T readData(Function<Element,T> readOperation)
    • writeData

      protected <T> void writeData(Consumer<Element> writeOperation)
    • getBasicFileAttributes

      public MCRFileAttributes<String> getBasicFileAttributes() throws IOException
      Throws:
      IOException