/** * @since 2.4.0 */ public CoreDeleter getCoreDeleter() { return (CoreDeleter) IntactContext.getCurrentInstance().getSpringContext().getBean("coreDeleter"); }
@Deprecated public CorePersister getCorePersister() { return IntactContext.getCurrentInstance().getCorePersister(); } }
@Deprecated public CorePersister getCorePersister() { return IntactContext.getCurrentInstance().getCorePersister(); } }
private static CvFuzzyType createCvFuzzyType(String position) { if (position == null) { throw new IllegalArgumentException("The range position cannot be null."); } for (String key : rangeStatusMap.keySet()) { if (position.toLowerCase().contains(key)) { return rangeStatusMap.get(key); } } return CvObjectUtils.createCvObject(IntactContext.getCurrentInstance().getInstitution(), CvFuzzyType.class, CvFuzzyType.CERTAIN_MI_REF, CvFuzzyType.CERTAIN); }
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; }
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; }
@Override @Transactional public Institution convertFromString(String str) { if (str == null) return null; return IntactContext.getCurrentInstance().getDaoFactory().getInstitutionDao().getByShortLabel(str); }
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; }
/** * Checks if the object is managed. * @param io the IntactObject * @return true is the object is found to be managed, otherwise false. */ public static boolean isManaged( IntactObject io ) { return IntactContext.getCurrentInstance().getDaoFactory().getEntityManager().contains( io ); }
public SearchableDao getDao() { if (searchableDao == null) { searchableDao = IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getSearchableDao(); } return searchableDao; }
private List<Publication> getPublicationsContainingComponents(Collection<String> intactAccession) throws DatasetException { // get the intact datacontext and daofactory final DataContext dataContext = IntactContext.getCurrentInstance().getDataContext(); final DaoFactory daoFactory = dataContext.getDaoFactory(); // This query is looking for all experiences with at least one interaction involving the component of interest String componentQuery = "select i.ac from InteractionImpl i join i.components as c " + "where c.ac in (:accession)"; return getPublicationsWithSpecificSelection(componentQuery, intactAccession, daoFactory); }
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; }
protected void changeStatus(Publication publication, String cvPublicationStatusIdentifier) { IntactContext intactContext = IntactContext.getCurrentInstance(); final CvObjectDao<CvPublicationStatus> cvObjectDao = intactContext.getDaoFactory().getCvObjectDao( CvPublicationStatus.class ); CvPublicationStatus publicationStatus = cvObjectDao.getByIdentifier( cvPublicationStatusIdentifier ); publication.setStatus(publicationStatus); }
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<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; }
public Publication createPublication(String pmid) { Publication pub = new Publication(getInstitution(), pmid); IntactContext.getCurrentInstance().getLifecycleManager().getStartStatus().create(pub, "Mock builder"); return pub; }
private SelectionRandomizer<User> createSelectionRandomizer() { SelectionRandomizer<User> selectionRandomizer = new SelectionRandomizer<User>(); List<User> reviewers = IntactContext.getCurrentInstance().getDaoFactory().getUserDao().getByRole(Role.ROLE_REVIEWER); for (User reviewer : reviewers) { Integer availability = UserUtils.getReviewerAvailability(reviewer); selectionRandomizer.addObject(reviewer, availability); } return selectionRandomizer; }
private static Collection<Annotation> fetchAnnotations(Interaction interaction) { Collection<Annotation> annotations; if (IntactCore.isInitialized(interaction.getAnnotations())) { annotations = interaction.getAnnotations(); } else { annotations = IntactContext.getCurrentInstance().getDaoFactory().getAnnotationDao().getByParentAc(InteractionImpl.class, interaction.getAc()); } return annotations; }
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; }
private static void addStartAndEndPercentIfNecessary( QueryTerm term ) { if ( term.hasModifier( QueryModifier.PHRASE_DELIM ) ) { return; } String acPrefix = IntactContext.getCurrentInstance().getConfig().getAcPrefix(); if ( !term.startsWith( acPrefix ) && !term.hasModifier( QueryModifier.WILDCARD_START ) ) { term.addModifier( QueryModifier.WILDCARD_START ); } if ( !term.startsWith( acPrefix ) && !term.hasModifier( QueryModifier.WILDCARD_END ) ) { term.addModifier( QueryModifier.WILDCARD_END ); } }