Florent André schrieb:
Hi Christopher,

Great thanks I can do one step, now I can submit my document.

But I still not arrived to publish my doc...
My code to submit a Lenya document (that's work, thanks) is [1]. But when I
add the invoker.invoke with "workflow.publish",


I have an "error-workflow-document" in my UsecaseMessage

That usually means the workflow transition coulnd't fire. Are you sure the document is in the correct state and the user has the permission to publish it? What are the parameters of the message?

and my doc is not submitted.

For doing the submit and publish steps workflow, I try :
- call the 2 invoker.invoke in the same try/catch
- copy all the first try/catch with other variables name (invoker2)
but nothing work...

I see the workflow.multiWorkflow in cocoon.xconf, but I'm not sure if it's
a solution for my problem (and I don't really know how to call him in my
existing code)...

This is the handler for the "Usecase overview" usecase. You can take a look at it to see how the usecase invoker is called, but since you have already figured that out, I don't think it will be much use to you :)

-- Andreas




Thanks for your help

[1]
UsecaseInvoker invoker = null;
            try {
                invoker = (UsecaseInvoker)
this.manager.lookup(UsecaseInvoker.ROLE);
                Map params = new HashMap();

                invoker.invoke(lenyaDoc.getCanonicalWebappURL(),
"workflow.submit", params);
                //invoker.invoke(lenyaDoc.getCanonicalWebappURL(),
"workflow.publish", params);

                if (invoker.getResult() != UsecaseInvoker.SUCCESS) {
                      List messages = invoker.getErrorMessages();
                    for (Iterator i = messages.iterator(); i.hasNext();) {
                        UsecaseMessage message = (UsecaseMessage) i.next();
                        reportResult("","PROBLEM","USECASE
PROBLEM",message.getMessage(),message.getParameters().toString(),"");
                    }
                }
            }
            catch( ServiceException se){
reportResult("","PROBLEM","ServiceException",se.getMessage(),"","");
            }
            catch (UsecaseException ue){
reportResult("","PROBLEM","UsecaseException",ue.getMessage(),"","");
            }
            finally {
                if (invoker != null) {
                    this.manager.release(invoker);
                }
            }


On Mon, 11 May 2009 12:33:46 +0200, Christopher Wagner
<[email protected]> wrote:
Hi,

this could be done by using the UsecaseInvoker class (Lenya 2.0 API):

 UsecaseInvoker invoker = null;
     try {
         invoker = (UsecaseInvoker)
         this.manager.lookup(UsecaseInvoker.ROLE);
         Map params = new HashMap();
         params.put(..., ...);
         invoker.invoke(getSourceUrl(), "publish", params);

         if (invoker.getResult() != UsecaseInvoker.SUCCESS) {
             List messages = invoker.getErrorMessages();
             for (Iterator i = messages.iterator(); i.hasNext();) {
                 UsecaseMessage message = (UsecaseMessage) i.next();
                 addErrorMessage(message.getMessage(),
                 message.getParameters());
             }
         }
     } finally {
         if (invoker != null) {
             this.manager.release(invoker);
         }
     }


Chris

On Mon, May 11, 2009 at 10:23 AM, Florent André <
[email protected]> wrote:

To be more precise :

On Sun, 10 May 2009 22:14:45 +0200, Florent André
<[email protected]> wrote:
Hi,

I create a lenyaDoc in my code and commit the session : my document is
in
the authoring area.

After that I want to publish my lenyaDoc. I try many piece of code,
but
nothing work...
No error or exception was thrown, but the document don't appear in my
live
pub.

If I publish "by hand" my documents they appear in live..

TIA

Can you help me please ?


org.apache.cocoon.environment.Session cocoonSession =
request.getSession();
Identity identity = (Identity)
cocoonSession.getAttribute(Identity.class.getName());
Session session = RepositoryUtil.createSession(this.manager, identity,
true);


//Session session = RepositoryUtil.createSession(this.manager, null);
//Session session = lenyaDoc.getRepositoryNode().getSession();


WorkflowUtil.invoke(this.manager, session, getLogger(), lenyaDoc,
"submit");
WorkflowUtil.invoke(this.manager, session, getLogger(), lenyaDoc,
"publish");
session.commit();

Have good day


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]




--
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch
Tel.: +41 (0) 43 818 57 01


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to