Andreas Hartmann wrote:
Jörn Nettingsmeier schrieb:
hi *!

obviously, the following code from
/modules-core/usecase/java/src/org/apache/lenya/cms/usecase/DocumentUsecase.java
does not do what the comment claims it does:

/**
 * Returns the document to be redirected to after the usecase has been
 * completed. If the parameter <code>success</code> is false, the source
 * document is returned (override this method to change this behaviour).
 * @param success If the usecase was successfully completed.
 * @return A document.
 */
protected Document getTargetDocument(boolean success) {
    Document document = (Document) getParameter(TARGET_DOCUMENT);
    if (document == null) {
        document = getSourceDocument();
    }
    return document;
}

the "success" parameter is not used.
since the usecase flow handler takes care of unsuccessful usecase
submissions, i'd say let's rip this out. wdyt?

The flowscript passes the success parameter to the usecase,
so it can be taken into account:

    targetUrl = usecase.getTargetURL(state == "success");

I wouldn't like to remove it, because I can imagine that some
usecases want to use custom target URLs for non-successful
invocation (i.e., the URL of an alternative usecase or a certain
error page).

ok, but then let's either fix the comment, or change the implementation to
 protected Document getTargetDocument(boolean success) {
     if (!success) return getSourceDocument();
     Document document = (Document) getParameter(TARGET_DOCUMENT);
     if (document == null) {
         document = getSourceDocument();
     }
     return document;
 }

or am i missing something?


--
jörn nettingsmeier

home://germany/45128 essen/lortzingstr. 11/
http://spunk.dnsalias.org
phone://+49/201/491621

if you are a free (as in "free speech") software developer
and you happen to be travelling near my home, drop me a line
and come round for a free (as in "free beer") beer. :-D

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

Reply via email to