gizmo16
gizmo16

Reputation: 113

Alfresco: Search all document in all workflows

I need to search for all documents in all workflow. The document in workflow contains anything property, that indicates that the document is in some workflows?

Example:

results = search.luceneSearch("@cm\\:documentWorkflow:"+true);

I need create custom advanced search and search all documents in workflows.

Thanks in advance.

Upvotes: 0

Views: 300

Answers (1)

If it is a simple workflow there is an aspect called "{http://www.alfresco.org/model/application/1.0}simpleworkflow"

If you are an advanced workflow, have a parent type "packageContains" containing workflow in this node (parent) one aspect "{http://www.alfresco.org/model/bpm/1.0}workflowPackage"

You could perform a query something like:

search.luceneSearch results = ('ASPECT:"bpm:workflowPackage" ASPECT:"app:simpleWorkflow"');

Where node results contain this aspect, the children are documents.

For example:

var res = search
        .luceneSearch('ASPECT:"bpm:workflowPackage" ASPECT:"app:simpleWorkflow"');
var par = null;
var c = null;
var s = "<html><body>total " + res.length + "<br>";

for (var i = 0; i < res.length; i++) {
    if (res[i].hasAspect("bpm:workflowPackage")) {
        par = res[i];
        for each(c in par.children)
        {
            s += c.name + "<br>";
        }

    } else {
        s += res[i].name + "<br>";
    }
}

s += "</body></html>";

s;

Regards!

Upvotes: 2

Related Questions