Class DSpaceCSVLine

    • Constructor Detail

      • DSpaceCSVLine

        public DSpaceCSVLine​(UUID itemId)
        Create a new CSV line
        Parameters:
        itemId - The item ID of the line
      • DSpaceCSVLine

        public DSpaceCSVLine()
        Create a new CSV line for a new item
    • Method Detail

      • getID

        public UUID getID()
        Get the item ID that this line represents
        Returns:
        The item ID
      • add

        public void add​(String key,
                        String value)
        Add a new metadata value to this line
        Parameters:
        key - The metadata key (e.g. dc.contributor.author)
        value - The metadata value
      • get

        public List<String> get​(String key)
        Get all the values that match the given metadata key. Will be null if none exist.
        Parameters:
        key - The metadata key
        Returns:
        All the elements that match
      • getAction

        public String getAction()
        Get any action associated with this line
        Returns:
        The action (may be blank, 'withdraw', 'reinstate' or 'delete')
      • keys

        public Set<String> keys()
        Get all the metadata keys that are represented in this line
        Returns:
        An enumeration of all the keys
      • toCSV

        protected String toCSV​(List<String> headings,
                               String fieldSeparator,
                               String valueSeparator)
        Write this line out as a CSV formatted string, in the order given by the headings provided
        Parameters:
        headings - The headings which define the order the elements must be presented in
        fieldSeparator - separator between metadata fields
        valueSeparator - separator between metadata values (within a field)
        Returns:
        The CSV formatted String
      • valueToCSV

        protected String valueToCSV​(List<String> values,
                                    String valueSeparator)
        Internal method to create a CSV formatted String joining a given set of elements
        Parameters:
        values - The values to create the string from
        valueSeparator - value separator
        Returns:
        The line as a CSV formatted String