mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Fix for SLNG-1156 - exception when displaying workflow task with empty workflow package, causing tasklist data webscript to fail and list to be rendered as empty.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@10845 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -618,78 +618,77 @@ public class WorkflowServiceImpl implements WorkflowService
|
|||||||
WorkflowTask workflowTask = getTaskById(taskId);
|
WorkflowTask workflowTask = getTaskById(taskId);
|
||||||
List<NodeRef> contents = new ArrayList<NodeRef>();
|
List<NodeRef> contents = new ArrayList<NodeRef>();
|
||||||
|
|
||||||
if(workflowTask != null)
|
if (workflowTask != null)
|
||||||
{
|
{
|
||||||
NodeRef workflowPackage = (NodeRef)workflowTask.properties.get(WorkflowModel.ASSOC_PACKAGE);
|
NodeRef workflowPackage = (NodeRef)workflowTask.properties.get(WorkflowModel.ASSOC_PACKAGE);
|
||||||
if (workflowPackage.getStoreRef().getProtocol().equals(StoreRef.PROTOCOL_AVM))
|
if (workflowPackage != null)
|
||||||
{
|
{
|
||||||
if (protectedNodeService.exists(workflowPackage))
|
if (workflowPackage.getStoreRef().getProtocol().equals(StoreRef.PROTOCOL_AVM))
|
||||||
{
|
{
|
||||||
final NodeRef stagingNodeRef = (NodeRef)
|
if (protectedNodeService.exists(workflowPackage))
|
||||||
protectedNodeService.getProperty(workflowPackage,
|
{
|
||||||
WCMModel.PROP_AVM_DIR_INDIRECTION);
|
final NodeRef stagingNodeRef = (NodeRef)
|
||||||
final String stagingAvmPath = AVMNodeConverter.ToAVMVersionPath(stagingNodeRef).getSecond();
|
protectedNodeService.getProperty(workflowPackage,
|
||||||
final String packageAvmPath = AVMNodeConverter.ToAVMVersionPath(workflowPackage).getSecond();
|
WCMModel.PROP_AVM_DIR_INDIRECTION);
|
||||||
if (logger.isDebugEnabled())
|
final String stagingAvmPath = AVMNodeConverter.ToAVMVersionPath(stagingNodeRef).getSecond();
|
||||||
logger.debug("comparing " + packageAvmPath + " with " + stagingAvmPath);
|
final String packageAvmPath = AVMNodeConverter.ToAVMVersionPath(workflowPackage).getSecond();
|
||||||
for (AVMDifference d : avmSyncService.compare(-1, packageAvmPath,
|
if (logger.isDebugEnabled())
|
||||||
-1, stagingAvmPath,
|
logger.debug("comparing " + packageAvmPath + " with " + stagingAvmPath);
|
||||||
null))
|
for (AVMDifference d : avmSyncService.compare(-1, packageAvmPath,
|
||||||
{
|
-1, stagingAvmPath,
|
||||||
if (logger.isDebugEnabled())
|
null))
|
||||||
logger.debug("got difference " + d);
|
{
|
||||||
if (d.getDifferenceCode() == AVMDifference.NEWER ||
|
if (logger.isDebugEnabled())
|
||||||
d.getDifferenceCode() == AVMDifference.CONFLICT)
|
logger.debug("got difference " + d);
|
||||||
{
|
if (d.getDifferenceCode() == AVMDifference.NEWER ||
|
||||||
contents.add(AVMNodeConverter.ToNodeRef(d.getSourceVersion(), d.getSourcePath()));
|
d.getDifferenceCode() == AVMDifference.CONFLICT)
|
||||||
}
|
{
|
||||||
}
|
contents.add(AVMNodeConverter.ToNodeRef(d.getSourceVersion(), d.getSourcePath()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
{
|
}
|
||||||
// get existing workflow package items
|
else
|
||||||
List<ChildAssociationRef> childRefs = protectedNodeService.getChildAssocs(
|
{
|
||||||
workflowPackage, ContentModel.ASSOC_CONTAINS,
|
// get existing workflow package items
|
||||||
RegexQNamePattern.MATCH_ALL);
|
List<ChildAssociationRef> childRefs = protectedNodeService.getChildAssocs(
|
||||||
|
workflowPackage, ContentModel.ASSOC_CONTAINS,
|
||||||
|
RegexQNamePattern.MATCH_ALL);
|
||||||
|
|
||||||
for (ChildAssociationRef ref: childRefs)
|
for (ChildAssociationRef ref: childRefs)
|
||||||
{
|
{
|
||||||
// create our Node representation from the NodeRef
|
// create our Node representation from the NodeRef
|
||||||
NodeRef nodeRef = ref.getChildRef();
|
NodeRef nodeRef = ref.getChildRef();
|
||||||
|
|
||||||
if (!protectedNodeService.exists(nodeRef))
|
if (!protectedNodeService.exists(nodeRef))
|
||||||
{
|
{
|
||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
logger.debug("Ignoring " + nodeRef + " as it has been removed from the repository");
|
logger.debug("Ignoring " + nodeRef + " as it has been removed from the repository");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// find it's type so we can see if it's a node we are interested in
|
// find it's type so we can see if it's a node we are interested in
|
||||||
QName type = protectedNodeService.getType(nodeRef);
|
QName type = protectedNodeService.getType(nodeRef);
|
||||||
|
|
||||||
// make sure the type is defined in the data dictionary
|
// make sure the type is defined in the data dictionary
|
||||||
TypeDefinition typeDef = dictionaryService.getType(type);
|
TypeDefinition typeDef = dictionaryService.getType(type);
|
||||||
|
|
||||||
if (typeDef == null)
|
if (typeDef == null)
|
||||||
{
|
{
|
||||||
if (logger.isWarnEnabled())
|
if (logger.isWarnEnabled())
|
||||||
logger.warn("Found invalid object in database: id = " + nodeRef +
|
logger.warn("Found invalid object in database: id = " + nodeRef +
|
||||||
", type = " + type);
|
", type = " + type);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
contents.add(nodeRef);
|
contents.add(nodeRef);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return contents;
|
return contents;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user