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 GmbH & Co. KG, 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.workplace.tools.content.languagecopy;
029
030import org.opencms.jsp.CmsJspActionElement;
031import org.opencms.report.I_CmsReportThread;
032import org.opencms.util.CmsStringUtil;
033import org.opencms.workplace.list.A_CmsListReport;
034
035import javax.servlet.http.HttpServletRequest;
036import javax.servlet.http.HttpServletResponse;
037import javax.servlet.jsp.PageContext;
038
039/**
040 * Provides a report for copying XML content language nodes from source language to target language.
041 * <p>
042 *
043 * @since 7.5.1
044 */
045public class CmsLanguageCopyReport extends A_CmsListReport {
046
047    /** The resources to copy. */
048    private String m_copyresources;
049
050    /** Signals whether to delete the original language node or not. */
051    private String m_paramDelete;
052
053    /** The source language. */
054    private String m_sourcelanguage;
055
056    /** The source language. */
057    private String m_targetlanguage;
058
059    /**
060     * Public constructor with JSP action element.
061     * <p>
062     *
063     * @param jsp an initialized JSP action element
064     */
065    public CmsLanguageCopyReport(final CmsJspActionElement jsp) {
066
067        super(jsp);
068    }
069
070    /**
071     * Public constructor with JSP variables.
072     * <p>
073     *
074     * @param context the JSP page context
075     * @param req the JSP request
076     * @param res the JSP response
077     */
078    public CmsLanguageCopyReport(
079        final PageContext context,
080        final HttpServletRequest req,
081        final HttpServletResponse res) {
082
083        this(new CmsJspActionElement(context, req, res));
084    }
085
086    /**
087     * Returns the paramDelete.<p>
088     *
089     * @return the paramDelete
090     */
091    public String getParamDelete() {
092
093        return m_paramDelete;
094    }
095
096    /**
097     * @see org.opencms.workplace.list.A_CmsListReport#initializeThread()
098     */
099    @Override
100    public I_CmsReportThread initializeThread() {
101
102        I_CmsReportThread exportThread = new CmsLanguageCopyThread(
103            getCms(),
104            CmsStringUtil.splitAsArray(m_copyresources, ","),
105            Boolean.valueOf(m_paramDelete).booleanValue(),
106            m_sourcelanguage,
107            m_targetlanguage);
108
109        return exportThread;
110    }
111
112    /**
113     * Sets the resources to copy.<p>
114     *
115     * @param resources the resources to copy
116     */
117    public void setParamCopyresources(String resources) {
118
119        m_copyresources = resources;
120    }
121
122    /**
123     * Sets the paramDelete.<p>
124     *
125     * @param paramDelete the paramDelete to set
126     */
127    public void setParamDelete(String paramDelete) {
128
129        m_paramDelete = paramDelete;
130    }
131
132    /**
133     * Sets the source language.<p>
134     *
135     * @param language the source language
136     */
137    public void setParamSourcelanguage(String language) {
138
139        m_sourcelanguage = language;
140    }
141
142    /**
143     * Sets the target language.<p>
144     *
145     * @param language the target language
146     */
147    public void setParamTargetlanguage(String language) {
148
149        m_targetlanguage = language;
150    }
151
152}