mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Unit test Suite for DAOs and some extra content clean tests and fallout
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@14838 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -46,10 +46,10 @@ public class ContentDataDAOImpl extends AbstractContentDataDAOImpl
|
||||
{
|
||||
private static final String SELECT_CONTENT_URL_BY_ID = "select.ContentUrlById";
|
||||
private static final String SELECT_CONTENT_URL_BY_KEY = "select.ContentUrlByKey";
|
||||
private static final String SELECT_CONTENT_URL_BY_KEY_UNREFERENCED = "select.ContentUrlByKeyUnreferenced";
|
||||
private static final String SELECT_CONTENT_URLS = "select.ContentUrls";
|
||||
private static final String SELECT_CONTENT_DATA_BY_ID = "select.ContentDataById";
|
||||
private static final String SELECT_CONTENT_DATA_BY_NODE_AND_QNAME = "select.ContentDataByNodeAndQName";
|
||||
private static final String SELECT_CONTENT_DATA_BY_URL_ID = "select.ContentDataByContentUrlId";
|
||||
private static final String INSERT_CONTENT_URL = "insert.ContentUrl";
|
||||
private static final String INSERT_CONTENT_DATA = "insert.ContentData";
|
||||
private static final String DELETE_CONTENT_DATA = "delete.ContentData";
|
||||
@@ -105,6 +105,16 @@ public class ContentDataDAOImpl extends AbstractContentDataDAOImpl
|
||||
return template.delete(DELETE_CONTENT_URL, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ContentUrlEntity getContentUrlEntityUnreferenced(String contentUrl)
|
||||
{
|
||||
ContentUrlEntity contentUrlEntity = new ContentUrlEntity();
|
||||
contentUrlEntity.setContentUrl(contentUrl);
|
||||
contentUrlEntity = (ContentUrlEntity) template.queryForObject(SELECT_CONTENT_URL_BY_KEY_UNREFERENCED, contentUrlEntity);
|
||||
// Done
|
||||
return contentUrlEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ContentDataEntity createContentDataEntity(
|
||||
Long contentUrlId,
|
||||
@@ -166,22 +176,13 @@ public class ContentDataDAOImpl extends AbstractContentDataDAOImpl
|
||||
}
|
||||
// Only check the content URLs if one is present
|
||||
String contentUrl = contentDataEntity.getContentUrl();
|
||||
Long contentUrlId = contentDataEntity.getContentUrlId();
|
||||
// Delete the ContentData entity
|
||||
deleteContentData(id);
|
||||
// Check if the content URL was orphaned
|
||||
if (contentUrlId != null)
|
||||
if (contentUrl != null)
|
||||
{
|
||||
params.clear();
|
||||
params.put("id", contentUrlId);
|
||||
@SuppressWarnings("unchecked")
|
||||
List<ContentDataEntity> contentDataEntities = (List<ContentDataEntity>) template.queryForList(SELECT_CONTENT_DATA_BY_URL_ID, params);
|
||||
// If there is still ContentData associated with the content URL, then leave it
|
||||
if (contentDataEntities.size() == 0)
|
||||
{
|
||||
// Orphaned
|
||||
registerOrphanedContentUrl(contentUrl);
|
||||
}
|
||||
// It has been dereferenced and may be orphaned - we'll check later
|
||||
registerDereferenceContentUrl(contentUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user