org.dspace.app.bulkedit
Class DSpaceCSVLine

java.lang.Object
  extended by org.dspace.app.bulkedit.DSpaceCSVLine
All Implemented Interfaces:
Serializable

public class DSpaceCSVLine
extends Object
implements Serializable

Utility class to store a line from a CSV file

Author:
Stuart Lewis
See Also:
Serialized Form

Constructor Summary
DSpaceCSVLine()
          Create a new CSV line for a new item
DSpaceCSVLine(int itemId)
          Create a new CSV line
 
Method Summary
 void add(String key, String value)
          Add a new metadata value to this line
 List<String> get(String key)
          Get all the values that match the given metadata key.
 String getAction()
          Get any action associated with this line
 int getID()
          Get the item ID that this line represents
 Set<String> keys()
          Get all the metadata keys that are represented in this line
protected  String toCSV(List<String> headings)
          Write this line out as a CSV formatted string, in the order given by the headings provided
protected  String valueToCSV(List<String> values)
          Internal method to create a CSV formatted String joining a given set of elements
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DSpaceCSVLine

public DSpaceCSVLine(int 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 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 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)
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

valueToCSV

protected String valueToCSV(List<String> values)
Internal method to create a CSV formatted String joining a given set of elements

Parameters:
values - The values to create the string from
Returns:
The line as a CSV formatted String


Copyright © 2011 DuraSpace. All Rights Reserved.