org.alfresco.repo.domain.qname
Interface QNameDAO

All Known Implementing Classes:
AbstractQNameDAOImpl, QNameDAOImpl

public interface QNameDAO

Data abstraction layer for QName and Namespace entities.

Since:
3.4

Method Summary
 java.util.Map convertIdMapToQNameMap(java.util.Map idMap)
          Convenience method to convert map keys from QName IDs to QNames
 java.util.Set convertIdsToQNames(java.util.Set ids)
          Bulk-convert QName IDs into QNames
 java.util.Set convertQNamesToIds(java.util.Set qnames, boolean create)
          Bulk-convert QNames into QName IDs.
 org.alfresco.util.Pair getNamespace(java.lang.Long id)
           
 org.alfresco.util.Pair getNamespace(java.lang.String namespaceUri)
           
 org.alfresco.util.Pair getOrCreateNamespace(java.lang.String namespaceUri)
          Get an existing instance matching the URI or create one if necessary.
 org.alfresco.util.Pair getOrCreateQName(org.alfresco.service.namespace.QName qname)
          Get an existing instance matching the QName or create one if necessary.
 org.alfresco.util.Pair getQName(java.lang.Long id)
           
 org.alfresco.util.Pair getQName(org.alfresco.service.namespace.QName qname)
           
 void updateNamespace(java.lang.String oldNamespaceUri, java.lang.String newNamespaceUri)
          Modifies an existing namespace URI.
 org.alfresco.util.Pair updateQName(org.alfresco.service.namespace.QName qnameOld, org.alfresco.service.namespace.QName qnameNew)
          Modify an existing QName.
 

Method Detail

getNamespace

org.alfresco.util.Pair getNamespace(java.lang.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

org.alfresco.util.Pair getNamespace(java.lang.String namespaceUri)
Parameters:
namespaceUri - the namespace URI to query for
Returns:
the namespace pair (id, uri) or null if it doesn't exist

getOrCreateNamespace

org.alfresco.util.Pair getOrCreateNamespace(java.lang.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(java.lang.String oldNamespaceUri,
                     java.lang.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

org.alfresco.util.Pair getQName(java.lang.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

org.alfresco.util.Pair getQName(org.alfresco.service.namespace.QName qname)
Parameters:
qname - the QName to query for
Returns:
the QName pair (id, qname) or null if it doesn't exist

getOrCreateQName

org.alfresco.util.Pair getOrCreateQName(org.alfresco.service.namespace.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

org.alfresco.util.Pair updateQName(org.alfresco.service.namespace.QName qnameOld,
                                   org.alfresco.service.namespace.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

convertIdsToQNames

java.util.Set convertIdsToQNames(java.util.Set ids)
Bulk-convert QName IDs into QNames

Parameters:
ids - the IDs
Returns:
the QNames for the IDs given, in the same order

convertIdMapToQNameMap

java.util.Map convertIdMapToQNameMap(java.util.Map 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

java.util.Set convertQNamesToIds(java.util.Set 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)


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.