Hi,
You should try:
<condition>#{docUtils.isParentEnviado(currentDocument)}</condition
>
With:
@Name("docUtils")
@Scope(CONVERSATION)
public class DocUtils implements Serializable {
@In(create = true, required = false)
protected transient CoreSession documentManager;
...
public boolean isParentEnviado(DocumentModel currentDoc)
throws ClientException {
DocumentModel parentDoc =
documentManager.getParentDocument(currentDoc.getRef());
return parentDoc != null
&&
"enviado".equals(parentDoc.getCurrentLifeCycleState());
}
}
Indeed, using EL expresions in a <condition> is a bit tricky
as you can only call one method on a Seam component (no
chained calls), so you need to include all the logic in this
single method.
Moreover, to get the CoreSession, it is better to inject it
with the @In annotation than getting it from a sessionId
took from a DocumentModel.
Also, your method could not work because you are calling new
IdRef(docId) with docId being a DocumentRef, whereas IdRef()
expects a string id.
Hope this works out.
Cheers.
---
Mailing list: [email protected]
Forum: http://forum.nuxeo.org/f/1/