Class MCRTransferPackage

java.lang.Object
org.mycore.impex.MCRTransferPackage

public class MCRTransferPackage extends Object
Basic transfer package containing a MCRObject, all its descendants, links, derivates (including their files) and referenced classifications.

To build a transfer package call build(), this initializes all required objects and checks if they are valid. Call getContent() to retrieve the content afterwards.

Author:
Silvio Hermann, Matthias Eichner
  • Field Details

  • Constructor Details

    • MCRTransferPackage

      public MCRTransferPackage(MCRObject source)
  • Method Details

    • build

      public void build() throws MCRUsageException
      Builds the transfer package.
      Throws:
      MCRUsageException - is thrown if some of the referenced objects or derivates couldn't be retrieved
    • resolveChildrenAndLinks

      protected void resolveChildrenAndLinks(MCRObject object, LinkedHashMap<MCRObjectID,MCRObject> objectMap, Set<MCRCategoryID> categories)
      Fills the given objectMap with all children and links of the object. The object itself is also added.
      Parameters:
      object - the source object
      objectMap - the map which will be created
    • buildFileContainers

      protected List<MCRTransferPackageFileContainer> buildFileContainers(MCRObject object)
      Builds a list of MCRTransferPackageFileContainer for all derivate's of the given object and all its descendants.

      TODO: derivates of linked objects are not added

      Parameters:
      object - the object
      Returns:
      list of transfer packages file container
    • buildImportConfiguration

      public Document buildImportConfiguration()
      Generates an xml file, which contains import configuration.
      Returns:
      import configuration document
    • getContent

      public Map<String,MCRContent> getContent() throws IOException
      Returns the content for this transfer package. You have to call build() before you can retrieve this data.
      Returns:
      a map where key = filename; value = MCRContent
      Throws:
      IOException
    • getSource

      public MCRObject getSource()
      Returns the source of this transfer package.
      Returns:
      the source
    • toString

      public String toString()
      Overrides:
      toString in class Object