<commit_before>/*
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 *
 */

package com.xpn.xwiki.web;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

public class EditForm extends XWikiForm
{

    // ---- Form fields -------------------------------------------------
    private String content;

    private String web;

    private String name;

    private String parent;

    private String creator;

    private String template;

    private String language;

    private String defaultLanguage;

    private String defaultTemplate;

    private String title;

    private String comment;

    private boolean isMinorEdit = false;

    private String tags;

    private boolean lockForce;

    private String syntaxId;

    @Override
    public void readRequest()
    {
        XWikiRequest request = getRequest();
        setContent(request.getParameter("content"));
        setWeb(request.getParameter("web"));
        setName(request.getParameter("name"));
        setParent(request.getParameter("parent"));
        setTemplate(request.getParameter("template"));
        setDefaultTemplate(request.getParameter("default_template"));
        setCreator(request.getParameter("creator"));
        setLanguage(request.getParameter("language"));
        setTitle(request.getParameter("title"));
        setComment(request.getParameter("comment"));
        setDefaultLanguage(request.getParameter("default_language"));
        setTags(request.getParameterValues("tags"));
        setLockForce("1".equals(request.getParameter("force")));
        setMinorEdit(request.getParameter("minor_edit") != null);
        setSyntaxId(request.getParameter("syntaxId"));
    }

    public void setTags(String[] parameter)
    {
        if (parameter == null) {
            this.tags = null;
            return;
        }
        StringBuffer tags = new StringBuffer();
        boolean first = true;
        for (int i = 0; i < parameter.length; ++i) {
            if (!parameter[i].equals("")) {
                if (first) {
                    first = false;
                } else {
                    tags.append("|");
                }
                tags.append(parameter[i]);
            }
        }
        this.tags = tags.toString();
    }

    public String getTags()
    {
        return this.tags;
    }

    public String getContent()
    {
        return this.content;
    }

    public void setContent(String content)
    {
        this.content = content;
    }

    public String getWeb()
    {
        return this.web;
    }

    public void setWeb(String web)
    {
        this.web = web;
    }

    public String getName()
    {
        return this.name;
    }

    public void setName(String name)
    {
        this.name = name;
    }

    public String getLanguage()
    {
        return this.language;
    }

    public void setLanguage(String language)
    {
        this.language = language;
    }

    public int getObjectNumbers(String prefix)
    {
        String nb = getRequest().getParameter(prefix + "_nb");
        if ((nb == null) || (nb.equals(""))) {
            return 0;
        }
        return Integer.parseInt(nb);
    }

    public Map getObject(String prefix)
    {
        Map map = getRequest().getParameterMap();
        HashMap map2 = new HashMap();
        Iterator it = map.keySet().iterator();
        while (it.hasNext()) {
            String name = (String) it.next();
            if (name.startsWith(prefix + "_")) {
                String newname = name.substring(prefix.length() + 1);
                map2.put(newname, map.get(name));
            }
        }
        return map2;
    }

    public String getParent()
    {
        return this.parent;
    }

    public void setParent(String parent)
    {
        this.parent = parent;
    }

    public String getCreator()
    {
        return this.creator;
    }

    public void setCreator(String creator)
    {
        this.creator = creator;
    }

    public String getTemplate()
    {
        return this.template;
    }

    public void setTemplate(String template)
    {
        this.template = template;
    }

    public String getDefaultTemplate()
    {
        return this.defaultTemplate;
    }

    public void setDefaultTemplate(String defaultTemplate)
    {
        this.defaultTemplate = defaultTemplate;
    }

    public String getDefaultLanguage()
    {
        return this.defaultLanguage;
    }

    public void setDefaultLanguage(String defaultLanguage)
    {
        this.defaultLanguage = defaultLanguage;
    }

    public String getTitle()
    {
        return this.title;
    }

    public void setTitle(String title)
    {
        this.title = title;
    }

    public String getComment()
    {
        return this.comment;
    }

    public void setComment(String comment)
    {
        this.comment = comment;
    }

    public boolean isMinorEdit()
    {
        return this.isMinorEdit;
    }

    public void setMinorEdit(boolean isMinorEdit)
    {
        this.isMinorEdit = isMinorEdit;
    }

    public boolean isLockForce()
    {
        return this.lockForce;
    }

    public void setLockForce(boolean lockForce)
    {
        this.lockForce = lockForce;
    }

    public String getSyntaxId()
    {
        return this.syntaxId;
    }

    public void setSyntaxId(String syntaxId)
    {
        this.syntaxId = syntaxId;
    }
}
<commit_msg>XWIKI-2681: Minor edit checkbox and default language field doesn't work rename fields to minorEdit and defaultLanguage add selenium test for minor edit feature<commit_after>/*
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 *
 */

package com.xpn.xwiki.web;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

public class EditForm extends XWikiForm
{

    // ---- Form fields -------------------------------------------------
    private String content;

    private String web;

    private String name;

    private String parent;

    private String creator;

    private String template;

    private String language;

    private String defaultLanguage;

    private String defaultTemplate;

    private String title;

    private String comment;

    private boolean isMinorEdit = false;

    private String tags;

    private boolean lockForce;

    private String syntaxId;

    @Override
    public void readRequest()
    {
        XWikiRequest request = getRequest();
        setContent(request.getParameter("content"));
        setWeb(request.getParameter("web"));
        setName(request.getParameter("name"));
        setParent(request.getParameter("parent"));
        setTemplate(request.getParameter("template"));
        setDefaultTemplate(request.getParameter("default_template"));
        setCreator(request.getParameter("creator"));
        setLanguage(request.getParameter("language"));
        setTitle(request.getParameter("title"));
        setComment(request.getParameter("comment"));
        setDefaultLanguage(request.getParameter("defaultLanguage"));
        setTags(request.getParameterValues("tags"));
        setLockForce("1".equals(request.getParameter("force")));
        setMinorEdit(request.getParameter("minorEdit") != null);
        setSyntaxId(request.getParameter("syntaxId"));
    }

    public void setTags(String[] parameter)
    {
        if (parameter == null) {
            this.tags = null;
            return;
        }
        StringBuffer tags = new StringBuffer();
        boolean first = true;
        for (int i = 0; i < parameter.length; ++i) {
            if (!parameter[i].equals("")) {
                if (first) {
                    first = false;
                } else {
                    tags.append("|");
                }
                tags.append(parameter[i]);
            }
        }
        this.tags = tags.toString();
    }

    public String getTags()
    {
        return this.tags;
    }

    public String getContent()
    {
        return this.content;
    }

    public void setContent(String content)
    {
        this.content = content;
    }

    public String getWeb()
    {
        return this.web;
    }

    public void setWeb(String web)
    {
        this.web = web;
    }

    public String getName()
    {
        return this.name;
    }

    public void setName(String name)
    {
        this.name = name;
    }

    public String getLanguage()
    {
        return this.language;
    }

    public void setLanguage(String language)
    {
        this.language = language;
    }

    public int getObjectNumbers(String prefix)
    {
        String nb = getRequest().getParameter(prefix + "_nb");
        if ((nb == null) || (nb.equals(""))) {
            return 0;
        }
        return Integer.parseInt(nb);
    }

    public Map getObject(String prefix)
    {
        Map map = getRequest().getParameterMap();
        HashMap map2 = new HashMap();
        Iterator it = map.keySet().iterator();
        while (it.hasNext()) {
            String name = (String) it.next();
            if (name.startsWith(prefix + "_")) {
                String newname = name.substring(prefix.length() + 1);
                map2.put(newname, map.get(name));
            }
        }
        return map2;
    }

    public String getParent()
    {
        return this.parent;
    }

    public void setParent(String parent)
    {
        this.parent = parent;
    }

    public String getCreator()
    {
        return this.creator;
    }

    public void setCreator(String creator)
    {
        this.creator = creator;
    }

    public String getTemplate()
    {
        return this.template;
    }

    public void setTemplate(String template)
    {
        this.template = template;
    }

    public String getDefaultTemplate()
    {
        return this.defaultTemplate;
    }

    public void setDefaultTemplate(String defaultTemplate)
    {
        this.defaultTemplate = defaultTemplate;
    }

    public String getDefaultLanguage()
    {
        return this.defaultLanguage;
    }

    public void setDefaultLanguage(String defaultLanguage)
    {
        this.defaultLanguage = defaultLanguage;
    }

    public String getTitle()
    {
        return this.title;
    }

    public void setTitle(String title)
    {
        this.title = title;
    }

    public String getComment()
    {
        return this.comment;
    }

    public void setComment(String comment)
    {
        this.comment = comment;
    }

    public boolean isMinorEdit()
    {
        return this.isMinorEdit;
    }

    public void setMinorEdit(boolean isMinorEdit)
    {
        this.isMinorEdit = isMinorEdit;
    }

    public boolean isLockForce()
    {
        return this.lockForce;
    }

    public void setLockForce(boolean lockForce)
    {
        this.lockForce = lockForce;
    }

    public String getSyntaxId()
    {
        return this.syntaxId;
    }

    public void setSyntaxId(String syntaxId)
    {
        this.syntaxId = syntaxId;
    }
}

{'fraction_non_alphanumeric': 0.10120272194967558, 'fraction_numerical': 0.003481563538534578, 'mean_word_length': 2.1269173676397823, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4889575', 'n_tokens_mistral': 3452, 'n_tokens_neox': 3304, 'n_words': 942}