Class MetadataExport


  • public class MetadataExport
    extends Object
    Metadata exporter to allow the batch export of metadata into a file
    Author:
    Stuart Lewis
    • Field Detail

      • toExport

        protected Iterator<Item> toExport
        The items to export
      • context

        protected Context context
      • exportAll

        protected boolean exportAll
        Whether to export all metadata, or just normally edited metadata
    • Constructor Detail

      • MetadataExport

        protected MetadataExport()
      • MetadataExport

        public MetadataExport​(Context c,
                              Iterator<Item> toExport,
                              boolean exportAll)
        Set up a new metadata export
        Parameters:
        c - The Context
        toExport - The ItemIterator of items to export
        exportAll - whether to export all metadata or not (include handle, provenance etc)
      • MetadataExport

        public MetadataExport​(Context c,
                              Community toExport,
                              boolean exportAll)
        Method to export a community (and sub-communities and collections)
        Parameters:
        c - The Context
        toExport - The Community to export
        exportAll - whether to export all metadata or not (include handle, provenance etc)
    • Method Detail

      • buildFromCommunity

        protected Iterator<Item> buildFromCommunity​(Context context,
                                                    Community community,
                                                    int indent)
                                             throws SQLException
        Build an array list of item ids that are in a community (include sub-communities and collections)
        Parameters:
        context - DSpace context
        community - The community to build from
        indent - How many spaces to use when writing out the names of items added
        Returns:
        The list of item ids
        Throws:
        SQLException - if database error
      • export

        public DSpaceCSV export()
        Run the export
        Returns:
        the exported CSV lines
      • main

        public static void main​(String[] argv)
                         throws Exception
        main method to run the metadata exporter
        Parameters:
        argv - the command line arguments given
        Throws:
        Exception - if error occurs