Merged HEAD-BUG-FIX (5.1/Cloud) to HEAD (5.1/Cloud)

100845: Merged 5.0.N (5.0.2) to HEAD-BUG-FIX (5.1/Cloud)
      100756: Merged V4.2-BUG-FIX (4.2.5) to 5.0.N (5.0.2)
         99878: Merged V4.1-BUG-FIX (4.1.10) to V4.2-BUG-FIX (4.2.5)
            99807: Merged DEV to V4.1-BUG-FIX (4.1.10)
               99672: MNT-12150 : Centera Connector : isContentUrlSupported is returning false for the Centera store
                  - Unit test to demonstrate issue was implemented.
                  - Previously suggested fix was also merged.
               99781: MNT-12150 : Centera Connector : isContentUrlSupported is returning false for the Centera store
                  - Updated javadoc for new method in ContentDataDAO.
                  - Corrected logic of eager cleaner. If store is read-only content should not be deleted.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@100915 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2015-03-31 23:13:31 +00:00
parent 40fc727b0d
commit 17e4c1b55e
5 changed files with 147 additions and 4 deletions

View File

@@ -266,11 +266,17 @@ public class EagerContentStoreCleaner extends TransactionListenerAdapter
int deleted = 0;
for (ContentStore store : stores)
{
// Bypass if the store is read-only or doesn't support the URL
if (!store.isWriteSupported() || !store.isContentUrlSupported(contentUrl))
// Bypass if the store is read-only
if (!store.isWriteSupported())
{
continue;
}
// MNT-12150 fix, bypass if the store doesn't support the URL but mark as deleted
if (!store.isContentUrlSupported(contentUrl))
{
deleted++;
continue;
}
if (callListeners)
{
// Call listeners

View File

@@ -108,13 +108,22 @@ public interface ContentDataDAO
* @param contentUrlHandler the callback object to process the rows
* @param maxOrphanTimeExclusive the maximum orphan time (exclusive)
* @param maxResults the maximum number of results (1 or greater)
* @return Returns a list of orphaned content URLs ordered by ID
*/
void getContentUrlsOrphaned(
ContentUrlHandler contentUrlHandler,
Long maxOrphanTimeExclusive,
int maxResults);
/**
* Enumerate all available content URLs that were orphaned and cleanup for these urls failed
*
* @param contentUrlHandler the callback object to process the rows
* @param maxResults the maximum number of results (1 or greater)
*/
void getContentUrlsKeepOrphaned(
ContentUrlHandler contentUrlHandler,
int maxResults);
/**
* Delete a batch of content URL entities.
*/

View File

@@ -57,6 +57,7 @@ public class ContentDataDAOImpl extends AbstractContentDataDAOImpl
private static final String SELECT_CONTENT_URL_BY_KEY = "alfresco.content.select_ContentUrlByKey";
private static final String SELECT_CONTENT_URL_BY_KEY_UNREFERENCED = "alfresco.content.select_ContentUrlByKeyUnreferenced";
private static final String SELECT_CONTENT_URLS_ORPHANED = "alfresco.content.select.select_ContentUrlsOrphaned";
private static final String SELECT_CONTENT_URLS_KEEP_ORPHANED = "alfresco.content.select_ContentUrlsKeepOrphaned";
private static final String SELECT_CONTENT_DATA_BY_ID = "alfresco.content.select_ContentDataById";
private static final String SELECT_CONTENT_DATA_BY_NODE_AND_QNAME = "alfresco.content.select_ContentDataByNodeAndQName";
private static final String SELECT_CONTENT_DATA_BY_NODE_IDS = "alfresco.content.select_ContentDataByNodeIds";
@@ -160,6 +161,23 @@ public class ContentDataDAOImpl extends AbstractContentDataDAOImpl
}
}
@SuppressWarnings("unchecked")
public void getContentUrlsKeepOrphaned(
final ContentUrlHandler contentUrlHandler,
final int maxResults)
{
List<ContentUrlEntity> results = (List<ContentUrlEntity>) template.selectList(SELECT_CONTENT_URLS_KEEP_ORPHANED,
new RowBounds(0, maxResults));
// Pass the result to the callback
for (ContentUrlEntity result : results)
{
contentUrlHandler.handle(
result.getId(),
result.getContentUrl(),
result.getOrphanTime());
}
}
public int updateContentUrlOrphanTime(Long id, Long orphanTime, Long oldOrphanTime)
{
ContentUrlUpdateEntity contentUrlUpdateEntity = new ContentUrlUpdateEntity();