001/*
002 * This library is part of OpenCms -
003 * the Open Source Content Management System
004 *
005 * Copyright (c) Alkacon Software GmbH & Co. KG (http://www.alkacon.com)
006 *
007 * This library is free software; you can redistribute it and/or
008 * modify it under the terms of the GNU Lesser General Public
009 * License as published by the Free Software Foundation; either
010 * version 2.1 of the License, or (at your option) any later version.
011 *
012 * This library is distributed in the hope that it will be useful,
013 * but WITHOUT ANY WARRANTY; without even the implied warranty of
014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015 * Lesser General Public License for more details.
016 *
017 * For further information about Alkacon Software, please see the
018 * company website: http://www.alkacon.com
019 *
020 * For further information about OpenCms, please see the
021 * project website: http://www.opencms.org
022 *
023 * You should have received a copy of the GNU Lesser General Public
024 * License along with this library; if not, write to the Free Software
025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
026 */
027
028package org.opencms.ui.apps.dbmanager;
029
030import org.opencms.report.A_CmsReportThread;
031import org.opencms.ui.CmsVaadinUtils;
032import org.opencms.ui.apps.Messages;
033import org.opencms.workplace.threads.CmsDatabaseImportThread;
034
035import com.vaadin.ui.Button;
036import com.vaadin.v7.ui.CheckBox;
037import com.vaadin.v7.ui.ComboBox;
038import com.vaadin.v7.ui.Label;
039import com.vaadin.v7.ui.Upload;
040
041/**
042 * HTTP import class.<p>
043 */
044public class CmsDbImportHTTP extends A_CmsHTTPImportForm {
045
046    /**vaadin serial id.*/
047    private static final long serialVersionUID = -2918164495466630578L;
048
049    /**Checkbox for the keep permission option.*/
050    private CheckBox m_keepPermissions;
051
052    /** The OK button. */
053    private Button m_ok;
054
055    /**The site select combo box.*/
056    private ComboBox m_siteSelect;
057
058    /**vaadin component.*/
059    private ComboBox m_projectSelect;
060
061    /** The upload widget. */
062    private Upload m_upload;
063
064    /** The label for the upload widget. */
065    private Label m_uploadLabel;
066
067    /**
068     * public constructor.<p>
069     *
070     * @param app calling app
071     */
072    public CmsDbImportHTTP(I_CmsReportApp app) {
073
074        super(app, "packages", false);
075    }
076
077    /**
078     * @see org.opencms.ui.apps.dbmanager.A_CmsImportForm#getCancelButton()
079     */
080    @Override
081    protected Button getCancelButton() {
082
083        return null;
084    }
085
086    /**
087     * @see org.opencms.ui.apps.dbmanager.A_CmsImportForm#getOkButton()
088     */
089    @Override
090    protected Button getOkButton() {
091
092        return m_ok;
093    }
094
095    @Override
096    protected ComboBox getProjectSelector() {
097
098        return m_projectSelect;
099    }
100
101    /**
102     * @see org.opencms.ui.apps.dbmanager.A_CmsImportForm#getReportPath()
103     */
104    @Override
105    protected String getReportPath() {
106
107        return CmsDbImportApp.PATH_REPORT_HTTP;
108    }
109
110    /**
111     * @see org.opencms.ui.apps.dbmanager.A_CmsImportForm#getSiteSelector()
112     */
113    @Override
114    protected ComboBox getSiteSelector() {
115
116        return m_siteSelect;
117    }
118
119    /**
120     * @see org.opencms.ui.apps.dbmanager.A_CmsImportForm#getThread()
121     */
122    @Override
123    protected A_CmsReportThread getThread() {
124
125        return new CmsDatabaseImportThread(
126            getCmsObject(),
127            m_importFile.getPath(),
128            m_keepPermissions.getValue().booleanValue());
129    }
130
131    /**
132     * @see org.opencms.ui.apps.dbmanager.A_CmsImportForm#getTitle()
133     */
134    @Override
135    protected String getTitle() {
136
137        return CmsVaadinUtils.getMessageText(Messages.GUI_DATABASEAPP_IMPORTHTTP_ADMIN_TOOL_NAME_0);
138    }
139
140    /**
141     * @see org.opencms.ui.apps.dbmanager.A_CmsHTTPImportForm#getUpload()
142     */
143    @Override
144    protected Upload getUpload() {
145
146        return m_upload;
147    }
148
149    /**
150     * @see org.opencms.ui.apps.dbmanager.A_CmsHTTPImportForm#getUploadLabel()
151     */
152    @Override
153    protected Label getUploadLabel() {
154
155        return m_uploadLabel;
156    }
157
158}