Package org.wikipediacleaner.api.constants

Examples of org.wikipediacleaner.api.constants.WPCConfiguration


        index++;
      }
    }

    // Search for ISBN templates
    WPCConfiguration config = analysis.getWPCConfiguration();
    List<String[]> isbnTemplates = config.getStringArrayList(WPCConfigurationStringList.ISBN_TEMPLATES);
    if (isbnTemplates != null) {
      for (String[] isbnTemplate : isbnTemplates) {
        if (isbnTemplate.length > 0) {
          List<PageElementTemplate> templates = analysis.getTemplates(isbnTemplate[0]);
          if (templates != null) {
            for (PageElementTemplate template : templates) {
              analyzeTemplateParams(
                  analysis, isbns, template,
                  (isbnTemplate.length > 1) ? isbnTemplate[1] : "1",
                  false, false, false, false);
            }
          }
        }
      }
    }

    // Search for ISBN templates where help is requested
    isbnTemplates = config.getStringArrayList(WPCConfigurationStringList.ISBN_HELP_NEEDED_TEMPLATES);
    if (isbnTemplates != null) {
      for (String[] isbnTemplate : isbnTemplates) {
        if (isbnTemplate.length > 0) {
          List<PageElementTemplate> templates = analysis.getTemplates(isbnTemplate[0]);
          if (templates != null) {
View Full Code Here


    if ((pages == null) || (pages.isEmpty())) {
      return;
    }

    // Check configuration
    WPCConfiguration wpcConfig = wiki.getConfiguration();
    String template = wpcConfig.getString(WPCConfigurationString.DAB_WARNING_TEMPLATE);
    if ((template == null) || (template.trim().length() == 0)) {
      Utilities.displayMessageForMissingConfiguration(
          parent,
          WPCConfigurationString.DAB_WARNING_TEMPLATE.getAttributeName());
      return;
View Full Code Here

    if ((pages == null) || (pages.isEmpty())) {
      return;
    }

    // Check configuration
    WPCConfiguration wpcConfig = wiki.getConfiguration();
    String template = wpcConfig.getString(WPCConfigurationString.ISBN_WARNING_TEMPLATE);
    if ((template == null) || (template.trim().length() == 0)) {
      Utilities.displayMessageForMissingConfiguration(
          parent,
          WPCConfigurationString.ISBN_WARNING_TEMPLATE.getAttributeName());
      return;
View Full Code Here

          result = group.getValue();
        }
      } else {
 
        // Check for a group parameter in the references templates
        WPCConfiguration config = analysis.getWPCConfiguration();
        List<String[]> templates = config.getStringArrayList(WPCConfigurationStringList.REFERENCES_TEMPLATES);
        if (templates != null) {
          PageElementTemplate template = analysis.isInTemplate(getBeginIndex());
          if (template != null) {
            for (String[] elements : templates) {
              if ((elements.length > 1) &&
View Full Code Here

    if (refs == null) {
      return null;
    }

    // Configuration
    WPCConfiguration config = analysis.getWPCConfiguration();
    List<String[]> templates = config.getStringArrayList(WPCConfigurationStringList.REFERENCES_TEMPLATES);

    // Search for a named reference tag
    PageElementTag namedTag = null;
    PageElementTag namedTagInReferences = null;
    PageElementTag namedTagInTemplate = null;
View Full Code Here

          }
        }
      }
    } else {
      // Use __DISAMBIG__ magic word if possible
      WPCConfiguration config = wiki.getConfiguration();
      boolean useDisambig = config.getBoolean(
          WPCConfigurationBoolean.DAB_USE_DISAMBIG_MAGIC_WORD);
      if (useDisambig) {
        ApiPagePropsResult result = new ApiXmlPagePropsResult(wiki, httpClient);
        ApiPagePropsRequest request = new ApiPagePropsRequest(wiki, result);
        request.setDisambiguationStatus(pages);
View Full Code Here

  public void actionCurrentDabList() {
    EnumWikipedia wikipedia = getWikipedia();
    if (wikipedia == null) {
      return;
    }
    WPCConfiguration configuration = wikipedia.getConfiguration();
    List<String> currentDabList = configuration.getStringList(WPCConfigurationStringList.CURRENT_DAB_LIST);
    if ((currentDabList == null) ||
        (currentDabList.isEmpty())) {
      Utilities.displayMessageForMissingConfiguration(
          getParentComponent(),
          WPCConfigurationStringList.CURRENT_DAB_LIST.getAttributeName());
View Full Code Here

  public void actionMostDabLinks() {
    EnumWikipedia wikipedia = getWikipedia();
    if (wikipedia == null) {
      return;
    }
    WPCConfiguration configuration = wikipedia.getConfiguration();
    List<String> mostDabLinks = configuration.getStringList(WPCConfigurationStringList.MOST_DAB_LINKS);
    if ((mostDabLinks == null) ||
        (mostDabLinks.isEmpty())) {
      Utilities.displayMessageForMissingConfiguration(
          getParentComponent(),
          WPCConfigurationStringList.MOST_DAB_LINKS.getAttributeName());
View Full Code Here

  public void actionHelpRequestedOn() {
    EnumWikipedia wikipedia = getWikipedia();
    if (wikipedia == null) {
      return;
    }
    WPCConfiguration configuration = wikipedia.getConfiguration();
    List<Page> templates = configuration.getTemplatesForHelpRequested();
    if ((templates == null) ||
        (templates.isEmpty())) {
      Utilities.displayMessageForMissingConfiguration(
          getParentComponent(),
          WPCConfigurationStringList.TEMPLATES_FOR_HELP_REQUESTED.getAttributeName());
View Full Code Here

      EnumWikipedia wiki,
      MediaWikiListener listener) throws APIException {

    // Retrieve general configuration
    final API api = APIFactory.getAPI();
    final WPCConfiguration wpcConfiguration = wiki.getConfiguration();
    boolean useLabs = wiki.getConfiguration().getBoolean(WPCConfigurationBoolean.CW_USE_LABS);
    final CWConfiguration cwConfiguration = wiki.getCWConfiguration();
    if (!useLabs) {
      String code = wiki.getSettings().getCodeCheckWiki().replace("-", "_");
      try {
        ResponseManager manager = new ResponseManager() {
         
          public void manageResponse(InputStream stream) throws IOException, APIException {
            if (stream != null) {
              cwConfiguration.setGeneralConfiguration(
                  new InputStreamReader(stream, "UTF-8"));
            }
          }
        };
        toolServer.sendGet(
            "~sk/checkwiki/" + code + "/" + code + "_translation.txt",
            manager);
      } catch (APIException e) {
        System.err.println("Error retrieving Check Wiki configuration: " + e.getMessage());
      }
    }

    // Retrieve specific configuration
    try {
      String translationPage = wpcConfiguration.getString(WPCConfigurationString.CW_TRANSLATION_PAGE);
      if (translationPage != null) {
        Page page = DataManager.getPage(
            wiki, translationPage,
            null, null, null);
        api.retrieveContents(wiki, Collections.singleton(page), false, false);
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.