public class MetadataUtilities extends Object
| Modifier and Type | Field and Description |
|---|---|
protected static ItemService |
itemService |
| Constructor and Description |
|---|
MetadataUtilities() |
| Modifier and Type | Method and Description |
|---|---|
static void |
appendMetadata(Context context,
Item item,
org.dspace.app.itemupdate.DtoMetadata dtom,
boolean isLanguageStrict,
String textToAppend)
Append text to value metadata field to item
|
static boolean |
deleteMetadataByValue(Context context,
Item item,
org.dspace.app.itemupdate.DtoMetadata dtom,
boolean isLanguageStrict)
Working around Item API to delete a value-specific Metadatum
For a given element/qualifier/lang:
get all DCValues
clear (i.e.
|
static String |
getCompoundForm(String schema,
String element,
String qualifier)
Return compound form of a metadata field (i.e.
|
static String |
getDCValueString(MetadataValue dcv)
Get display of Metadatum
|
static List<org.dspace.app.itemupdate.DtoMetadata> |
loadDublinCore(DocumentBuilder docBuilder,
InputStream is)
Modification of method from ItemImporter.loadDublinCore
as a Factory method
|
static String[] |
parseCompoundForm(String compoundForm)
Parses metadata field given in the form
<schema>.<element>[.<qualifier>|.*]
checks for correct number of elements (2 or 3) and for empty strings |
static List<ContentsEntry> |
readContentsFile(File f)
Rewrite of ItemImport's functionality
but just the parsing of the file, not the processing of its elements.
|
static List<String> |
readDeleteContentsFile(File f) |
static void |
writeDocument(Document doc,
Transformer transformer,
OutputStream out)
write xml document to output stream
|
static Document |
writeDublinCore(DocumentBuilder docBuilder,
List<org.dspace.app.itemupdate.DtoMetadata> dtomList)
Write dublin_core.xml
|
protected static final ItemService itemService
public static boolean deleteMetadataByValue(Context context, Item item, org.dspace.app.itemupdate.DtoMetadata dtom, boolean isLanguageStrict) throws SQLException
context - DSpace Contextitem - Item Objectdtom - metadata fieldisLanguageStrict - whether strict or notSQLException - if database errorpublic static void appendMetadata(Context context, Item item, org.dspace.app.itemupdate.DtoMetadata dtom, boolean isLanguageStrict, String textToAppend) throws IllegalArgumentException, SQLException
context - DSpace Contextitem - DSpace Itemdtom - metadata fieldisLanguageStrict - if stricttextToAppend - text to appendIllegalArgumentException - - When target metadata field is not foundSQLException - if database errorpublic static List<org.dspace.app.itemupdate.DtoMetadata> loadDublinCore(DocumentBuilder docBuilder, InputStream is) throws SQLException, IOException, ParserConfigurationException, SAXException, TransformerException, AuthorizeException
docBuilder - DocumentBuilderis - - InputStream of dublin_core.xmlSQLException - if database errorIOException - if IO errorParserConfigurationException - if parser config errorSAXException - if XML errorTransformerException - if transformer errorAuthorizeException - if authorization errorpublic static Document writeDublinCore(DocumentBuilder docBuilder, List<org.dspace.app.itemupdate.DtoMetadata> dtomList) throws ParserConfigurationException, TransformerConfigurationException, TransformerException
docBuilder - DocumentBuilderdtomList - List of metadata fieldsParserConfigurationException - if parser config errorTransformerConfigurationException - if transformer config errorTransformerException - if transformer errorpublic static void writeDocument(Document doc, Transformer transformer, OutputStream out) throws IOException, TransformerException
doc - XML Documenttransformer - XML Transformerout - OutputStreamIOException - if IO ErrorTransformerException - if Transformer errorpublic static List<ContentsEntry> readContentsFile(File f) throws FileNotFoundException, IOException, ParseException
f - fileFileNotFoundException - if file doesn't existIOException - if IO errorParseException - if parse errorpublic static List<String> readDeleteContentsFile(File f) throws FileNotFoundException, IOException
f - fileFileNotFoundException - if file doesn't existIOException - if IO Errorpublic static String getDCValueString(MetadataValue dcv)
dcv - MetadataValuepublic static String getCompoundForm(String schema, String element, String qualifier)
schema - schemaelement - elementqualifier - qualifierpublic static String[] parseCompoundForm(String compoundForm) throws ParseException
<schema>.<element>[.<qualifier>|.*]
checks for correct number of elements (2 or 3) and for empty stringscompoundForm - compound form of metadata fieldParseException - if validity checks failCopyright © 2022 LYRASIS. All rights reserved.