* @param termsa <code>Map</code> containing all already \r
* loaded terms with their <code>UUID</code> as key\r
*/\r
- protected void secondPass(Class clazz, UUID vocabularyUuid,Map<UUID,DefinedTermBase> terms) {\r
+ protected void secondPass(Class clazz, UUID vocabularyUuid, Map<UUID,DefinedTermBase> terms) {\r
logger.info("Loading vocabulary for class " + clazz.getSimpleName() + " with uuid " + vocabularyUuid );\r
\r
TermVocabulary persistedVocabulary = vocabularyDao.findByUuid(vocabularyUuid);\r
\r
- for(Object obj : persistedVocabulary.getTerms()) {\r
- DefinedTermBase d = (DefinedTermBase)obj;\r
- Hibernate.initialize(d.getRepresentations());\r
- terms.put(d.getUuid(), d); \r
+ if (persistedVocabulary != null){\r
+ for(Object obj : persistedVocabulary.getTerms()) {\r
+ DefinedTermBase d = (DefinedTermBase)obj;\r
+ Hibernate.initialize(d.getRepresentations());\r
+ terms.put(d.getUuid(), d); \r
+ }\r
+ }else{\r
+ logger.error("Persisted Vocabulary does not exist in database: " + vocabularyUuid);\r
+ throw new NullPointerException("Persisted Vocabulary does not exist in database: " + vocabularyUuid);\r
}\r
- \r
logger.debug("Setting defined Terms for class " + clazz.getSimpleName());\r
super.setDefinedTerms(clazz, persistedVocabulary);\r
}\r