RM-817: Error: "Unknown aspect specified in query: rma:unpublishedUpdate" in alfresco with RM

* ensure the job doesn't execute before the RM content model is loaded



git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@54461 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Roy Wetherall
2013-08-26 10:00:17 +00:00
parent 887b211919
commit 3e0167e4b1

View File

@@ -30,6 +30,7 @@ import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
import org.alfresco.repo.transaction.RetryingTransactionHelper;
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.repository.StoreRef;
@@ -57,29 +58,47 @@ public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter
/** Publish executor register */
private PublishExecutorRegistry publishExecutorRegistry;
/** Dictionary service */
private DictionaryService dictionaryService;
/** Behaviour filter */
private BehaviourFilter behaviourFilter;
/**
* @param nodeService node service
*/
public void setNodeService(NodeService nodeService)
{
this.nodeService = nodeService;
}
/**
* @param searchService search service
*/
public void setSearchService(SearchService searchService)
{
this.searchService = searchService;
}
/**
* @param publishExecutorRegistry public executor registry
*/
public void setPublishExecutorRegistry(PublishExecutorRegistry publishExecutorRegistry)
{
this.publishExecutorRegistry = publishExecutorRegistry;
}
/**
* @param behaviourFilter behaviour filter
*/
public void setBehaviourFilter(BehaviourFilter behaviourFilter)
{
this.behaviourFilter = behaviourFilter;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.job.RecordsManagementJobExecuter#executeImpl()
*/
public void executeImpl()
{
if (logger.isDebugEnabled() == true)
@@ -90,6 +109,8 @@ public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter
AuthenticationUtil.runAs(new RunAsWork<Object>()
{
public Object doWork() throws Exception
{
if (rmLoaded() == true)
{
// Get a list of the nodes that have updates that need to be published
List<NodeRef> nodeRefs = getUpdatedNodes();
@@ -132,6 +153,7 @@ public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter
}
}
}
}
return null;
};
}, AuthenticationUtil.getSystemUserName());
@@ -142,6 +164,24 @@ public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter
}
}
/**
* Helper method to determine whether the RM content model has been loaded yet.
*
* @return boolean true if RM content model loaded, false otherwise
*/
private boolean rmLoaded()
{
boolean result = false;
// ensure that the rm content model has been loaded
if (dictionaryService.getAspect(ASPECT_UNPUBLISHED_UPDATE) != null)
{
result = true;
}
return result;
}
/**
* Get a list of the nodes with updates pending publish
* @return List<NodeRef> list of node refences with updates pending publication