Examples of CWConfigurationError


Examples of org.wikipediacleaner.api.constants.CWConfigurationError

  public static synchronized void initializeAlgorithms(EnumWikipedia wikipedia) {
    List<CheckErrorAlgorithm> algorithms = new ArrayList<CheckErrorAlgorithm>(CWConfiguration.MAX_ERROR_NUMBER);
    DecimalFormat errorNumberFormat = new DecimalFormat("000");
    for (int i = 0; i < CWConfiguration.MAX_ERROR_NUMBER; i++) {
      int errorNumber = i + 1;
      CWConfigurationError error = wikipedia.getCWConfiguration().getErrorConfiguration(errorNumber);
      if (error != null) {
        String className = CheckErrorAlgorithm.class.getName() + errorNumberFormat.format(errorNumber);
        CheckErrorAlgorithm algorithm = null;
        try {
          Class algorithmClass = Class.forName(className);
View Full Code Here

Examples of org.wikipediacleaner.api.constants.CWConfigurationError

      return false;
    }

    // Retrieve configuration
    EnumWikipedia wiki = analysis.getWikipedia();
    CWConfigurationError error68 = wiki.getCWConfiguration().getErrorConfiguration(68);
    List<String> templatesList = null;
    if (error68 != null) {
      String templatesParam = error68.getSpecificProperty("template", true, false, false, false);
      if (templatesParam != null) {
        templatesList = WPCConfiguration.convertPropertyToStringList(templatesParam);
      }
    }
    String strOnlyLanguage = getSpecificProperty("only_language", true, false, false);
View Full Code Here

Examples of org.wikipediacleaner.api.constants.CWConfigurationError

    }

    // Retrieving white lists
    HashMap<String, Page> whiteListPages = new HashMap<String, Page>();
    for (int i = 0; i < CWConfiguration.MAX_ERROR_NUMBER; i++) {
      CWConfigurationError error = cwConfiguration.getErrorConfiguration(i);
      if ((error != null) && (error.getWhiteListPageName() != null)) {
        Page page = DataManager.getPage(
            wiki, error.getWhiteListPageName(), null, null, null);
        whiteListPages.put(error.getWhiteListPageName(), page);
      }
    }
    if (whiteListPages.size() > 0) {
      api.retrieveLinks(wiki, whiteListPages.values());
      for (int i = 0; i < CWConfiguration.MAX_ERROR_NUMBER; i++) {
        CWConfigurationError error = cwConfiguration.getErrorConfiguration(i);
        if ((error != null) && (error.getWhiteListPageName() != null)) {
          Page page = whiteListPages.get(error.getWhiteListPageName());
          error.setWhiteList(page);
        }
      }
    }
    CheckErrorAlgorithms.initializeAlgorithms(wiki);
  }
View Full Code Here

Examples of org.wikipediacleaner.api.constants.CWConfigurationError

      for (CheckErrorAlgorithm algorithm : algorithms) {
        int errorNumber = algorithm.getErrorNumber();
        if (algorithm.isAvailable() &&
            CheckErrorAlgorithms.isAlgorithmActive(wiki, errorNumber)) {
          setText(GT._("Checking whitelist for error {0}", String.valueOf(errorNumber)));
          CWConfigurationError cwConfig = wiki.getCWConfiguration().getErrorConfiguration(errorNumber);
          Set<String> whiteList = cwConfig.getWhiteList();
          if (whiteList != null) {
            details.setLength(0);
            if (whiteList.size() > 0) {
              List<Page> pages = new ArrayList<Page>(whiteList.size());
              for (String pageName : whiteList) {
                Page page = DataManager.getPage(wiki, pageName, null, null, null);
                pages.add(page);
              }
              Collections.sort(pages);
              mw.retrieveContents(wiki, pages, true, false, false, false);
              for (Page page : pages) {
                if (Boolean.FALSE.equals(page.isExisting())) {
                  details.append("<li>");
                  details.append(GT._("The page {0} doesn''t exist on Wikipedia", page.getTitle()));
                  details.append("</li>");
                } else {
                  CheckErrorPage errorPage = CheckError.analyzeError(
                      algorithm, page.getAnalysis(page.getContents(), true));
                  if ((errorPage == null) || (!errorPage.getErrorFound())) {
                    details.append("<li>");
                    String pageLink =
                        "<a href=\"" +
                        wiki.getSettings().getURL(page.getTitle(), false, true) +
                        "\">" +
                        page.getTitle() +
                        "</a>";
                    details.append(GT._("The error hasn''t been detected in page {0}.", pageLink));
                    Boolean errorDetected = checkWiki.isErrorDetected(page, errorNumber);
                    if (errorDetected != null) {
                      details.append(" ");
                      if (Boolean.TRUE.equals(errorDetected)) {
                        details.append(GT._("It's still being detected by CheckWiki."));
                      } else {
                        details.append(GT._("It's not detected either by CheckWiki."));
                      }
                    }
                    details.append("</li>");
                  }
                }
              }
            }
            if (details.length() > 0) {
              String pageLink = String.valueOf(errorNumber);
              if (cwConfig.getWhiteListPageName() != null) {
                pageLink =
                    "<a href=\"" +
                    wiki.getSettings().getURL(cwConfig.getWhiteListPageName(), false, true) +
                    "\">" +
                    String.valueOf(errorNumber) +
                    "</a>";
              }
              result.append(GT._(
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.