Package org.dspace.app.bulkedit
Class DSpaceCSVLine
- java.lang.Object
-
- 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
-
-
Field Summary
Fields Modifier and Type Field Description protected AuthorityValueServiceauthorityValueService
-
Constructor Summary
Constructors Constructor Description DSpaceCSVLine()Create a new CSV line for a new itemDSpaceCSVLine(UUID itemId)Create a new CSV line
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(String key, String value)Add a new metadata value to this lineList<String>get(String key)Get all the values that match the given metadata key.StringgetAction()Get any action associated with this lineUUIDgetID()Get the item ID that this line representsSet<String>keys()Get all the metadata keys that are represented in this lineprotected StringtoCSV(List<String> headings, String fieldSeparator, String valueSeparator)Write this line out as a CSV formatted string, in the order given by the headings providedprotected StringvalueToCSV(List<String> values, String valueSeparator)Internal method to create a CSV formatted String joining a given set of elements
-
-
-
Field Detail
-
authorityValueService
protected final transient AuthorityValueService authorityValueService
-
-
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 infieldSeparator- separator between metadata fieldsvalueSeparator- separator between metadata values (within a field)- Returns:
- The CSV formatted String
-
-