Interface QNameDAO

All Known Implementing Classes:
AbstractQNameDAOImpl, QNameDAOImpl

public interface QNameDAO
Data abstraction layer for QName and Namespace entities.
Since:
3.4
Author:
Derek Hulley
  • Method Details

    • getNamespace

      Pair<Long,String> getNamespace(Long id)
      Parameters:
      id - the unique ID of the entity
      Returns:
      the namespace pair (id, uri)
      Throws:
      org.alfresco.error.AlfrescoRuntimeException - if the ID provided is invalid
    • getNamespace

      Pair<Long,String> getNamespace(String namespaceUri)
      Parameters:
      namespaceUri - the namespace URI to query for
      Returns:
      the namespace pair (id, uri) or null if it doesn't exist
    • getOrCreateNamespace

      Pair<Long,String> getOrCreateNamespace(String namespaceUri)
      Get 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.
      Parameters:
      namespaceUri - the namespace URI to create
      Returns:
      the existing namespace pair (id, uri) or a new one
    • updateNamespace

      void updateNamespace(String oldNamespaceUri, String newNamespaceUri)
      Modifies an existing namespace URI. If the new URI already exists, then no new entity is created.
      Parameters:
      oldNamespaceUri - the old namespace URI
      newNamespaceUri - the new namespace URI
      Throws:
      org.alfresco.error.AlfrescoRuntimeException - if the new namespace is in use
    • getQName

      Pair<Long,QName> getQName(Long id)
      Parameters:
      id - the unique ID of the entity
      Returns:
      the QName pair (id, qname) (never null)
      Throws:
      org.alfresco.error.AlfrescoRuntimeException - if the ID provided is invalid
    • getQName

      Pair<Long,QName> getQName(QName qname)
      Parameters:
      qname - the QName to query for
      Returns:
      the QName pair (id, qname) or null if it doesn't exist
    • getOrCreateQName

      Pair<Long,QName> getOrCreateQName(QName qname)
      Get 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.
      Parameters:
      qname - the QName to query for
      Returns:
      the QName pair (id, qname) or a new one
    • updateQName

      Pair<Long,QName> updateQName(QName qnameOld, QName qnameNew)
      Modify 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.
      Parameters:
      qnameOld - the old QName, which must exist
      qnameNew - the new QName, which must not exist
      Returns:
      the QName pair (id, qname) with the ID unchanged from old to new
    • deleteQName

      void deleteQName(QName qname)
      Delete a QName. This will work only if the QName is not in use e.g. by nodes, properties, etc
    • convertIdsToQNames

      Set<QName> convertIdsToQNames(Set<Long> ids)
      Bulk-convert QName IDs into QNames
      Parameters:
      ids - the IDs
      Returns:
      the QNames for the IDs given, in the same order
    • convertIdMapToQNameMap

      Map<QName,? extends Object> convertIdMapToQNameMap(Map<Long,? extends Object> idMap)
      Convenience method to convert map keys from QName IDs to QNames
      Parameters:
      idMap - a map of objects keyed by QName ID
      Returns:
      a map of the same objects keyed by the equivalent QNames
    • convertQNamesToIds

      Set<Long> convertQNamesToIds(Set<QName> qnames, boolean create)
      Bulk-convert QNames into QName IDs. This is primarily used for generating SQL IN clause lists for other DAO queries.
      Parameters:
      qnames - the QNames to convert
      create - true to create any missing QName entities
      Returns:
      returns the QName IDs (order not guaranteed)