Author: andreas
Date: Thu Aug 9 09:24:42 2007
New Revision: 564262
URL: http://svn.apache.org/viewvc?view=rev&rev=564262
Log:
Create continuation for usecase if preconditions failed, but don't advance/execute.
Modified:
lenya/trunk/src/modules-core/usecase/usecases.js
Modified: lenya/trunk/src/modules-core/usecase/usecases.js
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/usecase/usecases.js?view=diff&rev=564262&r1=564261&r2=564262
==============================================================================
--- lenya/trunk/src/modules-core/usecase/usecases.js (original)
+++ lenya/trunk/src/modules-core/usecase/usecases.js Thu Aug 9 09:24:42 2007
@@ -176,17 +176,16 @@
* @param view, a org.apache.lenya.cms.usecase.UsecaseView object
* @param proxy, a org.apache.lenya.cms.usecase.UsecaseProxy object
* @param generic, a generic Javascript object for custom flow code to preserve state information (currently not used by the default code)
- * @param preconditionsOK, if the preconditions were complied, which means we create a continuation
*
* This function invokes customLoopFlow if it exists.
* Otherwise it falls back to defaultLoopFlow.
*/
-function loopFlow(view, proxy, generic, preconditionsOK) {
+function loopFlow(view, proxy, generic) {
if (customLoopFlow != undefined) {
log("info", "Using customLoopFlow function", proxy.getName());
- return customLoopFlow(view, proxy, generic, preconditionsOK);
+ return customLoopFlow(view, proxy, generic);
} else{
- return defaultLoopFlow(view, proxy, preconditionsOK);
+ return defaultLoopFlow(view, proxy);
}
}
@@ -215,7 +214,7 @@
/**
* @see loopFlow.
*/
-function defaultLoopFlow(view, proxy, preconditionsOK) {
+function defaultLoopFlow(view, proxy) {
var viewUri = view.getViewURI();
// we used to allow a cocoon:/ prefix (which sendPageXXX does not handle),
// but it is now deprecated!
@@ -230,7 +229,7 @@
+ (view.showMenu() ? "menu" : "nomenu")
+ "/" + viewUri;
}
- if (view.createContinuation() && preconditionsOK) {
+ if (view.createContinuation()) {
log("debug", "Creating view and continuation, calling Cocoon with viewUri = [" + viewUri + "]");
cocoon.sendPageAndWait(viewUri, { "usecase" : proxy });
} else {
@@ -340,7 +339,7 @@
do {
// show the view:
try {
- loopFlow(view, proxy, generic, preconditionsOK); //usecase must be released here!
+ loopFlow(view, proxy, generic); //usecase must be released here!
} catch (exception) {
// if something went wrong, try and rollback the usecase:
log("error", "Exception during loopFlow(): " + exception, usecaseName);
@@ -353,15 +352,17 @@
releaseUsecase(usecase);
}
}
- log("debug", "Advancing in usecase.", usecaseName);
- // restore the usecase state and handle the user input:
- usecase = getUsecase(usecaseName);
- proxy.setup(usecase);
- passRequestParameters(usecase);
- state = submitFlow(usecase, generic);
- // create a new proxy with the updated usecase state
- proxy = new Packages.org.apache.lenya.cms.usecase.impl.UsecaseProxy(usecase);
- releaseUsecase(usecase);
+ if (preconditionsOK) {
+ log("debug", "Advancing in usecase.", usecaseName);
+ // restore the usecase state and handle the user input:
+ usecase = getUsecase(usecaseName);
+ proxy.setup(usecase);
+ passRequestParameters(usecase);
+ state = submitFlow(usecase, generic);
+ // create a new proxy with the updated usecase state
+ proxy = new Packages.org.apache.lenya.cms.usecase.impl.UsecaseProxy(usecase);
+ releaseUsecase(usecase);
+ }
} while (state == "continue");
// If the usecase does not have a view uri, we can directly jump to
// executeFlow().
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.