Christoph de Mattia wrote:
Hi All!

I am using Lenya1.2 right now. I'm trying to write a custom Workflow-Condition. To do so my Java-class extends org.apache.lenya.workflow.impl.AbstractCondition.

The condition is intended to compare the current user with the creator of a document. I managed to get the current user:
CMSSituation situationImpl = (CMSSituation) situation;
String currentUser = situationImpl.getUserId();
But I'm struggeling to get access to the Creator of the Document. My first idea was to use the DublinCore-class of a document to access the meta-data of the document. Unfortunately I didn't find a way to retrieve the current Document.

1)Is this the right list or should I post to the developers list?

This list is perfect.
The dev list is rather for people developing Lenya, the user list is
for people developing with Lenya :)


2)Has anyone an idea how this could work?

This could work - beware of typos :)


public boolean isComplied(situation, instance) {

    WorkflowDocument wfDoc = (WorkflowDocument) instance;
    Document doc = wfDoc.getDocument();

    String creator = doc.getDublinCore()
                        .getFirstValue(DublinCore.ELEMENT_CREATOR);

    CMSSituation situationImpl = (CMSSituation) situation;
    String currentUser = situationImpl.getUserId();

    return creator != null && creator.equals(currentUser);
}


3)Is there another way than the one I tried to go to ensure that only the creator of a document can actually edit it?

No, your idea is fine.

-- Andreas


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to