List Info

Thread: Re: wrong comment and dead code in DocumentUsecase




Re: wrong comment and dead code in DocumentUsecase
user name
2007-01-30 09:32:23
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).

-- Andreas


------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribelenya.apache.org
For additional commands, e-mail: dev-helplenya.apache.org


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )