/** * Gets the CVs from the database created after a given date. * @param date cutoff date * @param exclusionList list of cv classes that are to be excluded eg: uk.ac.ebi.intact.model.CvCellType * @return List of cvs added after the given date excluding the date */ public static List<CvObject> getCvsAddedAfter( Date date, Collection<String> exclusionList ) { if ( date == null ) { throw new NullPointerException( "You must give a non null date" ); } final DataContext dataContext = IntactContext.getCurrentInstance().getDataContext(); DaoFactory daof = dataContext.getDaoFactory(); List<CvObject> allCvs = daof.getCvObjectDao().getAll(); List<CvObject> cvsAddedAfter = new ArrayList<CvObject>(); for ( CvObject cv : allCvs ) { if ( cv.getCreated() != null && cv.getCreated().after( date ) ) { if ( exclusionList == null || exclusionList.size() == 0 ) { cvsAddedAfter.add( cv ); } else { if ( !exclusionList.contains( cv.getObjClass() ) ) cvsAddedAfter.add( cv ); } } } return cvsAddedAfter; }
/** * Gets the CVs from the database created before a given date. * @param date cutoff date * @param exclusionList list of cv classes that are to be excluded eg: uk.ac.ebi.intact.model.CvCellType * @return List of cvs added before the given date excluding the date */ public static List<CvObject> getCVsAddedBefore( Date date, Collection<String> exclusionList ) { if ( date == null ) { throw new NullPointerException( "You must give a non null date" ); } final DataContext dataContext = IntactContext.getCurrentInstance().getDataContext(); DaoFactory daof = dataContext.getDaoFactory(); List<CvObject> allCvs = daof.getCvObjectDao().getAll(); List<CvObject> cvsAddedBefore = new ArrayList<CvObject>(); for ( CvObject cv : allCvs ) { if ( cv.getCreated() != null && cv.getCreated().before( date ) ) { if ( exclusionList == null || exclusionList.size() == 0 ) { cvsAddedBefore.add( cv ); } else { if ( !exclusionList.contains( cv.getObjClass() ) ) cvsAddedBefore.add( cv ); } } } return cvsAddedBefore; }