org.dspace.app.bulkedit
Class DSpaceCSVLine

java.lang.Object
  extended by org.dspace.app.bulkedit.DSpaceCSVLine

public class DSpaceCSVLine
extends Object

Utility class to store a line from a CSV file

Author:
Stuart Lewis

Constructor Summary
DSpaceCSVLine()
          Create a new CSV line for a new item
DSpaceCSVLine(int id)
          Create a new CSV line
 
Method Summary
 void add(String key, String value)
          Add a new metadata value to this line
 ArrayList<String> get(String key)
          Get all the values that match the given metadata key.
 int getID()
          Get the item ID that this line represents
 Enumeration<String> keys()
          Get all the metadata keys that are represented in this line
protected  String toCSV(ArrayList<String> headings)
          Write this line out as a CSV formatted string, in the order given by the headings provided
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DSpaceCSVLine

public DSpaceCSVLine(int id)
Create a new CSV line

Parameters:
id - The item ID of the line

DSpaceCSVLine

public DSpaceCSVLine()
Create a new CSV line for a new item

Method Detail

getID

public int 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 ArrayList<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

keys

public Enumeration<String> keys()
Get all the metadata keys that are represented in this line

Returns:
An enumeration of all the keys

toCSV

protected String toCSV(ArrayList<String> headings)
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
Returns:
The CSV formatted String


Copyright © 2010 DuraSpace. All Rights Reserved.