<commit_before>/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 /**
 * Copyright © 2014 EMBL - European Bioinformatics Institute
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); 
 * you may not use this file except in compliance with the License.  
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package uk.ac.ebi.emma.controller;

import java.util.List;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.Errors;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import uk.ac.ebi.emma.Exception.PersistFailedException;
import uk.ac.ebi.emma.entity.Allele;
import uk.ac.ebi.emma.entity.Gene;
import uk.ac.ebi.emma.manager.AllelesManager;
import uk.ac.ebi.emma.manager.GenesManager;
import uk.ac.ebi.emma.util.Filter;
import uk.ac.ebi.emma.validator.AlleleValidator;

/**
 *
 * @author mrelac
 */
@Controller
@RequestMapping("/alleleManagementDetail")
public class AlleleManagementDetailController {
    @Autowired
    private final GenesManager genesManager = new GenesManager();
    @Autowired
    private final AllelesManager allelesManager = new AllelesManager();
    
    @Autowired
    private AlleleValidator validator;

    /**
     * Return the full list of genes
     * @param model the Genes list data model
     * 
     * @return the full list of genes
     */
    @RequestMapping(method=RequestMethod.GET)
    @ModelAttribute
    public String initialize(Model model)
    {
        List<Gene> genesList = genesManager.getGenes();
        model.addAttribute("genesList", genesList);
        
        return "alleleManagementDetail";
    }
    
    /**
     * 'Edit/New Allele' icon implementation
     * 
     * @param allele_key the allele ID being edited (a value of 0 indicates a new
     *                allele is to be added).
     * @param filterAlleleKey the Allele Id part of the filter
     * @param filterAlleleName the Allele name part of the filter
     * @param filterAlleleSymbol the Allele symbol part of the filter
     * @param filterAlleleMgiReference the MGI reference part of the filter
     * @param filterGeneKey the Gene Id part of the filter
     * @param filterGeneName the Gene name part of the filter
     * @param filterGeneSymbol the Gene symbol part of the filter
     * @param model the model
     * @return the view to show
     */
    @RequestMapping(value="/edit", method=RequestMethod.GET)
    public String edit(
            @RequestParam(value="allele_key") Integer allele_key
            
          , @RequestParam(value="filterAlleleKey") String filterAlleleKey
          , @RequestParam(value="filterAlleleName") String filterAlleleName
          , @RequestParam(value="filterAlleleSymbol") String filterAlleleSymbol
          , @RequestParam(value="filterAlleleMgiReference") String filterAlleleMgiReference
          , @RequestParam(value="filterGeneKey") String filterGeneKey
          , @RequestParam(value="filterGeneName") String filterGeneName
          , @RequestParam(value="filterGeneSymbol") String filterGeneSymbol
            <commit_msg>Removed unneeded code.<commit_after>/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 /**
 * Copyright © 2014 EMBL - European Bioinformatics Institute
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); 
 * you may not use this file except in compliance with the License.  
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package uk.ac.ebi.emma.controller;

import java.util.List;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.Errors;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import uk.ac.ebi.emma.Exception.PersistFailedException;
import uk.ac.ebi.emma.entity.Allele;
import uk.ac.ebi.emma.entity.Gene;
import uk.ac.ebi.emma.manager.AllelesManager;
import uk.ac.ebi.emma.manager.GenesManager;
import uk.ac.ebi.emma.util.Filter;
import uk.ac.ebi.emma.validator.AlleleValidator;

/**
 *
 * @author mrelac
 */
@Controller
@RequestMapping("/alleleManagementDetail")
public class AlleleManagementDetailController {
    @Autowired
    private final AllelesManager allelesManager = new AllelesManager();
    
    @Autowired
    private AlleleValidator validator;

    /**
     * 'Edit/New Allele' icon implementation
     * 
     * @param allele_key the allele ID being edited (a value of 0 indicates a new
     *                allele is to be added).
     * @param filterAlleleKey the Allele Id part of the filter
     * @param filterAlleleName the Allele name part of the filter
     * @param filterAlleleSymbol the Allele symbol part of the filter
     * @param filterAlleleMgiReference the MGI reference part of the filter
     * @param filterGeneKey the Gene Id part of the filter
     * @param filterGeneName the Gene name part of the filter
     * @param filterGeneSymbol the Gene symbol part of the filter
     * @param model the model
     * @return the view to show
     */
    @RequestMapping(value="/edit", method=RequestMethod.GET)
    public String edit(
            @RequestParam(value="allele_key") Integer allele_key
            
          , @RequestParam(value="filterAlleleKey") String filterAlleleKey
          , @RequestParam(value="filterAlleleName") String filterAlleleName
          , @RequestParam(value="filterAlleleSymbol") String filterAlleleSymbol
          , @RequestParam(value="filterAlleleMgiReference") String filterAlleleMgiReference
          , @RequestParam(value="filterGeneKey") String filterGeneKey
          , @RequestParam(value="filterGeneName") String filterGeneName
          , @RequestParam(value="filterGeneSymbol") String filterGeneSymbol
            
{'fraction_non_alphanumeric': 0.08134228187919464, 'fraction_numerical': 0.0024161073825503354, 'mean_word_length': 3.745859872611465, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '5109891', 'n_tokens_mistral': 2049, 'n_tokens_neox': 2001, 'n_words': 625}