The Item Template functionalities permits to define a metadata "template" for each DSpace Collection to apply when the DSpace Item will be created in its container. The Item Template, from the side of object model, it is an Item. To create a new Item Template the user can add one from DSpace Collection admin web page. This functionality in DSpace has used to build a default values for a certain metadata, by the way after "template" metadata generation, all metadata con be modified during submission. The improvement in DSpace-CRIS consists to add a mechanism to retrieve these "template" metadata from other sources built at runtime. When the DSpace Item is built using import from biblio external database (like Crossref, Pubmed...), the manager of repository can choose to apply or not the functionality using configuration provided at dspace.cfg
#If you want apply the item template after the lookup in dataproviders #bte.applytemplateitem = true |
take in mind that "template" item generations override the metadata extract during lookup.
Out-of-the-box DSpace-CRIS have five generator strategy metadata.
Add information retrieved on submitter. Configuring the special string ###submitter.[metadata]### the system will retrieve the request "metadata" from the current submitter. The first part of the rule submitter is used to to retrieve this generator from DSpaceTemplateItemService (see bean definition below)
Example:
###submitter[email]### → retrieving the email metadata of the submitter |
Based on SubmitterValueGenerator, permits to retrieve DSpace EPerson identifier. The first part of the rule eperson is used to to retrieve this generator from DSpaceTemplateItemService (see bean definition below).
To add this strategy the special strings to be define are the follow:
The value obtained from the above rules is sent to the EPerson.findByEmail, if the DSpace EPerson has been found then the metadata generating by this template will be contains the DSpace EPerson identifier founded.
Like the EPersonValueGenerator, but permits to retrieve a DSpace Group identifier. The first part of the rule group is used to to retrieve this generator from DSpaceTemplateItemService (see bean definition below).
To add this strategy the special strings to be define are the follow:
The value obtained from the above rules is sent to the Group.findByName, if the DSpace Group has been found then the metadata generating by this template will be contains the DSpace Group identifier.
Permits to add the start submission date (NOW) or for parsing "math" to the NOW date (see https://lucene.apache.org/solr/4_10_2/solr-core/org/apache/ solr/util/DateMathParser.html). The first part of the rule date is used to to retrieve this generator from DSpaceTemplateItemService (see bean definition below).
To add this strategy the special strings to be define are the follow:
###date.-1YEARS.YYYY-MM-DD### → for example if start submission date is 31 January 2018 the filled metadata will be "2017-01-31" |
Permits to generate the DSpace Item identifier
###identifier### retrieve the identifier of the behind DSpace Item of the current submission
public class DSpaceTemplateItemService implements TemplateItemService { private Map<String, TemplateValueGenerator> generators; public void applyTemplate(Context context, Item targetItem, Item templateItem); ... } |
applyTemplate contains the logic to apply the template to the new DSpace Item, instead the property generators is a map that contains the strategy to perform:
<bean id="org.dspace.content.service.TemplateItemService" class="org.dspace.content.service.DSpaceTemplateItemService" scope="singleton"> <property name="generators"> <map> <entry key="submitter"> <bean class="org.dspace.content.generator.SubmitterValueGenerator" /> </entry> <entry key="date"> <bean class="org.dspace.content.generator.DateValueGenerator" /> </entry> <entry key="identifier"> <bean class="org.dspace.content.generator.IdentifierValueGenerator" /> </entry> <entry key="group"> <bean class="org.dspace.content.generator.GroupValueGenerator" /> </entry> <entry key="eperson"> <bean class="org.dspace.content.generator.EPersonValueGenerator" /> </entry> </map> </property> </bean> |
If you want add yours, this is the place to mantains the mapping after develop the own logic for a new generators.