public UpdateTargetSpecies() { if (getDataContext().isTransactionActive()) { throw new IntactException("Transaction must NOT be active when instantiating UpdateTargetSpecies"); } beginTransaction(); CvObjectDao cvObjectDao = getDataContext().getDaoFactory().getCvObjectDao(); newt = (CvDatabase) cvObjectDao.getByPsiMiRef( CvDatabase.NEWT_MI_REF ); if (newt == null) { throw new IllegalStateException("Cv is null: "+ CvDatabase.NEWT + "("+ CvDatabase.NEWT_MI_REF + ")"); } targetSpeciesQualifier = (CvXrefQualifier) cvObjectDao.getByShortLabel( CvXrefQualifier.class, CvXrefQualifier.TARGET_SPECIES ); if (targetSpeciesQualifier == null) { throw new IllegalStateException("Cv is null: "+ CvXrefQualifier.TARGET_SPECIES); } commitTransaction(); }
Collection<CvObject> c = cvObjectDao.getByXrefLike(fromMI ); c = cvObjectDao.getByXrefLike(toMI); if ( c.size() == 1 ) { fromCvObject = (CvObject) IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getCvObjectDao(clazz).getByXref(fromMI ); toCvObject = cvObjectDao.getByXref(toMI ); if ( fromCvObject == null ) { fromCollection = cvObjectDao.getAll(); // load them all if ( toCvObject == null ) { toCollection = cvObjectDao.getAll(); // load them all
public CvObject getByAc( String ac, boolean forceReload ) { if ( !forceReload && cachedByAc.containsKey( ac ) ) { return cachedByAc.get( ac ); } CvObject cvObject = getDaoFactory().getCvObjectDao().getByAc( ac ); if ( cvObject == null ) { return null; } putCv( cvObject ); return cvObject; }
private static void initialise( ) { if ( initialisationDone == false ) { // load CVs by shortlabel CvObjectDao<CvTopic> cvTopicDao = IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getCvObjectDao(CvTopic.class); authorConfidenceTopic = cvTopicDao.getByShortLabel(CvTopic.AUTHOR_CONFIDENCE); noUniprotUpdate = cvTopicDao.getByShortLabel(CvTopic.NON_UNIPROT); // load CVs by MI reference CvObjectDao<CvXrefQualifier> cvXrefQualifierDao = IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getCvObjectDao(CvXrefQualifier.class); primaryReferenceXrefQualifier = cvXrefQualifierDao.getByXref( CvXrefQualifier.PRIMARY_REFERENCE_MI_REF ); seeAlsoXrefQualifier = cvXrefQualifierDao.getByXref( CvXrefQualifier.SEE_ALSO_MI_REF ); identityXrefQualifier = cvXrefQualifierDao.getByXref( CvXrefQualifier.IDENTITY_MI_REF ); geneName = IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getCvObjectDao(CvAliasType.class).getByXref( CvAliasType.GENE_NAME_MI_REF ); initialisationDone = true; } } // init
bsTissue = cvObjectDao.getByShortLabel(tissue.getShortlabel()); cvObjectDao.persist( bsTissue ); bsCellType = cvObjectDao.getByShortLabel( cellType.getShortlabel() ); cvObjectDao.persist( bsCellType );
public <T extends CvObject> T getByLabel( Class<T> cvType, String label, boolean forceReload ) { if ( cvType == null ) { throw new NullPointerException( "To get a CV using its label, you need the CV type" ); } LabelKey labelKey = new LabelKey( label, cvType ); if ( !forceReload && cachedByLabel.containsKey( labelKey ) ) { if (log.isDebugEnabled()) log.debug("Getting by label: "+label+" ("+cvType.getSimpleName()+") - Hit"); return ( T ) cachedByLabel.get( labelKey ); } T cvObject = null; try { cvObject = getDaoFactory().getCvObjectDao( cvType ).getByShortLabel( cvType, label ); } catch (Exception e) { e.printStackTrace(); throw new IntactException("Exception getting cvType "+cvType.getSimpleName()+" with label: "+label, e); } if ( cvObject == null ) { if (log.isDebugEnabled()) log.debug("Getting by label: "+label+" ("+cvType.getSimpleName()+") - Missed"); return null; } if (log.isDebugEnabled()) log.debug("Getting by label: "+label+" ("+cvType.getSimpleName()+") - DB Hit"); putCv( cvObject ); return cvObject; }
Collection<CvTopic> cvTopics = IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getCvObjectDao(CvTopic.class).getAll();
.getCvObjectDao(CvXrefQualifier.class).getByPsiMiRef(CvXrefQualifier.IDENTITY_MI_REF); identity = cvBuilder.createIdentityCvXrefQualifier(IntactContext.getCurrentInstance().getInstitution()); identity.setFullName("identical object"); intactContext.getDataContext().getDaoFactory().getCvObjectDao(CvXrefQualifier.class).persist(identity); .getCvObjectDao(CvDatabase.class).getByPsiMiRef(CvDatabase.PSI_MI_MI_REF); intactContext.getDataContext().getDaoFactory().getCvObjectDao(CvDatabase.class).persist(psi);
.getCvObjectDao().getByPsiMiRef(CvExperimentalRole.BAIT_PSI_REF).getAc();
public static void check( final ParticipantDetectionTag participantDetection ) { final XrefTag psiDef = participantDetection.getPsiDefinition(); XrefChecker.check( psiDef ); final String id = psiDef.getId(); if ( !cache.keySet().contains( id ) ) { CvIdentification cvIdentification = null; try { cvIdentification = IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getCvObjectDao(CvIdentification.class).getByXref(id); if ( cvIdentification == null ) { MessageHolder.getInstance().addCheckerMessage( new Message( "Could not find CvIdentification for the PSI definition: " + id ) ); } else { System.out.println( "Found ParticipantDetection " + id + " as " + cvIdentification.getShortLabel() ); } } catch ( IntactException e ) { MessageHolder.getInstance().addCheckerMessage( new Message( "An error occured while searching for CvInteraction " + "having the PSI definition: " + id ) ); e.printStackTrace(); } cache.put( id, cvIdentification ); } } }
.getCvObjectDao(clazz).persist(cv); log.debug("Created missing CV Term: " + clazz.getSimpleName() + "( " + cv.getShortLabel() + " - " + cv.getFullName() + " ).");
public <T extends CvObject> T getByMiRef( Class<T> cvType, String miRef, boolean forceReload ) { if ( miRef == null ) { throw new NullPointerException( "miRef" ); } MiRefKey key = new MiRefKey( miRef, cvType ); if ( !forceReload && cachedByMiRef.containsKey( key ) ) { if (log.isDebugEnabled()) log.debug("Getting by miRef: "+miRef+" - Hit"); return ( T ) cachedByMiRef.get( key ); } T cvObject = null; try { cvObject = getDaoFactory().getCvObjectDao().getByPrimaryId( cvType, miRef ); } catch (Exception e) { throw new IntactException("Exception getting cvType "+cvType.getSimpleName()+" with miRef: "+miRef); } if ( cvObject == null ) { if (log.isDebugEnabled()) log.debug("Getting by miRef: "+miRef+" - Missed"); return null; } if (log.isDebugEnabled()) log.debug("Getting by miRef: "+miRef+" - DB Hit"); putCv( cvObject ); putCvInMiRef( miRef, cvObject ); return cvObject; }
bsTissue = cvObjectDao.getByShortLabel(tissue.getShortlabel()); cvObjectDao.persist( bsTissue ); bsCellType = cvObjectDao.getByShortLabel( cellType.getShortlabel() ); cvObjectDao.persist( bsCellType );
System.out.println( "Database: " + daoFactory.getBaseDao().getDbName() ); System.out.println( "User: " + daoFactory.getBaseDao().getDbUserName() ); CvTopic topic = daoFactory.getCvObjectDao( CvTopic.class ).getByShortLabel( "author-confidence" ); IntactContext.getCurrentInstance().getDataContext().commitTransaction();
Collection<CvTopic> cvTopics = IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getCvObjectDao(CvTopic.class).getAll();
CvDatabase db = dbDao.getByPsiMiRef( miRef ); if ( db == null ) { String name = taxonomyService.getClass().getSimpleName(); CvXrefQualifier identity = qDao.getByPsiMiRef( CvXrefQualifier.IDENTITY_MI_REF );
public static void check( final InteractionDetectionTag interactionDetection ) { final XrefTag psiDef = interactionDetection.getPsiDefinition(); XrefChecker.check( psiDef ); final String id = psiDef.getId(); if ( !cache.keySet().contains( id ) ) { CvInteraction cvInteraction = null; try { cvInteraction = IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getCvObjectDao(CvInteraction.class).getByXref(id); if ( cvInteraction == null ) { MessageHolder.getInstance().addCheckerMessage( new Message( "Could not find CvInteraction by PSI definition: " + id ) ); } else { System.out.println( "Found CvInteraction " + id + " as " + cvInteraction.getShortLabel() ); } } catch ( IntactException e ) { MessageHolder.getInstance().addCheckerMessage( new Message( "An error occured while searching for CvInteraction " + "having the PSI definition: " + id ) ); e.printStackTrace(); } cache.put( id, cvInteraction ); } } }
protected CvXrefQualifier getIdentity() { if ( identity == null ) { DaoFactory daoFactory = IntactContext.getCurrentInstance().getDataContext().getDaoFactory(); CvObjectDao<CvObject> cvdao = daoFactory.getCvObjectDao(); identity = cvdao.getByPrimaryId( CvXrefQualifier.class, CvXrefQualifier.IDENTITY_MI_REF ); if ( identity == null ) { throw new IllegalStateException( "Could not find CvXrefQualifier( identity )." ); } } return identity; }
Collection<CvObject> c = cvObjectDao.getByXrefLike(fromMI ); c = cvObjectDao.getByXrefLike(toMI); if ( c.size() == 1 ) { toCvObject = cvObjectDao.getByXref(toMI ); if ( fromCvObject == null ) { fromCollection = cvObjectDao.getAll(); // load them all if ( toCvObject == null ) { toCollection = cvObjectDao.getAll(); // load them all