public class MetadataImport extends Object
| Modifier and Type | Field and Description |
|---|---|
protected static String |
AC_PREFIX
The prefix of the authority controlled field
|
protected static Set<String> |
authorityControlled
The authority controlled fields
|
protected AuthorityValueService |
authorityValueService |
protected CollectionService |
collectionService |
protected HandleService |
handleService |
protected InstallItemService |
installItemService |
protected ItemService |
itemService |
protected static org.apache.log4j.Logger |
log
Logger
|
protected WorkspaceItemService |
workspaceItemService |
| Constructor and Description |
|---|
MetadataImport(Context c,
DSpaceCSV toImport)
Create an instance of the metadata importer.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
add(String[] fromCSV,
String md,
BulkEditChange changes)
Add an item metadata with a line from CSV, and optionally update the item
|
protected String |
clean(String in)
Clean elements before comparing
|
protected void |
compare(Item item,
List<String> collections,
List<Collection> actualCollections,
BulkEditChange bechange,
boolean change)
Compare changes between an items owning collection and mapped collections
and what is in the CSV file
|
protected void |
compare(Item item,
String[] fromCSV,
boolean change,
String md,
BulkEditChange changes,
DSpaceCSVLine line)
Compare an item metadata with a line from CSV, and optionally update the item
|
protected boolean |
contains(String needle,
String[] haystack)
Method to find if a String occurs in an array of Strings
|
protected BulkEditMetadataValue |
getBulkEditValueFromCSV(String language,
String schema,
String element,
String qualifier,
String value,
AuthorityValue fromAuthority) |
static void |
main(String[] argv)
main method to run the metadata exporter
|
List<BulkEditChange> |
runImport(boolean change,
boolean useWorkflow,
boolean workflowNotify,
boolean useTemplate)
Run an import.
|
protected void |
simplyCopyValue(String value,
BulkEditMetadataValue dcv) |
protected static Set<String> authorityControlled
protected static final String AC_PREFIX
protected static final org.apache.log4j.Logger log
protected final AuthorityValueService authorityValueService
protected final ItemService itemService
protected final InstallItemService installItemService
protected final CollectionService collectionService
protected final HandleService handleService
protected final WorkspaceItemService workspaceItemService
public List<BulkEditChange> runImport(boolean change, boolean useWorkflow, boolean workflowNotify, boolean useTemplate) throws MetadataImportException
change - Whether or not to write the changes to the databaseuseWorkflow - Whether the workflows should be used when creating new itemsworkflowNotify - If the workflows should be used, whether to send notifications or notuseTemplate - Use collection template if create new itemMetadataImportException - if something goes wrongprotected void compare(Item item, String[] fromCSV, boolean change, String md, BulkEditChange changes, DSpaceCSVLine line) throws SQLException, AuthorizeException
item - The current item metadatafromCSV - The metadata from the CSV filechange - Whether or not to make the updatemd - The element to comparechanges - The changes object to populateline - line in CSV fileSQLException - if there is a problem accessing a Collection from the database, from its handleAuthorizeException - if there is an authorization problem with permissionsprotected void compare(Item item, List<String> collections, List<Collection> actualCollections, BulkEditChange bechange, boolean change) throws SQLException, AuthorizeException, IOException, MetadataImportException
item - The item in questioncollections - The collection handles from the CSV fileactualCollections - The Collections from the actual itembechange - The bulkedit change object for this itemchange - Whether or not to actuate a changeSQLException - if there is a problem accessing a Collection from the database, from its handleAuthorizeException - if there is an authorization problem with permissionsIOException - Can be thrown when moving items in communitiesMetadataImportException - If something goes wrong to be reported back to the userprotected void add(String[] fromCSV, String md, BulkEditChange changes) throws SQLException, AuthorizeException
fromCSV - The metadata from the CSV filemd - The element to comparechanges - The changes object to populateSQLException - when an SQL error has occurred (querying DSpace)AuthorizeException - If the user can't make the changesprotected BulkEditMetadataValue getBulkEditValueFromCSV(String language, String schema, String element, String qualifier, String value, AuthorityValue fromAuthority)
protected void simplyCopyValue(String value, BulkEditMetadataValue dcv)
protected boolean contains(String needle, String[] haystack)
needle - The String to look forhaystack - The array of Strings to search throughprotected String clean(String in)
in - The element to cleanpublic static void main(String[] argv)
argv - the command line arguments givenCopyright © 2017 DuraSpace. All rights reserved.