eu.etaxonomy.cdm.database
Class PersistentTermInitializer
java.lang.Object
eu.etaxonomy.cdm.model.common.DefaultTermInitializer
eu.etaxonomy.cdm.database.PersistentTermInitializer
- All Implemented Interfaces:
- ITermInitializer
@Component
public class PersistentTermInitializer
- extends DefaultTermInitializer
Spring bean class to initialize the IVocabularyStore.
To initialize the store the TermLoader and the IVocabularyStore
are injected via spring and the initializeTerms method is called as an init-method (@PostConstruct).
- Author:
- a.mueller
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
vocabularyDao
protected ITermVocabularyDao vocabularyDao
transactionManager
protected org.springframework.transaction.PlatformTransactionManager transactionManager
txDefinition
protected org.springframework.transaction.support.DefaultTransactionDefinition txDefinition
PersistentTermInitializer
public PersistentTermInitializer()
setOmit
public void setOmit(boolean omit)
isOmit
public boolean isOmit()
setVocabularyDao
@Autowired
public void setVocabularyDao(ITermVocabularyDao vocabularyDao)
setTransactionManager
@Autowired
public void setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager)
initialize
@PostConstruct
public void initialize()
- Description copied from interface:
ITermInitializer
- Initializes the IVocabularStore by making sure that all basic terms that are
loaded by the TermLoader are available afterwards.
ATTENTION: Be aware that TermLoader indirectly calls getTermByUuid(uuid)
for the default language. So make sure that before loading the Terms by the
TermLoader getTermByUuid() returns a valid Object without going to endless recursion.
- Specified by:
initialize in interface ITermInitializer- Overrides:
initialize in class DefaultTermInitializer
doInitialize
public void doInitialize()
- Overrides:
doInitialize in class DefaultTermInitializer
secondPass
protected void secondPass(Class clazz,
UUID vocabularyUuid,
Map<UUID,DefinedTermBase> terms)
- Initializes the static fields of the
TermVocabulary classes.
- Parameters:
clazz - the Class of the vocabularyvocabularyUuid - the UUID of the vocabularyterms - a Map containing all already
loaded terms with their UUID as key
firstPass
public UUID firstPass(VocabularyEnum vocabularyType,
Map<UUID,DefinedTermBase> persistedTerms)
- This method loads the vocabularies from CSV files and compares them to the vocabularies
already in database. Non-existing vocabularies will be created and vocabularies with missing
terms will be updated.
- Parameters:
clazz - the Class of the vocabularypersistedTerms - a Map containing all already
loaded terms with their UUID as key
- Returns:
- the
UUID of the loaded vocabulary as found in CSV file
Copyright © 2007-2013 EDIT. All Rights Reserved.