/** * @see de.tudarmstadt.ukp.wikipedia.api.Category#Category(Wikipedia, long) */ private void createCategory(long id) throws WikiPageNotFoundException { Session session = this.wiki.__getHibernateSession(); session.beginTransaction(); hibernateCategory = catDAO.findById(id); session.getTransaction().commit(); if (hibernateCategory == null) { throw new WikiPageNotFoundException("No category with id " + id + " was found."); } }
} catch (WikiPageNotFoundException e) { logger.error("Page with pageID " + pageID + " could not be found. Fatal error. Terminating."); e.printStackTrace(); System.exit(1);
} catch (WikiPageNotFoundException e) { logger.error("Page with pageID {} could not be found. Fatal error. Terminating.", pageID); e.printStackTrace(); System.exit(1);
private void fetchByPageId(int pageID) throws WikiApiException { Session session = this.wiki.__getHibernateSession(); session.beginTransaction(); hibernatePage = (de.tudarmstadt.ukp.wikipedia.api.hibernate.Page) session .createQuery("from Page where pageId = :id").setParameter("id", pageID, IntegerType.INSTANCE).uniqueResult(); session.getTransaction().commit(); if (hibernatePage == null) { throw new WikiPageNotFoundException("No page with page id " + pageID + " was found."); } }
throw new WikiPageNotFoundException("The article with the ID " + articleID + " was not found.");
throw new WikiPageNotFoundException("The article with the ID " + articleID + " was not found.");
throw new WikiPageNotFoundException("The revision with the ID " + revisionID + " was not found.");
/** * Gets the page ids for a given title with case insensitive matching.<br> * * * @param title The title of the page. * @return The ids of the pages with the given title. * @throws WikiApiException Thrown if errors occurred. */ public List<Integer> getPageIdsCaseInsensitive(String title) throws WikiApiException { title = title.toLowerCase(); title = title.replaceAll(" ", "_"); Session session = this.__getHibernateSession(); session.beginTransaction(); Iterator results = session.createQuery( "select p.pageID from PageMapLine as p where lower(p.name) = :pName").setParameter("pName", title, StringType.INSTANCE).list().iterator(); session.getTransaction().commit(); if(!results.hasNext()){ throw new WikiPageNotFoundException(); } List<Integer> resultList = new LinkedList<Integer>(); while(results.hasNext()){ resultList.add((Integer)results.next()); } return resultList; }
/** * Gets the page ids for a given title.<br> * * * @param title The title of the page. * @return The id for the page with the given title. * @throws WikiApiException Thrown if errors occurred. */ public List<Integer> getPageIds(String title) throws WikiApiException { Session session = this.__getHibernateSession(); session.beginTransaction(); Iterator results = session.createQuery( "select p.pageID from PageMapLine as p where p.name = :pName").setParameter("pName", title, StringType.INSTANCE).list().iterator(); session.getTransaction().commit(); if(!results.hasNext()){ throw new WikiPageNotFoundException(); } List<Integer> resultList = new LinkedList<Integer>(); while(results.hasNext()){ resultList.add((Integer)results.next()); } return resultList; }
/** * @throws WikiApiException Thrown if errors occurred. * @see de.tudarmstadt.ukp.wikipedia.api.Page */ private void fetchByHibernateId(long id) throws WikiApiException { Session session = this.wiki.__getHibernateSession(); session.beginTransaction(); hibernatePage = pageDAO.findById(id); session.getTransaction().commit(); if (hibernatePage == null) { throw new WikiPageNotFoundException("No page with id " + id + " was found."); } }
throw new WikiPageNotFoundException("The revision with the ID " + revisionID + " was not found.");
throw new WikiPageNotFoundException("The article with the ID " + articleID + " was not found.");
throw new WikiPageNotFoundException("The article with the ID " + articleID + " was not found.");
throw new WikiPageNotFoundException("The revision with the ID " + revisionID + " was not found.");
throw new WikiPageNotFoundException("Nothing was found");
throw new WikiPageNotFoundException("Nothing was found");
throw new WikiPageNotFoundException("The revision with the ID " + revisionID + " was not found.");
throw new WikiPageNotFoundException("No revisions for user " + username);
throw new WikiPageNotFoundException("Nothing was found");
throw new WikiPageNotFoundException("The article with the ID " + articleID + " was not found.");