Examples of PageDAO


Examples of com.germinus.mashupbuilder.dao.jdbc.PageDAO

            } else {
                response.setContentType("application/x-json");
            }

            DAOFactory daoFactory = DAOFactory.getDAOFactory(DAOFactory.FactoryType.JDBC);
            PageDAO pageDAO = (PageDAO) daoFactory.getDAO(Page.class);
            List<Page> pages = pageDAO.getAll();

            if (scriptTag) {
                out.write(cb + "(");
            }
            JsonFormatter jsFmt = new JsonFormatter();
View Full Code Here

Examples of com.germinus.mashupbuilder.dao.jdbc.PageDAO

                Page pagePattern = new Page();
                pagePattern.setId(intId);

                DAOFactory daoFactory = DAOFactory.getDAOFactory(DAOFactory.FactoryType.JDBC);
                PageDAO pageDAO = (PageDAO) daoFactory.getDAO(Page.class);
                Page pageFound = pageDAO.find(pagePattern);
                if (pageFound != null) {
                    StringBuilder sb = new StringBuilder();
                    if (callback != null) {
                        sb.append(callback).append("(");
                    } else if (!JSON.equals(json)) {
View Full Code Here

Examples of com.germinus.mashupbuilder.dao.jdbc.PageDAO

            if (description == null) {
                description = "";
            }

            DAOFactory daoFactory = DAOFactory.getDAOFactory(DAOFactory.FactoryType.JDBC);
            PageDAO pageDAO = (PageDAO) daoFactory.getDAO(Page.class);
            Page page = null;
            if (idSt != null) {
                int id = Integer.parseInt(idSt);
                page = new Page(id, name, description, json);
                pageDAO.updateJson(page);
            } else {
                page = new Page(name, description, json);
                int id = pageDAO.saveAndGetId(page);
                page.setId(id);
            }
            out.write(XMLFormatter.toXML(page));
        } catch (NumberFormatException nbe) {
            Logger.getLogger(PageController.class.getName()).log(Level.SEVERE, null, nbe);
View Full Code Here

Examples of org.broadleafcommerce.cms.page.dao.PageDao

        List<Page> pages = new ArrayList<Page>();
        pages.add(p1);
        pages.add(p2);
        pages.add(p3);

        PageDao pageDao = EasyMock.createMock(PageDao.class);
        EasyMock.expect(pageDao.readOnlineAndIncludedPages(5, 0, "fullUrl")).andReturn(pages);
        EasyMock.replay(pageDao);

        PageSiteMapGenerator psmg = new PageSiteMapGenerator();
        psmg.setPageDao(pageDao);
        psmg.setRowLimit(5);
View Full Code Here

Examples of org.timedex.dao.interfaces.PageDAO

  }
 
  public static void iterate(int iterations) {
    PageMetaDAO pageMetaDAO = new PageMetaDAOImpl();
    PageLinkDAO pageLinkDAO = new PageLinkDAOImpl();
    PageDAO pageDAO = new PageDAOImpl();
   
    for (int iteration = 0; iteration < iterations; iteration++) {
      System.out.print("Performing iteration " + (iteration + 1) + " ... ");
     
      int pages = 0;
      try {
        sessionStrategy.beginTransaction();
        pages = pageDAO.count();
        sessionStrategy.commitTransaction();
      } finally {
        sessionStrategy.rollbackIfActive();
      }
     
      int start = 0;
     
      double pre = ((1.0 - DAMPING) / (double)pages) + DAMPING;
     
      while (start < pages) {
       
        List<Page> chunk = Collections.emptyList();
        try {
          sessionStrategy.beginTransaction();
          chunk = pageDAO.findAll(start, CHUNK_SIZE);
          sessionStrategy.commitTransaction();
        } finally {
          sessionStrategy.rollbackIfActive();
        }
View Full Code Here

Examples of org.timedex.dao.interfaces.PageDAO

    clearBadRows();
  }
 
  public static void clearBadRows() {
    PageLinkDAO pageLinkDAO = new PageLinkDAOImpl();
    PageDAO pageDAO = new PageDAOImpl();
   
    int count = -1;
   
    try {
      sessionStrategy.beginTransaction();
      count = pageLinkDAO.count();
      sessionStrategy.commitTransaction();
    } finally {
      sessionStrategy.rollbackIfActive();
    }
   
    int start = 0;
    long erased = 0;
   
    while (start < count) {
      List<PageLink> chunk = null;
      try {
        sessionStrategy.beginTransaction();
       
        chunk = pageLinkDAO.findDistinctSources(start, CHUNK_SIZE);
       
        sessionStrategy.commitTransaction();
      } finally {
        sessionStrategy.rollbackIfActive();
      }
     
      for (PageLink pl : chunk) {
        try {
          sessionStrategy.beginTransaction();
         
          Page found = pageDAO.findById(pl.getSourcePageId());
         
          if (found == null) {
            pageLinkDAO.delete(pl);
            erased++;
          } else {
            Page found2 = pageDAO.findByTitleAndNamespace(pl.getDestinationTitle(), pl.getDestinationNamespace());
         
            if (found2 == null) {
              pageLinkDAO.delete(pl);
              erased++;
            }
View Full Code Here

Examples of org.timedex.dao.interfaces.PageDAO

      }
    }
  }
 
  public static void iterate(int iterations) {
    PageDAO pageDAO = new PageDAOImpl();
    final Lock countLock = new ReentrantLock();
   
    for (int iteration = 0; iteration < iterations; iteration++) {
      System.out.println("Performing iteration " + (iteration + 1) + " with up to " + THREAD_COUNT + " chunk threads per iteration");
     
      int pages = 0;
      try {
        sessionStrategy.beginTransaction();
        pages = pageDAO.count();
        sessionStrategy.commitTransaction();
      } finally {
        sessionStrategy.rollbackIfActive();
      }
     
View Full Code Here

Examples of org.timedex.dao.interfaces.PageDAO

      System.out.println("\tThread starting with " + start + ", " + chunkSize);
      double pre = ((1.0 - DAMPING) / (double)pages) + DAMPING;
     
      PageMetaDAO pageMetaDAO = new PageMetaDAOImpl();
      PageLinkDAO pageLinkDAO = new PageLinkDAOImpl();
      PageDAO pageDAO = new PageDAOImpl();
     
      List<Page> chunk = Collections.emptyList();
      try {
        sessionStrategy.beginTransaction();
        chunk = pageDAO.findAll(start, chunkSize);
        sessionStrategy.commitTransaction();
      } finally {
        sessionStrategy.rollbackIfActive();
      }
View Full Code Here

Examples of org.timedex.dao.interfaces.PageDAO

  public static void main(String[] args) {
    System.out.println("Running naive page rank");
   
    EventDAO eventDAO = new EventDAOImpl();
    PageLinkDAO pageLinkDAO = new PageLinkDAOImpl();
    PageDAO pageDAO = new PageDAOImpl();
   
    int pages = 0;
    try {
      sessionStrategy.beginTransaction();
      pages = pageDAO.count();
      sessionStrategy.commitTransaction();
    } finally {
      sessionStrategy.rollbackIfActive();
    }
   
    int start = 0;
   
    while (start < pages) {
     
      List<Page> chunk = Collections.emptyList();
      try {
        sessionStrategy.beginTransaction();
        chunk = pageDAO.findAll(start, CHUNK_SIZE);
        sessionStrategy.commitTransaction();
      } finally {
        sessionStrategy.rollbackIfActive();
      }
View Full Code Here

Examples of org.timedex.dao.interfaces.PageDAO

  }
 
 
  //test
  public static void main(String[] args) {
    PageDAO pageDAO = new PageDAOImpl();
    PageTextDAO pageTextDAO = new PageTextDAOImpl();
    Page page = pageDAO.findById(927);
    PageText ptext = pageTextDAO.findByPage(page);
    String text = ptext.getTextAsString();
    WikitextStripper stripper = new WikitextStripper();
    //stripper.setLeaveHeadings(true);
    System.out.println(text);
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.