Package org.alfresco.repo.domain.qname
Class AbstractQNameDAOImpl
java.lang.Object
org.alfresco.repo.domain.qname.AbstractQNameDAOImpl
- All Implemented Interfaces:
QNameDAO
- Direct Known Subclasses:
QNameDAOImpl
Abstract implementation of the QName and Namespace DAO interface.
- Since:
- 3.4
- Author:
- Derek Hulley
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconvertIdMapToQNameMap(Map<Long, ? extends Object> idMap) Convenience method to convert map keys from QName IDs to QNamesconvertIdsToQNames(Set<Long> ids) Bulk-convert QName IDs into QNamesconvertQNamesToIds(Set<QName> qnames, boolean create) Bulk-convert QNames into QName IDs.protected abstract NamespaceEntityprotected abstract QNameEntitycreateQNameEntity(Long nsId, String localName) voiddeleteQName(QName qname) Delete a QName.protected abstract intdeleteQNameEntity(QNameEntity entity) protected abstract NamespaceEntityprotected abstract NamespaceEntityprotected abstract QNameEntityprotected abstract QNameEntityfindQNameEntityByNamespaceAndLocalName(Long nsId, String localName) getNamespace(Long id) getNamespace(String namespaceUri) getOrCreateNamespace(String namespaceUri) Get an existing instance matching the URI or create one if necessary.getOrCreateQName(QName qname) Get an existing instance matching the QName or create one if necessary.voidsetNamespaceCache(SimpleCache<Long, String> namespaceCache) Set the cache that maintains the ID-Namespace mappings and vice-versa.voidsetQnameCache(SimpleCache<Long, QName> qnameCache) Set the cache that maintains the ID-Namespace mappings and vice-versa.voidupdateNamespace(String oldNamespaceUri, String newNamespaceUri) Modifies an existing namespace URI.protected abstract intupdateNamespaceEntity(NamespaceEntity entity, String uri) updateQName(QName qnameOld, QName qnameNew) Modify an existing QName.protected abstract intupdateQNameEntity(QNameEntity entity, Long nsId, String localName)
-
Constructor Details
-
AbstractQNameDAOImpl
protected AbstractQNameDAOImpl()Default constructor.This sets up the DAO accessors to bypass any caching to handle the case where the caches are not supplied in the setters.
-
-
Method Details
-
setNamespaceCache
Set the cache that maintains the ID-Namespace mappings and vice-versa.- Parameters:
namespaceCache- the cache
-
setQnameCache
Set the cache that maintains the ID-Namespace mappings and vice-versa.- Parameters:
qnameCache- the cache
-
getNamespace
- Specified by:
getNamespacein interfaceQNameDAO- Parameters:
id- the unique ID of the entity- Returns:
- the namespace pair (id, uri)
-
getNamespace
- Specified by:
getNamespacein interfaceQNameDAO- Parameters:
namespaceUri- the namespace URI to query for- Returns:
- the namespace pair (id, uri) or null if it doesn't exist
-
getOrCreateNamespace
Description copied from interface:QNameDAOGet an existing instance matching the URI or create one if necessary. Note that this method should be treated as a write method and should not be used in the context of read-only or query methods.- Specified by:
getOrCreateNamespacein interfaceQNameDAO- Parameters:
namespaceUri- the namespace URI to create- Returns:
- the existing namespace pair (id, uri) or a new one
-
updateNamespace
Description copied from interface:QNameDAOModifies an existing namespace URI. If the new URI already exists, then no new entity is created.- Specified by:
updateNamespacein interfaceQNameDAO- Parameters:
oldNamespaceUri- the old namespace URInewNamespaceUri- the new namespace URI
-
findNamespaceEntityById
-
findNamespaceEntityByUri
-
createNamespaceEntity
-
updateNamespaceEntity
-
getQName
-
getQName
-
getOrCreateQName
Description copied from interface:QNameDAOGet an existing instance matching the QName or create one if necessary. Note that this method should be treated as a write method and should not be used in the context of read-only or query methods.- Specified by:
getOrCreateQNamein interfaceQNameDAO- Parameters:
qname- the QName to query for- Returns:
- the QName pair (id, qname) or a new one
-
updateQName
Description copied from interface:QNameDAOModify an existing QName. The ID of the new QName will be the same as the old one i.e. the old QName will cease to exist and will become the new QName. This allows QName modification without affecting tables that reference the old QName.- Specified by:
updateQNamein interfaceQNameDAO- Parameters:
qnameOld- the old QName, which must existqnameNew- the new QName, which must not exist- Returns:
- the QName pair (id, qname) with the ID unchanged from old to new
-
deleteQName
Description copied from interface:QNameDAODelete a QName. This will work only if the QName is not in use e.g. by nodes, properties, etc- Specified by:
deleteQNamein interfaceQNameDAO
-
findQNameEntityById
-
findQNameEntityByNamespaceAndLocalName
-
createQNameEntity
-
updateQNameEntity
-
deleteQNameEntity
-
convertIdsToQNames
Description copied from interface:QNameDAOBulk-convert QName IDs into QNames- Specified by:
convertIdsToQNamesin interfaceQNameDAO- Parameters:
ids- the IDs- Returns:
- the QNames for the IDs given, in the same order
-
convertIdMapToQNameMap
Description copied from interface:QNameDAOConvenience method to convert map keys from QName IDs to QNames- Specified by:
convertIdMapToQNameMapin interfaceQNameDAO- Parameters:
idMap- a map of objects keyed by QName ID- Returns:
- a map of the same objects keyed by the equivalent QNames
-
convertQNamesToIds
Description copied from interface:QNameDAOBulk-convert QNames into QName IDs. This is primarily used for generating SQL IN clause lists for other DAO queries.- Specified by:
convertQNamesToIdsin interfaceQNameDAO- Parameters:
qnames- the QNames to convertcreate- true to create any missing QName entities- Returns:
- Returns a set of IDs mapping to the QNames provided. If create is false then there will not be corresponding entries for the QNames that don't exist. So there is no guarantee that the returned set will be ordered the same or even contain the same number of elements as the original unless create is true.
-