org.dspace.authority.README.md Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dspace-api Show documentation
Show all versions of dspace-api Show documentation
DSpace core data model and service APIs.
# How to reuse this functionality for other metadata fields.
Let's say dc.relation.ispartofseries is a *onebox* input field labeled 'Journals' in the submission and needs to have an authority look-up just like dc.contributor.author.
Additionally the journal document should contain:
* journal title: mandatory, not repeatable
* ISSN: optional, repeatable
* Publisher: optional, not repeatable
* an internal ID
## Add the authority controlled metadata field to dspace.cfg
```
choices.plugin.dc.relation.ispartofseries = SolrAuthorAuthority
choices.presentation.dc.relation.ispartofseries = lookup
authority.controlled.dc.relation.ispartofseries = true
authority.author.indexer.field.1=dc.contributor.author
authority.author.indexer.field.2=dc.relation.ispartofseries
```
## Add the desired properties of the new authority type in the solr schema
solr/authority/conf/schema.xml
```
```
The title and the internal ID find their places in the already existing "value" and "id" fields.
## Extend org.dspace.authority.AuthorityValue, add the fields and implement the methods
```
public class JournalAuthorityValue extends AuthorityValue {
protected String publisher;
protected List ISSN = new ArrayList();
```
Since the journal title is to be stored as the record's value no specific instance variable is needed, **AuthorityValue** already provides this. The internal ID is also taken care of in the superclass.
Override **getSolrInputDocument()** and **setValues(SolrDocument document)** to control what is stored in the solr document.
```
@Override
public SolrInputDocument getSolrInputDocument() {
SolrInputDocument doc = super.getSolrInputDocument();
doc.addField("publisher", getPublisher());
for (String issn : ISSN) {
doc.addField("ISSN", issn);
}
return doc;
}
@Override
public void setValues(SolrDocument document) {
super.setValues(document);
Object publisher = document.getFieldValue("publisher");
if (publisher != null) {
setPublisher(publisher.toString());
}
Collection
© 2015 - 2024 Weber Informatics LLC | Privacy Policy