Line | Hits | Source |
---|---|---|
1 | /******************************************************************************* | |
2 | * InternetCafe is a software solution that helps the management of Cybercafes | |
3 | * according with the ITALIAN DECREE LAW ON ANTI-TERROR MEASURES, 27 JULY 2005. | |
4 | * Copyright (C) 2006 Guido Angelo Ingenito | |
5 | ||
6 | * This program is free software; you can redistribute it and/or | |
7 | * modify it under the terms of the GNU General Public License | |
8 | * as published by the Free Software Foundation; either version 2 | |
9 | * of the License, or (at your option) any later version. | |
10 | ||
11 | * This program is distributed in the hope that it will be useful, | |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | * GNU General Public License for more details. | |
15 | * | |
16 | * You should have received a copy of the GNU General Public License | |
17 | * along with this program; if not, write to the Free Software | |
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
19 | *******************************************************************************/ | |
20 | ||
21 | package ui.command.IO; | |
22 | ||
23 | import java.util.Date; | |
24 | ||
25 | import ui.Messages; | |
26 | import ui.command.Command; | |
27 | import ui.panel.BackupPanel; | |
28 | import base.InternetCafe; | |
29 | 0 | import base.InternetCafeManager; |
30 | 0 | import base.backup.Backup; |
31 | 0 | import base.backup.BackupFactory; |
32 | ||
33 | public class SaveBackupCommand extends Command { | |
34 | ||
35 | private final BackupPanel backupPanel; | |
36 | ||
37 | private String name; | |
38 | ||
39 | private String description; | |
40 | 0 | |
41 | 0 | private Date date; |
42 | 0 | |
43 | 0 | private String dbLocationPath; |
44 | 0 | |
45 | 0 | private String zipLocationPath; |
46 | 0 | |
47 | 0 | /** |
48 | * @param backupPanel | |
49 | 0 | */ |
50 | 0 | public SaveBackupCommand(BackupPanel backupPanel) { |
51 | 0 | this.backupPanel = backupPanel; |
52 | 0 | } |
53 | ||
54 | /* | |
55 | * (non-Javadoc) | |
56 | 0 | * |
57 | * @see ui.command.Command#prologo() | |
58 | 0 | */ |
59 | @Override | |
60 | 0 | protected void prologo() { |
61 | 0 | InternetCafe.setStatusBarMessage(Messages.getString("command.savebackupcommand.savingbackup")); //$NON-NLS-1$ |
62 | 0 | this.name = getBackupPanel().getBackupName(); |
63 | 0 | this.description = getBackupPanel().getBackupDescription(); |
64 | 0 | this.dbLocationPath = getBackupPanel().getDbLocationPath(); |
65 | 0 | this.zipLocationPath = getBackupPanel().getZipLocationPath(); |
66 | 0 | this.date = getBackupPanel().getBackupDate(); |
67 | 0 | setStatus(EXECUTE_STATUS); |
68 | 0 | } |
69 | ||
70 | 0 | /* |
71 | * (non-Javadoc) | |
72 | * | |
73 | * @see ui.command.Command#execution() | |
74 | */ | |
75 | @Override | |
76 | 0 | protected void execution() throws Exception { |
77 | 0 | switch (getStatus()) { |
78 | 0 | case ERROR_STATUS: |
79 | 0 | break; |
80 | 0 | case VETOED_STATUS: |
81 | 0 | break; |
82 | 0 | case EXECUTE_STATUS: |
83 | 0 | Backup backup = BackupFactory.newBackup(this.name, |
84 | 0 | this.description, this.date, this.dbLocationPath, |
85 | 0 | this.zipLocationPath); |
86 | 0 | InternetCafeManager.getInstance().addBackup(backup); |
87 | 0 | BackupFactory.backupToZipArchive(backup); |
88 | 0 | setStatus(SUCCESS_STATUS); |
89 | break; | |
90 | 0 | } |
91 | 0 | } |
92 | ||
93 | 0 | /** |
94 | * @return Returns the backupPanel. | |
95 | */ | |
96 | private BackupPanel getBackupPanel() { | |
97 | 0 | return backupPanel; |
98 | } | |
99 | 0 | |
100 | } |
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |