public static String getParsedUrl(String url) { LogDAO logDAO = new LogDAO(); Session session = HibernateSessionFactory.openCurrentSession(); Transaction tran = session.beginTransaction(); List<Log> list = logDAO.findByProperty("url", url.trim()); tran.commit(); if (null == list || list.size() == 0) return null; return list.get(0).getOther(); }
public static boolean checkTitle(String title, String host) { logger.info("checkTitle : " + title + " , " + host); LogDAO logDAO = new LogDAO(); Session session = HibernateSessionFactory.openCurrentSession(); Transaction tran = session.beginTransaction(); List list = logDAO.findByProperty("name", title + ";" + host); tran.commit(); if (null == list || list.size() == 0) return false; return true; }
/** * @param link * @return 有该link返回true,没有的话返回false */ public static boolean checkUrl(String link) { LogDAO logDAO = new LogDAO(); Session session = HibernateSessionFactory.openCurrentSession(); Transaction tran = session.beginTransaction(); List list = logDAO.findByProperty("url", link.trim()); tran.commit(); logger.info("checkUrl : " + link + " , result : " + list); if (null == list || list.size() == 0) return false; return true; }