protected Map<String, Class> getMapOfExistingCvs() { Map<String, Class> existingMi2Class = new HashMap<String, Class>(); List<CvObject> allExistingCvs = IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getCvObjectDao().getAll(); for ( CvObject cvObject : allExistingCvs ) { existingMi2Class.put( CvObjectUtils.getIdentity( cvObject ), cvObject.getClass() ); } return existingMi2Class; }
/** * @param exclusionList list of cv classes that are to be excluded eg: uk.ac.ebi.intact.model.CvCellType * @return List of Cvs with No MiIdentifiers */ public static List<CvObject> getCvsInIntactNotInPsi(Collection<String> exclusionList) { if(exclusionList==null || exclusionList.size()==0) { //create a default exclusionList exclusionList = new ArrayList<String>(); exclusionList.add( "uk.ac.ebi.intact.model.CvCellType" ); exclusionList.add( "uk.ac.ebi.intact.model.CvTissue" ); } final DataContext dataContext = IntactContext.getCurrentInstance().getDataContext(); DaoFactory daof = dataContext.getDaoFactory(); List<CvObject> allCvs = daof.getCvObjectDao().getAll(); List<CvObject> cvsNotInPsi = new ArrayList<CvObject>(); for ( CvObject cv : allCvs ) { if ( cv.getIdentifier() != null && cv.getIdentifier().startsWith( "IA:" )) { if(!exclusionList.contains( cv.getObjClass() )){ cvsNotInPsi.add( cv ); } } } return cvsNotInPsi; }
/** * 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; }
final List<CvObject> terms = cvDao.getAll( currentIdx, MAX_CV_BATCH_SIZE );