Coverage details for ui.command.IO.SaveBackupCommand

LineHitsSource
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;
290import base.InternetCafeManager;
300import base.backup.Backup;
310import 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;
400 
410    private Date date;
420 
430    private String dbLocationPath;
440 
450    private String zipLocationPath;
460 
470    /**
48      * @param backupPanel
490     */
500    public SaveBackupCommand(BackupPanel backupPanel) {
510        this.backupPanel = backupPanel;
520    }
53  
54     /*
55      * (non-Javadoc)
560     *
57      * @see ui.command.Command#prologo()
580     */
59     @Override
600    protected void prologo() {
610        InternetCafe.setStatusBarMessage(Messages.getString("command.savebackupcommand.savingbackup")); //$NON-NLS-1$
620        this.name = getBackupPanel().getBackupName();
630        this.description = getBackupPanel().getBackupDescription();
640        this.dbLocationPath = getBackupPanel().getDbLocationPath();
650        this.zipLocationPath = getBackupPanel().getZipLocationPath();
660        this.date = getBackupPanel().getBackupDate();
670        setStatus(EXECUTE_STATUS);
680    }
69  
700    /*
71      * (non-Javadoc)
72      *
73      * @see ui.command.Command#execution()
74      */
75     @Override
760    protected void execution() throws Exception {
770        switch (getStatus()) {
780        case ERROR_STATUS:
790            break;
800        case VETOED_STATUS:
810            break;
820        case EXECUTE_STATUS:
830            Backup backup = BackupFactory.newBackup(this.name,
840                    this.description, this.date, this.dbLocationPath,
850                    this.zipLocationPath);
860            InternetCafeManager.getInstance().addBackup(backup);
870            BackupFactory.backupToZipArchive(backup);
880            setStatus(SUCCESS_STATUS);
89             break;
900        }
910    }
92  
930    /**
94      * @return Returns the backupPanel.
95      */
96     private BackupPanel getBackupPanel() {
970        return backupPanel;
98     }
990 
100 }

this report was generated by version 1.0.5 of jcoverage.
visit www.jcoverage.com for updates.

copyright © 2003, jcoverage ltd. all rights reserved.
Java is a trademark of Sun Microsystems, Inc. in the United States and other countries.