<commit_before>// WARNING: DO NOT EDIT THIS FILE. THIS FILE IS MANAGED BY SPRING ROO.
// You may push code into the target .java compilation unit if you wish to edit any member(s).

package org.datacite.mds.web;

import java.io.UnsupportedEncodingException;
import java.lang.Long;
import java.lang.String;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import org.datacite.mds.domain.Dataset;
import org.datacite.mds.domain.Metadata;
import org.joda.time.format.DateTimeFormat;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.core.convert.support.GenericConversionService;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.util.UriUtils;
import org.springframework.web.util.WebUtils;

privileged aspect MetadataController_Roo_Controller {
    
    @Autowired
    private GenericConversionService MetadataController.conversionService;
    
    @RequestMapping(method = RequestMethod.POST)
    public String MetadataController.create(@Valid Metadata metadata, BindingResult result, Model model, HttpServletRequest request) {
        if (result.hasErrors()) {
            model.addAttribute("metadata", metadata);
            addDateTimeFormatPatterns(model);
            return "metadatas/create";
        }
        metadata.persist();
        return "redirect:/metadatas/" + encodeUrlPathSegment(metadata.getId().toString(), request);
    }
    
    @RequestMapping(params = "form", method = RequestMethod.GET)
    public String MetadataController.createForm(Model model) {
        model.addAttribute("metadata", new Metadata());
        addDateTimeFormatPatterns(model);
        List dependencies = new ArrayList();
        if (Dataset.countDatasets() == 0) {
            dependencies.add(new String[]{"dataset", "datasets"});
        }
        model.addAttribute("dependencies", dependencies);
        return "metadatas/create";
    }
    
    @RequestMapping(value = "/{id}", method = RequestMethod.GET)
    public String MetadataController.show(@PathVariable("id") Long id, Model model) {
        addDateTimeFormatPatterns(model);
        model.addAttribute("metadata", Metadata.findMetadata(id));
        model.addAttribute("itemId", id);
        return "metadatas/show";
    }
    
    @RequestMapping(method = RequestMethod.GET)
    public String MetadataController.list(@RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, Model model) {
        if (page != null || size != null) {
            int sizeNo = size == null ? 10 : size.intValue();
            model.addAttribute("metadatas", Metadata.findMetadataEntries(page == null ? 0 : (page.intValue() - 1) * sizeNo, sizeNo));
            float nrOfPages = (float) Metadata.countMetadatas() / sizeNo;
            model.addAttribute("maxPages", (int) ((nrOfPages > (int) nrOfPages || nrOfPages == 0.0) ? nrOfPages + 1 : nrOfPages));
        } else {
            model.addAttribute("metadatas", Metadata.findAllMetadatas());
        }
        addDateTimeFormatPatterns(model);
        return "metadatas/list";
    }
    
    @RequestMapping(params = { "find=ByDataset", "form" }, method = RequestMethod.GET)
    public String MetadataController.findMetadatasByDatasetForm(Model model) {
        model.addAttribute("datasets", Dataset.findAllDatasets());
        return "metadatas/findMetadatasByDataset";
    }
    
    @RequestMapping(params = "find=ByDataset", method = RequestMethod.GET)
    public String MetadataController.findMetadatasByDataset(@RequestParam("dataset") Dataset dataset, Model model) {
        model.addAttribute("metadatas", Metadata.findMetadatasByDataset(dataset).getResultList());
        return "metadatas/list";
    }
    
    void MetadataController.addDateTimeFormatPatterns(Model model) {
        model.addAttribute("metadata_created_date_format", DateTimeFormat.patternForStyle("S-", LocaleContextHolder.getLocale()));
    }
    
    private String MetadataController.encodeUrlPathSegment(String pathSegment, HttpServletRequest request) {
        String enc = request.getCharacterEncoding();
        if (enc == null) {
            enc = WebUtils.DEFAULT_CHARACTER_ENCODING;
        }
        try {
            pathSegment = UriUtils.encodePathSegment(pathSegment, enc);
        }
        catch (UnsupportedEncodingException uee) {}
        return pathSegment;
    }
    
}<commit_msg>changes made by roo<commit_after>// WARNING: DO NOT EDIT THIS FILE. THIS FILE IS MANAGED BY SPRING ROO.
// You may push code into the target .java compilation unit if you wish to edit any member(s).

package org.datacite.mds.web;

import java.io.UnsupportedEncodingException;
import java.lang.Long;
import java.lang.String;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import org.datacite.mds.domain.Dataset;
import org.datacite.mds.domain.Metadata;
import org.joda.time.format.DateTimeFormat;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.core.convert.support.GenericConversionService;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.util.UriUtils;
import org.springframework.web.util.WebUtils;

privileged aspect MetadataController_Roo_Controller {
    
    @Autowired
    private GenericConversionService MetadataController.conversionService;
    
    @RequestMapping(method = RequestMethod.POST)
    public String MetadataController.create(@Valid Metadata metadata, BindingResult result, Model model, HttpServletRequest request) {
        if (result.hasErrors()) {
            model.addAttribute("metadata", metadata);
            addDateTimeFormatPatterns(model);
            return "metadatas/create";
        }
        metadata.persist();
        return "redirect:/metadatas/" + encodeUrlPathSegment(metadata.getId().toString(), request);
    }
    
    @RequestMapping(params = "form", method = RequestMethod.GET)
    public String MetadataController.createForm(Model model) {
        model.addAttribute("metadata", new Metadata());
        addDateTimeFormatPatterns(model);
        List dependencies = new ArrayList();
        if (Dataset.countDatasets() == 0) {
            dependencies.add(new String[]{"dataset", "datasets"});
        }
        model.addAttribute("dependencies", dependencies);
        return "metadatas/create";
    }
    
    @RequestMapping(value = "/{id}", method = RequestMethod.GET)
    public String MetadataController.show(@PathVariable("id") Long id, Model model) {
        addDateTimeFormatPatterns(model);
        model.addAttribute("metadata", Metadata.findMetadata(id));
        model.addAttribute("itemId", id);
        return "metadatas/show";
    }
    
    @RequestMapping(method = RequestMethod.GET)
    public String MetadataController.list(@RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, Model model) {
        if (page != null || size != null) {
            int sizeNo = size == null ? 10 : size.intValue();
            model.addAttribute("metadatas", Metadata.findMetadataEntries(page == null ? 0 : (page.intValue() - 1) * sizeNo, sizeNo));
            float nrOfPages = (float) Metadata.countMetadatas() / sizeNo;
            model.addAttribute("maxPages", (int) ((nrOfPages > (int) nrOfPages || nrOfPages == 0.0) ? nrOfPages + 1 : nrOfPages));
        } else {
            model.addAttribute("metadatas", Metadata.findAllMetadatas());
        }
        addDateTimeFormatPatterns(model);
        return "metadatas/list";
    }
    
    @RequestMapping(params = { "find=ByDataset", "form" }, method = RequestMethod.GET)
    public String MetadataController.findMetadatasByDatasetForm(Model model) {
        model.addAttribute("datasets", Dataset.findAllDatasets());
        return "metadatas/findMetadatasByDataset";
    }
    
    @RequestMapping(params = "find=ByDataset", method = RequestMethod.GET)
    public String MetadataController.findMetadatasByDataset(@RequestParam("dataset") Dataset dataset, Model model) {
        model.addAttribute("metadatas", Metadata.findMetadatasByDataset(dataset).getResultList());
        return "metadatas/list";
    }
    
    void MetadataController.addDateTimeFormatPatterns(Model model) {
        model.addAttribute("metadata_created_date_format", DateTimeFormat.patternForStyle("FF", LocaleContextHolder.getLocale()));
    }
    
    private String MetadataController.encodeUrlPathSegment(String pathSegment, HttpServletRequest request) {
        String enc = request.getCharacterEncoding();
        if (enc == null) {
            enc = WebUtils.DEFAULT_CHARACTER_ENCODING;
        }
        try {
            pathSegment = UriUtils.encodePathSegment(pathSegment, enc);
        }
        catch (UnsupportedEncodingException uee) {}
        return pathSegment;
    }
    
}
{'fraction_non_alphanumeric': 0.10942656765676567, 'fraction_numerical': 0.0020627062706270625, 'mean_word_length': 3.7371763556424034, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '7591464', 'n_tokens_mistral': 2656, 'n_tokens_neox': 2626, 'n_words': 535}