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]
>
>