01: // Copyright (c) 2003-2007, Jodd Team (jodd.sf.net). All Rights Reserved.
02:
03: package jodd.madvoc;
04:
05: import jodd.madvoc.meta.MadvocAction;
06: import jodd.madvoc.meta.In;
07: import jodd.madvoc.meta.Out;
08: import jodd.madvoc.interceptor.ScopeType;
09:
10: import java.util.ArrayList;
11: import java.util.Collections;
12: import java.util.Comparator;
13: import java.util.List;
14:
15: /**
16: * Creates sorted list of all registered action configurations.
17: */
18: @MadvocAction
19: public class MadvocActionsAction {
20:
21: @In(scope=ScopeType.CONTEXT)
22: WebApplication webapp;
23:
24: @Out
25: List<ActionConfig> actions;
26:
27: public String view() {
28: actions = new ArrayList<ActionConfig>();
29: for (ActionConfig actionConfig : webapp.getAllActionConfigs()
30: .values()) {
31: actions.add(actionConfig);
32: }
33: Collections.sort(actions, new Comparator<ActionConfig>() {
34: public int compare(ActionConfig a1, ActionConfig a2) {
35: return a1.actionPath.compareTo(a2.actionPath);
36: }
37: });
38: return "ok";
39: }
40: }
|