public CorePersisterImpl(IntactContext intactContext, Finder finder) { this.dataContext = intactContext.getDataContext(); this.finder = finder; annotatedObjectsToPersist = Maps.newHashMap(); annotatedObjectsToMerge = Maps.newHashMap(); synched = Maps.newHashMap(); keyBuilder = new KeyBuilder(); entityStateCopier = new DefaultEntityStateCopier(); statistics = new PersisterStatistics(); }
public List<String> getInferredInteractions() { DataContext dataContext = IntactContext.getCurrentInstance().getDataContext(); TransactionStatus transactionStatus = dataContext.beginTransaction(); Query query = IntactContext.getCurrentInstance().getDaoFactory().getEntityManager().createQuery(inferredInteractions); query.setParameter("inferred_author", INFERRED_AUTHOR); query.setParameter("inferred_curator", CvInteraction.INFERRED_BY_CURATOR_MI_REF); List<String> interactions = query.getResultList(); dataContext.commitTransaction(transactionStatus); return interactions; }
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; }
public List<String> getInteractionsFromExperimentExportSpecified() { DataContext dataContext = IntactContext.getCurrentInstance().getDataContext(); TransactionStatus transactionStatus = dataContext.beginTransaction(); Query query = IntactContext.getCurrentInstance().getDaoFactory().getEntityManager().createQuery(interactionsFromExperimentExportSpecified); query.setParameter("drExport", CvTopic.UNIPROT_DR_EXPORT); List<String> interactions = query.getResultList(); dataContext.commitTransaction(transactionStatus); return interactions; }
public SearchableDao getDao() { if (searchableDao == null) { searchableDao = IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getSearchableDao(); } return searchableDao; }
public SearchableDao getDao() { if (searchableDao == null) { searchableDao = IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getSearchableDao(); } return searchableDao; }
public Collection<String> getNucleicAcidMIs() { final CvObjectDao<CvInteractorType> itdao = IntactContext.getCurrentInstance().getDataContext() .getDaoFactory().getCvObjectDao( CvInteractorType.class); // 1. load the root term CvInteractorType root = itdao.getByPsiMiRef( CvInteractorType.NUCLEIC_ACID_MI_REF ); Collection<String> collectedMIs = new ArrayList<String>( ); if( root != null ) { // 2. traverse children and collect their MIs CvObjectUtils.getChildrenMIs( root, collectedMIs ); } return collectedMIs; }
public GeneratedEntry addInteractorWithUniprotId(String uniprotId) { List<ProteinImpl> interactors = intactContext.getDataContext().getDaoFactory() .getProteinDao().getByUniprotId(uniprotId); if (interactors.isEmpty()) { throw new IntactException("No interactors found with uniprot ID: " + uniprotId); } for (Interactor interactor : interactors) { addInteractor(interactor); } return this; }
public GeneratedEntry addPublicationWithAc(String pubAc) { Publication publication = intactContext.getDataContext().getDaoFactory() .getPublicationDao().getByAc(pubAc); addPublication(publication); return this; }
private Collection<Confidence> synchronizeConfidences( Collection<Confidence> confidencesToSynchronize, Interaction parentInteraction ) { List<Confidence> confidences = new ArrayList<Confidence>(confidencesToSynchronize.size()); for ( Confidence confidence : confidencesToSynchronize ) { if (confidence.getAc() != null && IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getConfidenceDao().isTransient(confidence)) { confidence = IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getConfidenceDao().getByAc(confidence.getAc()); } confidence.setCvConfidenceType( synchronize (confidence.getCvConfidenceType())); confidence.setInteraction((InteractionImpl)parentInteraction); confidences.add(confidence); } return confidences; }
private Collection<ComponentConfidence> synchronizeComponentConfidences( Collection<ComponentConfidence> confidencesToSynchronize, Component parentComponent ) { List<ComponentConfidence> confidences = new ArrayList<ComponentConfidence>(confidencesToSynchronize.size()); for ( ComponentConfidence confidence : confidencesToSynchronize ) { if (confidence.getAc() != null && IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getComponentConfidenceDao().isTransient(confidence)) { confidence = IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getComponentConfidenceDao().getByAc(confidence.getAc()); } confidence.setCvConfidenceType( synchronize (confidence.getCvConfidenceType())); confidence.setComponent(parentComponent); confidences.add(confidence); } return confidences; }
public GeneratedEntry addInteractionWithAc(String ac) { Interaction interaction = intactContext.getDataContext().getDaoFactory() .getInteractionDao().getByAc(ac); checkResult(interaction, ac, "interaction"); return addInteraction(interaction); }
public GeneratedEntry addExperimentWithShortLabel(String shortLabel) { Experiment experiment = intactContext.getDataContext().getDaoFactory() .getExperimentDao().getByShortLabel(shortLabel); checkResult(experiment, shortLabel, "experiment"); return addExperiment(experiment); }
public GeneratedEntry addExperimentWithAc(String ac) { Experiment experiment = intactContext.getDataContext().getDaoFactory() .getExperimentDao().getByAc(ac); checkResult(experiment, ac, "experiment"); return addExperiment(experiment); }
public GeneratedEntry addInteractorWithAc(String ac) { Interactor interactor = intactContext.getDataContext().getDaoFactory() .getInteractorDao().getByAc(ac); checkResult(interactor, ac, "interactor"); return addInteractor(interactor); }
public GeneratedEntry addExperimentWithAc(String ac) { Experiment experiment = intactContext.getDataContext().getDaoFactory() .getExperimentDao().getByAc(ac); checkResult(experiment, ac, "experiment"); return addExperiment(experiment); }
public GeneratedEntry addInteractorWithAc(String ac) { Interactor interactor = intactContext.getDataContext().getDaoFactory() .getInteractorDao().getByAc(ac); checkResult(interactor, ac, "interactor"); return addInteractor(interactor); }
public GeneratedEntry addInteractorWithShortLabel(String shortLabel) { Interactor interactor = intactContext.getDataContext().getDaoFactory() .getInteractorDao().getByShortLabel(shortLabel); checkResult(interactor, shortLabel, "interactor"); return addInteractor(interactor); }
public GeneratedEntry addExperimentWithShortLabel(String shortLabel) { Experiment experiment = intactContext.getDataContext().getDaoFactory() .getExperimentDao().getByShortLabel(shortLabel); checkResult(experiment, shortLabel, "experiment"); return addExperiment(experiment); }
private Alias synchronizeAlias( Alias alias, AnnotatedObject parent ) { if (alias.getAc() != null) { return IntactContext.getCurrentInstance().getDataContext().getDaoFactory() .getAliasDao().getByAc(alias.getAc()); } alias.setCvAliasType( synchronize( alias.getCvAliasType() ) ); alias.setParent(parent); if (alias.getAc() == null && parent.getAc() != null) { annotatedObjectsToPersist.put(keyBuilder.keyForAlias(alias), alias); } return alias; }