ALF-19942: Failed to displayed Process Engines page in Admin Console after creation of workflow by tenant user

Do special tenant specific filtering for WorkflowInstances and TaskInstances: for default tenant all instances included, for other tenants - only tenant-specific.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@56139 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Pavel Yurke
2013-09-30 08:31:34 +00:00
parent 2429d0a852
commit 0932f9eea0
3 changed files with 74 additions and 4 deletions

View File

@@ -108,6 +108,30 @@ public class ActivitiTypeConverter
return convert(filtered);
}
/**
* filters HistoricProcessInstances by domain
* including all instances for default domain
* and excluding shared instances (THOR-206) for tenants
*
* @param completedInstances
* @param function
* @return
*/
public <F, T> List<T> doSpecialTenantFilterAndSafeConvert(List<F> values, Function<F, String> processKeyGetter)
{
List<F> filtered = factory.doSpecialTenantFilter(values, processKeyGetter);
factory.setIgnoreTenantCheck(factory.isDefaultDomain());
try
{
return convert(filtered, true);
}
finally
{
factory.setIgnoreTenantCheck(false);
}
}
/**
* Convert a {@link Deployment} into a {@link WorkflowDeployment}.
* @param deployment
@@ -329,13 +353,29 @@ public class ActivitiTypeConverter
return results;
}
@SuppressWarnings("unchecked")
public <T> List<T> convert(List<?> inputs)
{
return convert(inputs, false);
}
@SuppressWarnings("unchecked")
public <T> List<T> convert(List<?> inputs, boolean ignoreNotDeployed)
{
ArrayList<T> results = new ArrayList<T>(inputs.size());
for (Object in : inputs)
{
T out = (T) convert(in);
T out = null;
try
{
out = (T) convert(in);
}
catch (NullPointerException npe)
{
if (!ignoreNotDeployed)
{
throw npe;
}
}
if(out != null)
{
results.add(out);

View File

@@ -1121,7 +1121,7 @@ public class ActivitiWorkflowEngine extends BPMEngine implements WorkflowEngine
*/
private List<WorkflowTask> getValidWorkflowTasks(List<Task> tasks)
{
return typeConverter.filterByDomainAndConvert(tasks, new Function<Task, String>()
return typeConverter.doSpecialTenantFilterAndSafeConvert(tasks, new Function<Task, String>()
{
public String apply(Task task)
{