Package org.mycore.pi
Class MCRGenericPIGenerator
MCR.PI.Generator.myGenerator=org.mycore.pi.urn.MCRGenericPIGenerator
Set a generic pattern.
MCR.PI.Generator.myGenerator.GeneralPattern=urn:nbn:de:gbv:$CurrentDate-$1-$2-$ObjectType-$ObjectProject-$ObjectNumber-$Count-
MCR.PI.Generator.myGenerator.GeneralPattern=urn:nbn:de:gbv:$ObjectDate-$ObjectType-$Count
MCR.PI.Generator.myGenerator.GeneralPattern=urn:nbn:de:gbv:$ObjectDate-$Count
MCR.PI.Generator.myGenerator.GeneralPattern=urn:nbn:de:gbv:$ObjectType-$Count
MCR.PI.Generator.myGenerator.GeneralPattern=urn:nbn:de:gbv:$0-$1-$Count
Set a optional DateFormat, if not set the ddMMyyyy is just used as value. (SimpleDateFormat)
MCR.PI.Generator.myGenerator.DateFormat=ddMMyyyy
Set a optional ObjectType mapping, if not set the ObjectType is just used as value
MCR.PI.Generator.myGenerator.TypeMapping=document:doc,disshab:diss,Thesis:Thesis,bundle:doc,mods:test
You can also map the projectid
Set a optional Count precision, if not set or set to -1 the pure number is used (1,2,.., 999).
Count always relativ to type and date.
MCR.PI.Generator.myGenerator.CountPrecision=3 # will produce 001, 002, ... , 999
Set the Type of the generated pi.
MCR.PI.Generator.myGenerator.Type=dnbURN
Set the Xpaths
MCR.PI.Generator.myGenerator.XPath.1=/mycoreobject/metadata/def.shelf/shelf/
MCR.PI.Generator.myGenerator.XPath.2=/mycoreobject/metadata/def.path2/path2/
- Author:
- Sebastian Hofmann
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongenerates aMCRPersistentIdentifier
final int
Gets the count for a specific pattern and increase the internal counter.int
void
protected AtomicInteger
readCountFromDatabase
(String countPattern) void
setCountPrecision
(int countPrecision) void
setDateFormat
(SimpleDateFormat dateFormat) void
setGeneralPattern
(String generalPattern) void
setObjectProjectMapping
(String objectProjectMapping) void
setObjectTypeMapping
(String typeMapping) void
Methods inherited from class org.mycore.pi.MCRPIGenerator
checkPropertyExists, getGeneratorID, getProperties, setProperties
-
Constructor Details
-
MCRGenericPIGenerator
public MCRGenericPIGenerator()
-
-
Method Details
-
init
- Overrides:
init
in classMCRPIGenerator<MCRPersistentIdentifier>
-
generate
public MCRPersistentIdentifier generate(MCRBase mcrBase, String additional) throws MCRPersistentIdentifierException Description copied from class:MCRPIGenerator
generates aMCRPersistentIdentifier
- Specified by:
generate
in classMCRPIGenerator<MCRPersistentIdentifier>
- Parameters:
mcrBase
- the mycore object for which the identifier is generatedadditional
- additional information dedicated to the object like a mcrpath- Returns:
- a unique persistence identifier
- Throws:
MCRPersistentIdentifierException
- if something goes wrong while generating
-
readCountFromDatabase
-
setType
-
getGeneralPattern
-
setGeneralPattern
-
getDateFormat
-
setDateFormat
-
getObjectTypeMapping
-
setObjectTypeMapping
-
getCountPrecision
public int getCountPrecision() -
setCountPrecision
public void setCountPrecision(int countPrecision) -
getCount
Gets the count for a specific pattern and increase the internal counter. If there is no internal counter it will look into the Database and detect the highest count with the pattern.- Parameters:
pattern
- a reg exp pattern which will be used to detect the highest count. The first group is the count. e.G. [0-9]+-mods-2017-([0-9][0-9][0-9][0-9])-[0-9] will match 31-mods-2017-0003-3 and the returned count will be 4 (3+1).- Returns:
- the next count
-
getObjectProjectMapping
-
setObjectProjectMapping
-