source: contrib/MailArchiver/sources/src/serpro/mailarchiver/view/admin/ToolbarController.java @ 6785

Revision 6785, 4.4 KB checked in by rafaelraymundo, 12 years ago (diff)

Ticket #2946 - Liberado codigo do MailArchiver?. Documentação na subpasta DOCS.

Line 
1/**
2 * MailArchiver is an application that provides services for storing and managing e-mail messages through a Web Services SOAP interface.
3 * Copyright (C) 2012  Marcio Andre Scholl Levien and Fernando Alberto Reuter Wendt and Jose Ronaldo Nogueira Fonseca Junior
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Affero General Public License as
7 * published by the Free Software Foundation, either version 3 of the
8 * License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 * GNU Affero General Public License for more details.
14 *
15 * You should have received a copy of the GNU Affero General Public License
16 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 */
18
19/******************************************************************************\
20*
21*  This product was developed by
22*
23*        SERVIÇO FEDERAL DE PROCESSAMENTO DE DADOS (SERPRO),
24*
25*  a government company established under Brazilian law (5.615/70),
26*  at Department of Development of Porto Alegre.
27*
28\******************************************************************************/
29
30package serpro.mailarchiver.view.admin;
31
32import com.eventrouter.annotation.Subscribe;
33import static com.eventrouter.MessagePublisher.*;
34
35import com.vaadin.ui.Button.ClickEvent;
36import com.vaadin.ui.Window.Notification;
37
38import org.springframework.beans.factory.annotation.Autowired;
39
40import serpro.mailarchiver.service.web.ArchiveServices;
41import serpro.mailarchiver.service.web.ServiceFault;
42import serpro.mailarchiver.util.Logger;
43import serpro.mailarchiver.view.BaseController;
44
45class ToolbarController extends BaseController {
46
47    private static final Logger log = Logger.getLocalLogger();
48
49    @Autowired
50    private ArchiveServices archiveServices;
51
52    ToolbarController(String displayId) {
53        super(displayId);
54    }
55
56    @Override
57    public ToolbarController init() {
58        return this;
59    }
60
61
62    @Subscribe({"/mailarchiver/action/config_selected"})
63    public void config(ClickEvent event) {
64        publish("/mailarchiver/notification/humanized", "Config", Notification.POSITION_CENTERED_TOP);
65        publish("/mailarchiver/action/show_config");
66    }
67
68
69    @Subscribe({"/mailarchiver/action/explore_selected"})
70    public void explore(ClickEvent event) {
71        publish("/mailarchiver/notification/humanized", "Explore", Notification.POSITION_CENTERED_TOP);
72        publish("/mailarchiver/action/show_explore");
73    }
74
75
76    @Subscribe({"/mailarchiver/action/search_selected"})
77    public void search(ClickEvent event) {
78        publish("/mailarchiver/notification/humanized", "Search", Notification.POSITION_CENTERED_TOP);
79        publish("/mailarchiver/action/show_search");
80    }
81
82
83    @Subscribe({"/mailarchiver/action/help_selected"})
84    public void help(ClickEvent event) {
85        publish("/mailarchiver/notification/humanized", "Help", Notification.POSITION_CENTERED_TOP);
86        publish("/mailarchiver/action/show_help");
87    }
88
89
90    @Subscribe({"/mailarchiver/action/upload_selected"})
91    public void upload(ClickEvent event) {
92        publish("/mailarchiver/notification/humanized", "Upload", Notification.POSITION_CENTERED_TOP);
93        publish("/mailarchiver/action/show_upload");
94    }
95
96
97    @Subscribe({"/mailarchiver/action/importGears_selected"})
98    public void importGears(ClickEvent event) {
99        publish("/mailarchiver/notification/humanized", "Import Gears", Notification.POSITION_CENTERED_TOP);
100        publish("/mailarchiver/action/show_importGears");
101    }
102
103
104    @Subscribe({"/mailarchiver/action/terminal_selected"})
105    public void terminal(ClickEvent event) {
106        publish("/mailarchiver/notification/humanized", "Terminal", Notification.POSITION_CENTERED_TOP);
107        publish("/mailarchiver/action/show_terminal");
108    }
109
110
111    @Subscribe({"/mailarchiver/action/logout_selected"})
112    public void logout(ClickEvent event) {
113
114        try {
115            archiveServices.logout(AdminConsoleApp.getInstance().getSession().getSessionId());
116        }
117        catch (ServiceFault ex) {
118            log.error(ex);
119        }
120
121        publish("/mailarchiver/notification/humanized", "Logout", Notification.POSITION_CENTERED_TOP);
122        publish("/mailarchiver/logout");
123    }
124
125}
Note: See TracBrowser for help on using the repository browser.