Revision 9dc896c9
Added by Andreas Müller almost 7 years ago
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/lsid/impl/LsidRegistryImpl.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* Copyright (C) 2009 EDIT |
3 |
* European Distributed Institute of Taxonomy
|
|
3 |
* European Distributed Institute of Taxonomy |
|
4 | 4 |
* http://www.e-taxonomy.eu |
5 |
*
|
|
5 |
* |
|
6 | 6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
7 | 7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
8 | 8 |
*/ |
... | ... | |
35 | 35 |
public class LsidRegistryImpl implements LSIDRegistry { |
36 | 36 |
private static Log log = LogFactory.getLog(LsidRegistryImpl.class); |
37 | 37 |
// the main registry, stores all pattern mappings. |
38 |
private Map<String,IIdentifiableDao<? extends IdentifiableEntity>> registry = new HashMap<String,IIdentifiableDao<? extends IdentifiableEntity>>();
|
|
39 |
|
|
38 |
private Map<String,IIdentifiableDao<? extends IdentifiableEntity>> registry = new HashMap<>(); |
|
39 |
|
|
40 | 40 |
private Set<IIdentifiableDao> identifiableDaos; |
41 |
|
|
41 |
|
|
42 | 42 |
private ILsidAuthorityDao lsidAuthorityDao; |
43 |
|
|
43 |
|
|
44 | 44 |
protected PlatformTransactionManager transactionManager; |
45 |
|
|
45 |
|
|
46 | 46 |
protected DefaultTransactionDefinition txDefinition = new DefaultTransactionDefinition(); |
47 |
|
|
47 |
|
|
48 | 48 |
@Autowired |
49 | 49 |
public void setIdentifiableDaos(Set<IIdentifiableDao> identifiableDaos) { |
50 | 50 |
this.identifiableDaos = identifiableDaos; |
51 | 51 |
} |
52 |
|
|
52 |
|
|
53 | 53 |
@Autowired |
54 | 54 |
public void setLsidAuthorityDao(ILsidAuthorityDao lsidAuthorityDao) { |
55 | 55 |
this.lsidAuthorityDao = lsidAuthorityDao; |
56 | 56 |
} |
57 |
|
|
57 |
|
|
58 | 58 |
@Autowired |
59 | 59 |
public void setTransactionManager(PlatformTransactionManager transactionManager) { |
60 | 60 |
this.transactionManager = transactionManager; |
61 | 61 |
} |
62 |
|
|
62 |
|
|
63 | 63 |
@PostConstruct |
64 | 64 |
public void init() { |
65 | 65 |
registry = new HashMap<String,IIdentifiableDao<? extends IdentifiableEntity>>(); |
... | ... | |
75 | 75 |
break; |
76 | 76 |
} |
77 | 77 |
} |
78 |
|
|
78 |
|
|
79 | 79 |
if(!foundDao) { |
80 | 80 |
log.warn("Did not find DAO serving classes of type " + clazz + " for authority " + lsidAuthority.getAuthority() + " with namespace " + namespace); |
81 | 81 |
} |
82 | 82 |
} |
83 | 83 |
} |
84 |
|
|
84 |
|
|
85 | 85 |
transactionManager.commit(txStatus); |
86 | 86 |
} |
87 | 87 |
|
88 |
public IIdentifiableDao<? extends IdentifiableEntity> lookupDAO(LSID lsid) { |
|
88 |
@Override |
|
89 |
public IIdentifiableDao<? extends IdentifiableEntity> lookupDAO(LSID lsid) { |
|
89 | 90 |
// if the LSID is null, then we return whatever is registered with the no lsid pattern |
90 |
|
|
91 |
|
|
91 | 92 |
if (lsid == null) { |
92 | 93 |
IIdentifiableDao<? extends IdentifiableEntity> identifiableDAO = registry.get(Pattern.NO_LSID_PATTERN.toString()); |
93 | 94 |
return identifiableDAO; |
94 | 95 |
} |
95 |
|
|
96 |
|
|
96 | 97 |
Pattern lookup = new Pattern(); |
97 | 98 |
lookup.setAuthority(lsid.getAuthority().toString()); |
98 | 99 |
lookup.setNamespace(lsid.getNamespace()); |
99 |
|
|
100 |
IIdentifiableDao<? extends IdentifiableEntity> identifiableDAO = registry.get(lookup.toString());
|
|
100 |
|
|
101 |
IIdentifiableDao<? extends IdentifiableEntity> identifiableDAO = registry.get(lookup.toString()); |
|
101 | 102 |
if (identifiableDAO != null) { |
102 | 103 |
log.info("Found DAO " + identifiableDAO.getClass().getSimpleName()); |
103 | 104 |
return identifiableDAO; |
Also available in: Unified diff
fix #6368 rename table and class TaxonNameBase