001: package org.osbl.client;
002:
003: import org.osbl.client.action.ActionRegistry;
004: import org.osbl.client.feeder.Feed;
005: import org.osbl.client.wings.devtools.*;
006: import org.osbl.client.wings.action.*;
007: import org.osbl.client.wings.navigation.NavigationStructure;
008: import org.osbl.client.wings.navigation.ReferenceTool;
009: import org.osbl.client.wings.concern.*;
010: import org.osbl.client.wings.shell.Client;
011: import org.osbl.client.wings.form.Editors;
012: import org.osbl.client.wings.control.ProcessMonitor;
013: import org.osbl.client.web.WebModule;
014: import org.osbl.client.item.ActionLocalizationCollector;
015: import org.osbl.ItemRegistry;
016: import org.osbl.item.BeanLocalizationCollector;
017: import org.osbl.item.BeanAuthorizationCollector;
018: import org.osbl.plugin.Extension;
019: import org.osbl.plugin.PluginManager;
020: import org.osbl.client.item.ActionAuthorizationCollector;
021: import org.concern.model.Process;
022: import org.concern.*;
023:
024: public class ClientWebModule implements WebModule {
025: PluginManager pluginManager;
026: ItemRegistry authorizationItems;
027: ItemRegistry localizationItems;
028:
029: public void setPluginManager(PluginManager pluginManager) {
030: this .pluginManager = pluginManager;
031: }
032:
033: public void setAuthorizationItems(ItemRegistry authorizationItems) {
034: this .authorizationItems = authorizationItems;
035: }
036:
037: public void setLocalizationItems(ItemRegistry localizationItems) {
038: this .localizationItems = localizationItems;
039: }
040:
041: public void initialize() {
042: Feed.addInitializer(new DefaultFeedInitializer());
043: Client.addInitializer(new DefaultClientInitializer());
044:
045: authorizationItems.addItems(new ActionAuthorizationCollector());
046: authorizationItems.addItems(new BeanAuthorizationCollector(
047: Process.class));
048: authorizationItems.addItems(new BeanAuthorizationCollector(
049: Subject.class));
050: authorizationItems.addItems(new BeanAuthorizationCollector(
051: Work.class));
052:
053: localizationItems.addItems(new ActionLocalizationCollector());
054: localizationItems.addItems(new BeanLocalizationCollector(
055: Process.class));
056: localizationItems.addItems(new BeanLocalizationCollector(
057: Subject.class));
058: localizationItems.addItems(new BeanLocalizationCollector(
059: Work.class));
060:
061: pluginManager.registerExtension(new Extension(
062: "GUI Map Generator", "org.osbl.client.wings.devtools",
063: GUIMapGeneratorDevTool.class));
064: pluginManager.registerExtension(new Extension(
065: "Container Coloring", "org.osbl.client.wings.devtools",
066: ContainerColoringDevTool.class));
067: pluginManager.registerExtension(new Extension(
068: "Dump Classnames", "org.osbl.client.wings.devtools",
069: DumpClassNamesDevTool.class));
070: pluginManager.registerExtension(new Extension(
071: "Service Browser", "org.osbl.client.wings.devtools",
072: ServiceBrowserDevTool.class));
073: pluginManager.registerExtension(new Extension(
074: "Client Service Browser",
075: "org.osbl.client.wings.devtools",
076: ClientServiceBrowserDevTool.class));
077: pluginManager.registerExtension(new Extension(
078: "Localization Items", "org.osbl.client.wings.devtools",
079: DumpLocalizationItemsDevTool.class));
080: pluginManager.registerExtension(new Extension(
081: "Authorization Items",
082: "org.osbl.client.wings.devtools",
083: DumpAuthorizationItemsDevTool.class));
084: pluginManager.registerExtension(new Extension("Reference Tool",
085: "org.osbl.client.wings.form.formTools",
086: ReferenceTool.class));
087:
088: Editors.registerEditor(Process.class, ProcessEditor.class);
089: Editors.registerEditor(Subject.class, SubjectEditor.class);
090: Editors.registerEditor(Work.class, TaskEditor.class);
091:
092: ActionRegistry.registerAction(new ShowApplicationAction(
093: ServiceBrowser.class,
094: "org.osbl.client.wings.devtools.serviceBrowser"));
095: ActionRegistry.registerAction(new ShowApplicationAction(
096: ClientServiceBrowser.class,
097: "org.osbl.client.wings.devtools.clientServiceBrowser"));
098: ActionRegistry.registerAction(new ShowApplicationAction(
099: ProcessMonitor.class, "org.concern.actions.monitor"));
100: ActionRegistry.registerAction(new ShowEditorAction(
101: Process.class, "org.concern.actions.processes"));
102: ActionRegistry.registerAction(new LogoutAction(
103: "businessobject.actions.logout"));
104:
105: ShowEditorAction tasks = new ShowEditorAction(Work.class,
106: "org.concern.actions.tasks");
107: tasks.setFilter("assignee", "{currentUser}");
108: ActionRegistry.registerAction(tasks);
109:
110: ShowEditorAction subjects = new ShowEditorAction(Subject.class,
111: "org.concern.actions.subjects");
112: subjects.setFilter("assignee", "{currentUser}");
113: ActionRegistry.registerAction(subjects);
114:
115: ShowEditorAction ownSubjects = new ShowEditorAction(
116: Subject.class, "org.concern.actions.ownSubjects");
117: ownSubjects.setFilter("originator", "{currentUser}");
118: ActionRegistry.registerAction(ownSubjects);
119:
120: ShowEditorAction archivedSubjects = new ShowEditorAction(
121: Subject.class, "org.concern.actions.archivedSubjects");
122: ownSubjects.setFilter("originator", "{currentUser}");
123: archivedSubjects.setFilter("state", Controller.STATE_DESTROYED);
124: ActionRegistry.registerAction(archivedSubjects);
125:
126: NavigationStructure navigationStructure = NavigationStructure
127: .getInstance();
128:
129: navigationStructure.addAction("formulars",
130: "org.concern.actions.tasks");
131: navigationStructure.addAction("formulars",
132: "org.concern.actions.subjects");
133: navigationStructure.addAction("formulars",
134: "org.concern.actions.ownSubjects");
135: navigationStructure.addAction("formulars",
136: "org.concern.actions.archivedSubjects");
137:
138: navigationStructure.addAction("administration",
139: "org.concern.actions.processes");
140: navigationStructure.addAction("administration",
141: "org.concern.actions.monitor");
142:
143: populateFormularTemplates(navigationStructure);
144: }
145:
146: private void populateFormularTemplates(
147: NavigationStructure navigationStructure) {
148: ControllerLookup controllerLookup = ControllerLookup
149: .getInstance();
150: String[] processNames = controllerLookup.getControllerNames();
151: for (int i = 0; i < processNames.length; i++) {
152: String processName = processNames[i];
153: Controller controller = controllerLookup
154: .getController(processName);
155: Process process = controller.getProcess();
156: if (ProcessTableModel.findCreateForm(process) == null)
157: continue;
158:
159: String command = process.getSubject() + ".actions.create";
160: String query = "edit=org.concern.model.Process&process="
161: + processName;
162: ActionRegistry.registerAction(new QueryAction(command,
163: query));
164: navigationStructure.addAction("formulars.templates",
165: command);
166: }
167: }
168: }
|