Package org.wikipediacleaner.api.constants

Examples of org.wikipediacleaner.api.constants.WPCConfiguration


   * @see org.wikipediacleaner.api.RecentChangesListener#recentChanges(java.util.List, java.util.Date)
   */
  public void recentChanges(List<RecentChange> newRC, Date currentTime) {

    // Retrieve configuration
    WPCConfiguration config = getWikipedia().getConfiguration();
    long delayForNew = config.getLong(WPCConfigurationLong.RC_NEW_ARTICLE_WITH_DAB_DELAY) * 60 * 1000;
    long delayMonitoring = config.getLong(WPCConfigurationLong.RC_KEEP_MONITORING_DELAY) * 60 * 1000;

    // Add new recent changes to the list
    modelRC.addRecentChanges(newRC);

    // Remove old changes
View Full Code Here


      List<CheckErrorAlgorithm> usedAlgorithms) {
    if ((page == null) || (contents == null)) {
      return contents;
    }
    EnumWikipedia wiki = page.getWikipedia();
    WPCConfiguration config = wiki.getConfiguration();

    // Fix Check Wiki errors
    if (algorithms != null) {
      for (CheckErrorAlgorithm algorithm : algorithms) {
        if (algorithm.isAvailable() &&
            CheckErrorAlgorithms.isAlgorithmActive(wiki, algorithm.getErrorNumber())) {
          String currentContents = contents;
          PageAnalysis analysis = page.getAnalysis(currentContents, true);
          contents = botFix ? algorithm.botFix(analysis) : algorithm.automaticFix(analysis);
          if ((usedAlgorithms != null) && (!contents.equals(currentContents))) {
            usedAlgorithms.add(algorithm);
          }
        }
      }
    }

    // Auto formatting options
    if (!page.isInMainNamespace()) {
      return contents;
    }
    if (!config.getBoolean(WPCConfigurationBoolean.AUTO_ACTIVE)) {
      return contents;
    }
    contents = fixSpaceAroundTitle(page, contents);
    contents = fixLinkDefaultsortCategory(page, contents);
    contents = fixLangLinksAfterCategory(page, contents);
View Full Code Here

   * @return New contents.
   */
  public static String fixLinkDefaultsortCategory(Page page, String contents) {

    // Check configuration
    WPCConfiguration config = page.getWikipedia().getConfiguration();
    boolean option = config.getBoolean(WPCConfigurationBoolean.AUTO_LINK_DEFAULTSORT_CATEGORY);
    if (!option) {
      return contents;
    }
    PageAnalysis analysis = page.getAnalysis(contents, true);

View Full Code Here

   * @return New contents.
   */
  public static String fixCrBeforeCategory(Page page, String contents) {

    // Check configuration
    WPCConfiguration config = page.getWikipedia().getConfiguration();
    String option = config.getString(WPCConfigurationString.AUTO_CR_BEFORE_CATEGORY);
    if (!isValidCountOption(option)) {
      return contents;
    }
    int min = getMinCountOption(option);
    int max = getMaxCountOption(option);
View Full Code Here

   * @return New contents.
   */
  public static String fixCrDefaultsortCategory(Page page, String contents) {

    // Check configuration
    WPCConfiguration config = page.getWikipedia().getConfiguration();
    String option = config.getString(WPCConfigurationString.AUTO_CR_DEFAULTSORT_CATEGORY);
    if (!isValidCountOption(option)) {
      return contents;
    }
    int min = getMinCountOption(option);
    int max = getMaxCountOption(option);
View Full Code Here

   * @return New contents.
   */
  public static String fixCrBetweenCategory(Page page, String contents) {

    // Check configuration
    WPCConfiguration config = page.getWikipedia().getConfiguration();
    String option = config.getString(WPCConfigurationString.AUTO_CR_BETWEEN_CATEGORY);
    if (!isValidCountOption(option)) {
      return contents;
    }
    int min = getMinCountOption(option);
    int max = getMaxCountOption(option);
View Full Code Here

   * @return New contents.
   */
  public static String fixLangLinksAfterCategory(Page page, String contents) {

    // Check configuration
    WPCConfiguration config = page.getWikipedia().getConfiguration();
    boolean option = config.getBoolean(WPCConfigurationBoolean.AUTO_LANGLINK_AFTER_CATEGORY);
    if (!option) {
      return contents;
    }
    PageAnalysis analysis = page.getAnalysis(contents, true);

View Full Code Here

   * @return New contents.
   */
  public static String fixSpaceAroundTitle(Page page, String contents) {

    // Check configuration
    WPCConfiguration config = page.getWikipedia().getConfiguration();
    String option = config.getString(WPCConfigurationString.AUTO_SPACE_AROUND_TITLE);
    if (!isValidCountOption(option)) {
      return contents;
    }
    int min = getMinCountOption(option);
    int max = getMaxCountOption(option);
View Full Code Here

        "abbreviations", true, false, false);
    List<String> abbreviationsList = null;
    if (abbreviations != null) {
      abbreviationsList = WPCConfiguration.convertPropertyToStringList(abbreviations);
    }
    WPCConfiguration config = analysis.getWPCConfiguration();
    List<String[]> generalAbbreviations = null;
    List<String> tmpGeneralAbbreviations = config.getStringList(WPCConfigurationStringList.ABBREVIATIONS);
    if ((tmpGeneralAbbreviations != null) && (tmpGeneralAbbreviations.size() > 0)) {
      generalAbbreviations = new ArrayList<String[]>();
      for (String tmp : tmpGeneralAbbreviations) {
        int pipeIndex1 = tmp.indexOf('|');
        if (pipeIndex1 > 0) {
View Full Code Here

      }
      firstLink = false;
    }

    // Search for internal links created by templates
    WPCConfiguration configuration = pageAnalysis.getWPCConfiguration();
    if (configuration.hasTemplateMatchers()) {
      List<PageElementTemplate> templates = pageAnalysis.getTemplates();
      for (PageElementTemplate template : templates) {
        List<? extends TemplateMatcher> matchers =
          configuration.getTemplateMatchers(template.getTemplateName());
        if (matchers != null) {
          for (TemplateMatcher matcher : matchers) {
            String linkTo = matcher.linksTo(pageAnalysis.getPage(), template);
            if (linkTo != null) {
              for (Page link : links) {
View Full Code Here

TOP

Related Classes of org.wikipediacleaner.api.constants.WPCConfiguration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.