<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.celements.inheritor;

import java.util.Properties;

import org.xwiki.component.annotation.Component;
import org.xwiki.component.annotation.Requirement;
import org.xwiki.component.phase.Initializable;
import org.xwiki.component.phase.InitializationException;
import org.xwiki.configuration.ConfigurationSource;

/**
 * All configuration options for the Template Path transformation to access
 * templates on disk based on inheritance.
 * 
 */
@Component
public class DefaultTemplatePathTransformationConfiguration implements
    TemplatePathTransformationConfiguration, Initializable {
  /**
   * Prefix for configuration keys for the Icon transformation module.
   */
  private static final String PREFIX = "celRendering.transformation.templatePath.";

  /**
   * Default Tools.
   */
  private Properties defaultMappings = new Properties();

  /**
   * Defines from where to read the rendering configuration data.
   */
  @Requirement
  private ConfigurationSource configuration;

  /**
   * {@inheritDoc}
   * 
   * @see org.xwiki.component.phase.Initializable#initialize()
   */
  public void initialize() throws InitializationException {
    // Default Mappings
    this.defaultMappings.setProperty("Templates", "celTemplates");
    this.defaultMappings.setProperty("Ajax", "celAjax");
  }

  /**
   * {@inheritDoc}
   * 
   * @see com.celements.inheritor.TemplatePathTransformationConfiguration#getMappings()
   */
  public Properties getMappings() {
    // Merge default properties and properties defined in the configuration
    Properties props = new Properties();
    props.putAll(this.defaultMappings);
    props.putAll(this.configuration.getProperty(PREFIX + "mappings", Properties.class));
    return props;
  }
}<commit_msg>add default templatePathTransformation mapping for Mails -> celMails<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.celements.inheritor;

import java.util.Properties;

import org.xwiki.component.annotation.Component;
import org.xwiki.component.annotation.Requirement;
import org.xwiki.component.phase.Initializable;
import org.xwiki.component.phase.InitializationException;
import org.xwiki.configuration.ConfigurationSource;

/**
 * All configuration options for the Template Path transformation to access
 * templates on disk based on inheritance.
 * 
 */
@Component
public class DefaultTemplatePathTransformationConfiguration implements
    TemplatePathTransformationConfiguration, Initializable {
  /**
   * Prefix for configuration keys for the Icon transformation module.
   */
  private static final String PREFIX = "celRendering.transformation.templatePath.";

  /**
   * Default Tools.
   */
  private Properties defaultMappings = new Properties();

  /**
   * Defines from where to read the rendering configuration data.
   */
  @Requirement
  private ConfigurationSource configuration;

  /**
   * {@inheritDoc}
   * 
   * @see org.xwiki.component.phase.Initializable#initialize()
   */
  public void initialize() throws InitializationException {
    // Default Mappings
    this.defaultMappings.setProperty("Templates", "celTemplates");
    this.defaultMappings.setProperty("Ajax", "celAjax");
    this.defaultMappings.setProperty("Mails", "celMails");
  }

  /**
   * {@inheritDoc}
   * 
   * @see com.celements.inheritor.TemplatePathTransformationConfiguration#getMappings()
   */
  public Properties getMappings() {
    // Merge default properties and properties defined in the configuration
    Properties props = new Properties();
    props.putAll(this.defaultMappings);
    props.putAll(this.configuration.getProperty(PREFIX + "mappings", Properties.class));
    return props;
  }
}
{'fraction_non_alphanumeric': 0.0843462246777164, 'fraction_numerical': 0.004788213627992633, 'mean_word_length': 4.19712918660287, 'pattern_counts': {'":': 0, '<': 3, '<?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': '3527916', 'n_tokens_mistral': 1391, 'n_tokens_neox': 1351, 'n_words': 502}