From: <rv...@us...> - 2010-06-02 13:25:35
|
Revision: 705 http://treebase.svn.sourceforge.net/treebase/?rev=705&view=rev Author: rvos Date: 2010-06-02 13:25:28 +0000 (Wed, 02 Jun 2010) Log Message: ----------- Added implementation of findByJournal(String pJournal, boolean pExactMatch), so that we can do exact matching against journal names - and then deliver them as RSS, so that journals can have feeds with treebase publications. Modified Paths: -------------- trunk/treebase-core/src/main/java/org/cipres/treebase/dao/study/StudyDAO.java Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/dao/study/StudyDAO.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/dao/study/StudyDAO.java 2010-06-02 12:42:58 UTC (rev 704) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/dao/study/StudyDAO.java 2010-06-02 13:25:28 UTC (rev 705) @@ -22,6 +22,7 @@ import org.hibernate.Query; import org.hibernate.SQLQuery; import org.hibernate.criterion.Expression; +import org.hibernate.criterion.MatchMode; import org.hibernate.criterion.Restrictions; /** @@ -379,5 +380,24 @@ return returnVal; } + /* + * (non-Javadoc) + * @see org.cipres.treebase.domain.study.StudyHome#findByJournal(java.lang.String, boolean) + */ + public Collection<Study> findByJournal(String pJournal, boolean pExactMatch) { + if ( pExactMatch == false ) { + return findByJournal(pJournal); + } + if (LOGGER.isInfoEnabled()) { + LOGGER.info("Going to do an exact journal name match for "+pJournal); + } + Collection<Study> studies = new ArrayList<Study>(); + Criteria studyCrit = getSession().createCriteria(Study.class).createAlias("citation", "cit"); + //studyCrit.add(Restrictions.like("cit.journal", pJournal.trim(), MatchMode.EXACT)); + studyCrit.add(Restrictions.eq("cit.journal", pJournal)); + studies = (Collection<Study>) studyCrit.list(); + return studies; + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |