mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Added QNameDAO.updateNamespaceEntity and related tests
- To use directly, get the 'qnameDAO' bean; it implements the QNameDAO interface. - The new namespace must not exist - No reindexing is done git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@11002 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -116,6 +116,28 @@ public class HibernateQNameDAOImpl extends HibernateDaoSupport implements QNameD
|
||||
return namespace;
|
||||
}
|
||||
|
||||
public void updateNamespaceEntity(String oldNamespaceUri, String newNamespaceUri)
|
||||
{
|
||||
// First check for clashes
|
||||
if (getNamespaceEntity(newNamespaceUri) != null)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Namespace URI '" + newNamespaceUri + "' already exists.");
|
||||
}
|
||||
// Get the old one
|
||||
NamespaceEntity oldNamespaceEntity = getNamespaceEntity(oldNamespaceUri);
|
||||
if (oldNamespaceEntity == null)
|
||||
{
|
||||
// Nothing to rename
|
||||
return;
|
||||
}
|
||||
oldNamespaceEntity.setUri(newNamespaceUri);
|
||||
// Flush to force early failure
|
||||
getSession().flush();
|
||||
// Trash the cache
|
||||
qnameEntityCache.clear();
|
||||
// Done
|
||||
}
|
||||
|
||||
public QNameEntity getQNameEntity(Long id)
|
||||
{
|
||||
QNameEntity qnameEntity = (QNameEntity) getSession().get(QNameEntityImpl.class, id);
|
||||
|
Reference in New Issue
Block a user