<commit_before>package org.intermine.web.struts;

/*
 * Copyright (C) 2002-2007 FlyMine
 *
 * This code may be freely distributed and modified under the
 * terms of the GNU Lesser General Public Licence.  This should
 * be distributed with the code.  See the LICENSE file for more
 * information or http://www.gnu.org/copyleft/lesser.html.
 *
 */

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;
import org.apache.struts.upload.FormFile;

/**
 * Form bean to represent the inputs needed to create a bag from user input.
 *
 * @author <NAME>
 */

public class BuildBagForm extends ActionForm
{
    private String bagName;
    private FormFile formFile;
    private String text;
    private String type;
    private String extraFieldValue;
    private String whichInput;
    
    /**
     * Get the bag type
     * @return the bag type string
     */
    public String getType() {
        return type;
    }

    /**
     * Set the bag type
     * @param type the bag type
     */
    public void setType(String type) {
        this.type = type;
    }

    /**
     * Set the query string
     * @param text the query string
     */
    public void setText(String text) {
        this.text = text;
    }

    /**
     * Get the text string
     * @return the text string
     */
    public String getText() {
        return text;
    }

    /**
     * Set the FormFile.
     * @param formFile the FormFile
     */
    public void setFormFile(FormFile formFile) {
        this.formFile = formFile;   
    }

    /**
     * Get the FormFile.
     * @return the FormFile.
     */
    public FormFile getFormFile() {
        return formFile;
    }

    /**
     * Get the bag name (existing bags)
     * @return the bag name
     */
    public String getBagName() {
        return bagName;
    }

    /**
     * Get the value to use when creating an extra constraint on a BagQuery, configured in
     * BagQueryConfig.
     * @return the extra field value
     */
    public String getExtraFieldValue() {
        return extraFieldValue;
    }

    /**
     * Set the extra field value.
     * @param extraFieldValue the extra field value
     */
    public void setExtraFieldValue(String extraFieldValue) {
        this.extraFieldValue = extraFieldValue;
    }
    
    /**
     * Set the method the user used to upload her bag.  
     * @param whichInput Which method the user used: paste or file
     */
    public void setWhichInput(String whichInput) {
        this.whichInput = whichInput;
    }

    /**
     * Get the method the user used to upload the bag.  Will be either 'paste' or 'file'.  Paste if
     * they typed in the entries via the form.  File if they uploaded a file from their computer.
     * @return which method the user used to upload her bag: paste or file
     */
    public String getWhichInput() {
        return whichInput;
    }

    /**
     * {@inheritDoc}
     */
    public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
        ActionErrors errors = null;
        if (type == null) {
            errors = new ActionErrors();
            errors.add(ActionMessages.GLOBAL_MESSAGE,
                       new ActionMessage("Please select a type."));
        } else if (formFile + text == null) {
            errors = new ActionErrors();
            errors.add(ActionMessages.GLOBAL_MESSAGE,
                       new ActionMessage("Please enter identifiers."));
        } else if (!formFile.getContentType().equals("text")) {
            errors = new ActionErrors();
            errors.add(ActionMessages.GLOBAL_MESSAGE,
                       new ActionMessage("Please upload a text file."));
        }

        return errors;
    }

}<commit_msg>revert changes.<commit_after>package org.intermine.web.struts;

/*
 * Copyright (C) 2002-2007 FlyMine
 *
 * This code may be freely distributed and modified under the
 * terms of the GNU Lesser General Public Licence.  This should
 * be distributed with the code.  See the LICENSE file for more
 * information or http://www.gnu.org/copyleft/lesser.html.
 *
 */

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;
import org.apache.struts.upload.FormFile;

/**
 * Form bean to represent the inputs needed to create a bag from user input.
 *
 * @author <NAME>
 */

public class BuildBagForm extends ActionForm
{
    private String bagName;
    private FormFile formFile;
    private String text;
    private String type;
    private String extraFieldValue;
    private String whichInput;
    
    /**
     * Get the bag type
     * @return the bag type string
     */
    public String getType() {
        return type;
    }

    /**
     * Set the bag type
     * @param type the bag type
     */
    public void setType(String type) {
        this.type = type;
    }

    /**
     * Set the query string
     * @param text the query string
     */
    public void setText(String text) {
        this.text = text;
    }

    /**
     * Get the text string
     * @return the text string
     */
    public String getText() {
        return text;
    }

    /**
     * Set the FormFile.
     * @param formFile the FormFile
     */
    public void setFormFile(FormFile formFile) {
        this.formFile = formFile;   
    }

    /**
     * Get the FormFile.
     * @return the FormFile.
     */
    public FormFile getFormFile() {
        return formFile;
    }

    /**
     * Get the bag name (existing bags)
     * @return the bag name
     */
    public String getBagName() {
        return bagName;
    }

    /**
     * Get the value to use when creating an extra constraint on a BagQuery, configured in
     * BagQueryConfig.
     * @return the extra field value
     */
    public String getExtraFieldValue() {
        return extraFieldValue;
    }

    /**
     * Set the extra field value.
     * @param extraFieldValue the extra field value
     */
    public void setExtraFieldValue(String extraFieldValue) {
        this.extraFieldValue = extraFieldValue;
    }
    
    /**
     * Set the method the user used to upload her bag.  
     * @param whichInput Which method the user used: paste or file
     */
    public void setWhichInput(String whichInput) {
        this.whichInput = whichInput;
    }

    /**
     * Get the method the user used to upload the bag.  Will be either 'paste' or 'file'.  Paste if
     * they typed in the entries via the form.  File if they uploaded a file from their computer.
     * @return which method the user used to upload her bag: paste or file
     */
    public String getWhichInput() {
        return whichInput;
    }



}
{'fraction_non_alphanumeric': 0.08653026427962489, 'fraction_numerical': 0.002273373117362887, 'mean_word_length': 2.2068337129840545, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2404082', 'n_tokens_mistral': 1972, 'n_tokens_neox': 1929, 'n_words': 673}