Package org.wikipediacleaner.api.data

Examples of org.wikipediacleaner.api.data.Page


      List results = xpa.selectNodes(root);
      Iterator iter = results.iterator();
      XPath xpaTitle = XPath.newInstance("./@title");
      while (iter.hasNext()) {
        Element currentNode = (Element) iter.next();
        Page page = DataManager.getPage(
            getWiki(), xpaTitle.valueOf(currentNode), null, null, null);
        if (page.isArticle()) {
          watchlist.add(page);
        }
      }

      // Retrieve continue
View Full Code Here


      XPath xpaNs = XPath.newInstance("./@ns");
      XPath xpaTitle = XPath.newInstance("./@title");
      XPath xpaRedirLinks = XPath.newInstance("redirlinks/bl");
      while (itBacklink.hasNext()) {
        Element currentBacklink = (Element) itBacklink.next();
        Page link = DataManager.getPage(
            getWiki(), xpaTitle.valueOf(currentBacklink), null, null, null);
        link.setNamespace(xpaNs.valueOf(currentBacklink));
        link.setPageId(xpaPageId.valueOf(currentBacklink));
        if (currentBacklink.getAttribute("redirect") != null) {
          link.addRedirect(page);
        }
        if (!list.contains(link)) {
          list.add(link);
        }

        // Links through redirects
        List listRedirLinks = xpaRedirLinks.selectNodes(currentBacklink);
        if (listRedirLinks != null) {
          List<Page> linkList = new ArrayList<Page>();
          Iterator itRedirLink = listRedirLinks.iterator();
          while (itRedirLink.hasNext()) {
            currentBacklink = (Element) itRedirLink.next();
            Page link2 = DataManager.getPage(
                getWiki(), xpaTitle.valueOf(currentBacklink), null, null, null);
            link2.setNamespace(xpaNs.valueOf(currentBacklink));
            link2.setPageId(xpaPageId.valueOf(currentBacklink));
            if (!list.contains(link2)) {
              list.add(link2);
            }
            if (!linkList.contains(link2)) {
              linkList.add(link2);
View Full Code Here

        String title = currentNode.getAttributeValue("title");
        for (Page p : pages) {
          tmpPages.clear();
          Iterator<Page> it = p.getRedirectIteratorWithPage();
          while (it.hasNext()) {
            Page p2 = it.next();
            tmpPages.add(p2);
            if ((p2.getTitle() != null) &&
                (Page.areSameTitle(p2.getTitle(), title))) {
              Boolean disambig = Boolean.FALSE;
              Element pageProps = currentNode.getChild("pageprops");
              if ((pageProps != null) && (pageProps.getAttribute("disambiguation") != null)) {
                disambig = Boolean.TRUE;
              }
View Full Code Here

      XPath xpaPageId = XPath.newInstance("./@pageid");
      XPath xpaNs = XPath.newInstance("./@ns");
      XPath xpaTitle = XPath.newInstance("./@title");
      while (iter.hasNext()) {
        Element currentNode = (Element) iter.next();
        Page page = DataManager.getPage(
            getWiki(), xpaTitle.valueOf(currentNode), null, null, null);
        page.setNamespace(xpaNs.valueOf(currentNode));
        page.setPageId(xpaPageId.valueOf(currentNode));
        list.add(page);
      }

      // Retrieve continue
      return shouldContinue(
View Full Code Here

        if (p.isRedirect()) {
          JMenu submenu1 = new JMenu(p.getTitle());
         
          Iterator<Page> iter = p.getRedirectIteratorWithPage();
          while (iter.hasNext()) {
            Page pageTmp = iter.next();
            addItem(
                submenu1, pageTmp, null, true,
                new ReplaceAllLinksAction(textPane, page, pageTmp.getTitle(), null));
          }
         
          submenuLink.add(submenu1);
        } else {
          addItem(
View Full Code Here

      List results = xpa.selectNodes(root);
      Iterator iter = results.iterator();
      while (iter.hasNext()) {
        Element currentNode = (Element) iter.next();
        String title = currentNode.getAttributeValue("title");
        Page page = DataManager.getPage(getWiki(), title, null, null, null);
        list.add(page);
      }

      // Retrieve continue
      return false; // Not continuing
View Full Code Here

        String title = xpaTitle.valueOf(currentNode);
        for (Page p : pages) {
          tmpPages.clear();
          Iterator<Page> it = p.getRedirectIteratorWithPage();
          while (it.hasNext()) {
            Page p2 = it.next();
            tmpPages.add(p2);
            if ((p2.getTitle() != null) &&
                (Page.areSameTitle(p2.getTitle(), title))) {
              List listCategories = xpaCategory.selectNodes(currentNode);
              if (listCategories.size() > 0) {
                for (Page p3 : tmpPages) {
                  p3.setDisambiguationPage(Boolean.TRUE);
                }
View Full Code Here

      Iterator iter = results.iterator();
      XPath xpaNs = XPath.newInstance("./@ns");
      XPath xpaTitle = XPath.newInstance("./@title");
      while (iter.hasNext()) {
        Element currentNode = (Element) iter.next();
        Page similarPage = DataManager.getPage(
            getWiki(), xpaTitle.valueOf(currentNode), null, null, null);
        similarPage.setNamespace(xpaNs.valueOf(currentNode));
        list.add(similarPage);
      }

      // Retrieve continue
      return shouldContinue(
View Full Code Here

   * @param e Event triggering this call.
   * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
   */
  public void actionPerformed(ActionEvent e) {
    CheckWiki checkWiki = APIFactory.getCheckWiki();
    Page page = DataManager.getPage(wiki, title, null, null, null);
    List<CheckWikiDetection> detections = checkWiki.check(page);
    if (detections == null) {
      Utilities.displayWarning(
          parent,
          GT._("Unable to retrieve analysis from CheckWiki."));
View Full Code Here

        }
        String namespace = pageNode.getAttributeValue("ns");
        for (Page tmpPage : pages) {
          Iterator<Page> itPage = tmpPage.getRedirectIteratorWithPage();
          while (itPage.hasNext()) {
            Page page = itPage.next();
            boolean samePage = false;
            if ((pageId != null) && (page.getPageId() != null)) {
              samePage = pageId.equals(page.getPageId());
            } else {
              samePage = Page.areSameTitle(page.getTitle(), title);
            }
            if (samePage) {
              page.setNamespace(namespace);
              updatePageInformation(pageNode, page);
 
              // Retrieve revisions
              if (!Boolean.FALSE.equals(page.isExisting())) {
                XPath xpaRevisions = XPath.newInstance("revisions/rev");
                Element revNode = (Element) xpaRevisions.selectSingleNode(pageNode);
                if (revNode != null) {
                  page.setContents(revNode.getText());
                  page.setExisting(Boolean.TRUE);
                  page.setRevisionId(revNode.getAttributeValue("revid"));
                  page.setContentsTimestamp(revNode.getAttributeValue("timestamp"));
                }
              }
            }
          }
        }
View Full Code Here

TOP

Related Classes of org.wikipediacleaner.api.data.Page

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.