public class DSpaceCSV extends Object implements Serializable
| Modifier and Type | Field and Description |
|---|---|
protected String |
authoritySeparator
The authority separator (defaults to double colon '::')
|
protected AuthorityValueService |
authorityValueService |
protected int |
counter
A counter of how many CSV lines this object holds
|
protected String |
escapedAuthoritySeparator
The authority separator in an escaped form for using in regexes
|
protected String |
escapedFieldSeparator
The field separator in an escaped form for using in regexes
|
protected String |
escapedValueSeparator
The value separator in an escaped form for using in regexes
|
protected boolean |
exportAll
Whether to export all metadata such as handles and provenance information
|
protected String |
fieldSeparator
The field separator (defaults to comma)
|
protected List<String> |
headings
The headings of the CSV file
|
protected Map<String,String> |
ignore
A list of metadata elements to ignore
|
protected ItemService |
itemService |
protected List<DSpaceCSVLine> |
lines
An array list of CSV lines
|
protected MetadataFieldService |
metadataFieldService |
protected MetadataSchemaService |
metadataSchemaService |
protected String |
valueSeparator
The value separator (defaults to double pipe '||')
|
| Constructor and Description |
|---|
DSpaceCSV(boolean exportAll)
Create a new instance of a CSV line holder
|
DSpaceCSV(File f,
Context c)
Create a new instance, reading the lines in from file
|
| Modifier and Type | Method and Description |
|---|---|
void |
addItem(Item i)
Add a DSpace item to the CSV file
|
void |
addItem(String line)
Add an item to the CSV file, from a CSV line of elements
|
String |
getAuthoritySeparator() |
List<DSpaceCSVLine> |
getCSVLines()
Get the lines in CSV holders
|
String[] |
getCSVLinesAsStringArray()
Get the CSV lines as an array of CSV formatted strings
|
String |
getEscapedAuthoritySeparator() |
List<String> |
getHeadings()
Get the headings used in this CSV file
|
boolean |
hasActions()
Decide if this CSV file has an 'action' (case-dependent!) header.
|
protected void |
init()
Initialise this class with values from dspace.cfg
|
protected boolean |
okToExport(MetadataField md)
Is it Ok to export this value? When exportAll is set to false, we don't export
some of the metadata elements.
|
void |
save(String filename)
Save the CSV file to the given filename
|
String |
toString()
Return the csv file as one long formatted string
|
protected List<DSpaceCSVLine> lines
protected int counter
protected String valueSeparator
protected String escapedValueSeparator
protected String fieldSeparator
protected String escapedFieldSeparator
protected String authoritySeparator
protected String escapedAuthoritySeparator
protected final transient ItemService itemService
protected final transient MetadataSchemaService metadataSchemaService
protected final transient MetadataFieldService metadataFieldService
protected final transient AuthorityValueService authorityValueService
protected boolean exportAll
public DSpaceCSV(boolean exportAll)
exportAll - Whether to export all metadata such as handles and provenance informationprotected void init()
public boolean hasActions()
public final void addItem(Item i) throws Exception
i - The DSpace itemException - if something goes wrong with adding the Itempublic final void addItem(String line) throws Exception
line - The line of elementsException - Thrown if an error occurs when adding the itempublic final List<DSpaceCSVLine> getCSVLines()
public final String[] getCSVLinesAsStringArray()
public final void save(String filename) throws IOException
filename - The filename to save the CSV file toIOException - Thrown if an error occurs when writing the fileprotected boolean okToExport(MetadataField md)
md - The Metadatum to examinepublic List<String> getHeadings()
public final String toString()
public String getAuthoritySeparator()
public String getEscapedAuthoritySeparator()
Copyright © 2016 DuraSpace. All rights reserved.