Page tree
Skip to end of metadata
Go to start of metadata

Item Template and its configurations

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

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.

DSpace-CRIS Template Generator

Out-of-the-box DSpace-CRIS have five generator strategy metadata.

SubmitterValueGenerator

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

EPersonValueGenerator

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:

  1. ###eperson.submitter[metadata]###          where metadata is retrieved from the current submitter
  2. ###eperson.item_metadataenhancer###   where "item_metadataenhancer" runs the enhancer mechanism (<metadataenhancer> is the qualifier of the item metadata enhancer see https://wiki.duraspace.org/pages/viewpage.action?pageId=78153687#Browse&Search-ItemEnhancer:virtualmetadata)

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.

GroupValueGenerator

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:

  1. ###group.community[metadata]###          to retrieve value from the DSpace Community field of the DSpace Item e.g. "group.community[title]"
  2. ###group.collection[metadata]###            to retrieve value from the DSpace Community field of the DSpace Item e.g. "group.collection[title]"
  3. ###group.item_metadataenhancer###      where "item_metadataenhancer" runs the enhancer mechanism (<metadataenhancer> is the qualifier of the item metadata enhancer see https://wiki.duraspace.org/pages/viewpage.action?pageId=78153687#Browse&Search-ItemEnhancer:virtualmetadata)

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.

DateValueGenerator

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:

  1. ###date.format###        using format to formatting and parsing dates in a locale-sensitive manner
  2. ###date.operation.format###   operation is one of operations permits by DateMathParser


###date.-1YEARS.YYYY-MM-DD### → for example if start submission date is 31 January 2018 the filled metadata will be "2017-01-31"

IdentifierValueGenerator

Permits to generate the DSpace Item identifier

###identifier###         retrieve the identifier of the behind DSpace Item of the current submission

The bean service and its definition

TemplateValueGenerator
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:

spring-dspace-core-services.xml
<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.

  • No labels