public XrefDao<Xref> getXrefDao() { return getXrefDao(Xref.class); }
public XrefDao<Xref> getXrefDao() { return getXrefDao(Xref.class); }
/** * Prints the most counts in the database. * @param ps The printStream to use * * @since 1.9.0 */ public static void printDatabaseCounts(PrintStream ps) { final DaoFactory daoFactory = IntactContext.getCurrentInstance().getDataContext().getDaoFactory(); ps.println("Publications: "+ daoFactory.getPublicationDao().countAll()); ps.println("\tXrefs: "+ daoFactory.getXrefDao(PublicationXref.class).countAll()); ps.println("\tAliases: "+ daoFactory.getAliasDao(PublicationAlias.class).countAll()); ps.println("Experiments: "+ daoFactory.getExperimentDao().countAll()); ps.println("\tXrefs: "+ daoFactory.getXrefDao(ExperimentXref.class).countAll()); ps.println("\tAliases: "+ daoFactory.getAliasDao(ExperimentAlias.class).countAll()); ps.println("Interactors: "+ daoFactory.getInteractorDao().countAll()); ps.println("\tInteractions: "+ daoFactory.getInteractionDao().countAll()); ps.println("\tPolymers: " + daoFactory.getPolymerDao().countAll()); ps.println("\t\tProteins: "+ daoFactory.getProteinDao().countAll()); ps.println("\t\tNucleic Acids: "+ daoFactory.getInteractorDao(NucleicAcidImpl.class).countAll()); ps.println("\tSmall molecules: " + daoFactory.getInteractorDao(SmallMoleculeImpl.class).countAll()); ps.println("\tInteractor Xrefs: "+ daoFactory.getXrefDao(InteractorXref.class).countAll()); ps.println("\tInteractor Aliases: "+ daoFactory.getAliasDao(InteractorAlias.class).countAll()); ps.println("Components: "+ daoFactory.getComponentDao().countAll()); ps.println("Features: "+ daoFactory.getFeatureDao().countAll()); ps.println("\tRanges: "+ daoFactory.getRangeDao().countAll()); ps.println("CvObjects: "+ daoFactory.getCvObjectDao().countAll()); ps.println("BioSources: "+ daoFactory.getBioSourceDao().countAll()); ps.println("Annotations: "+ daoFactory.getAnnotationDao().countAll()); ps.println("Institutions: "+ daoFactory.getInstitutionDao().countAll()); }
/** * Prints the most counts in the database. * @param ps The printStream to use * * @since 1.9.0 */ public static void printDatabaseCounts(PrintStream ps) { final DaoFactory daoFactory = IntactContext.getCurrentInstance().getDataContext().getDaoFactory(); ps.println("Publications: "+ daoFactory.getPublicationDao().countAll()); ps.println("\tXrefs: "+ daoFactory.getXrefDao(PublicationXref.class).countAll()); ps.println("\tAliases: "+ daoFactory.getAliasDao(PublicationAlias.class).countAll()); ps.println("Experiments: "+ daoFactory.getExperimentDao().countAll()); ps.println("\tXrefs: "+ daoFactory.getXrefDao(ExperimentXref.class).countAll()); ps.println("\tAliases: "+ daoFactory.getAliasDao(ExperimentAlias.class).countAll()); ps.println("Interactors: "+ daoFactory.getInteractorDao().countAll()); ps.println("\tInteractions: "+ daoFactory.getInteractionDao().countAll()); ps.println("\tPolymers: " + daoFactory.getPolymerDao().countAll()); ps.println("\t\tProteins: "+ daoFactory.getProteinDao().countAll()); ps.println("\t\tNucleic Acids: "+ daoFactory.getInteractorDao(NucleicAcidImpl.class).countAll()); ps.println("\tSmall molecules: " + daoFactory.getInteractorDao(SmallMoleculeImpl.class).countAll()); ps.println("\tInteractor Xrefs: "+ daoFactory.getXrefDao(InteractorXref.class).countAll()); ps.println("\tInteractor Aliases: "+ daoFactory.getAliasDao(InteractorAlias.class).countAll()); ps.println("Components: "+ daoFactory.getComponentDao().countAll()); ps.println("Features: "+ daoFactory.getFeatureDao().countAll()); ps.println("\tRanges: "+ daoFactory.getRangeDao().countAll()); ps.println("CvObjects: "+ daoFactory.getCvObjectDao().countAll()); ps.println("BioSources: "+ daoFactory.getBioSourceDao().countAll()); ps.println("Annotations: "+ daoFactory.getAnnotationDao().countAll()); ps.println("Institutions: "+ daoFactory.getInstitutionDao().countAll()); }
/** * Retrieves the xrefs from an AnnotatedObject, initializing them if necessary. * * @param ao The annotated object instance with possibly non-initialized xrefs * @return The returned xrefs are ensured to be initialized * @since 2.4.0 */ public static Collection<? extends Xref> ensureInitializedXrefs(AnnotatedObject<?, ?> ao) { Collection<? extends Xref> xrefs; if (IntactCore.isInitialized(ao.getXrefs())) { xrefs = ao.getXrefs(); } else { xrefs = IntactContext.getCurrentInstance().getDaoFactory().getXrefDao(AnnotatedObjectUtils.getXrefClassType(ao.getClass())) .getByParentAc(ao.getAc()); } return xrefs; }
/** * Retrieves the xrefs from an AnnotatedObject, initializing them if necessary. * * @param ao The annotated object instance with possibly non-initialized xrefs * @return The returned xrefs are ensured to be initialized * @since 2.4.0 */ public static Collection<? extends Xref> ensureInitializedXrefs(AnnotatedObject<?, ?> ao) { Collection<? extends Xref> xrefs; if (IntactCore.isInitialized(ao.getXrefs())) { xrefs = ao.getXrefs(); } else { xrefs = IntactContext.getCurrentInstance().getDaoFactory().getXrefDao(AnnotatedObjectUtils.getXrefClassType(ao.getClass())) .getByParentAc(ao.getAc()); } return xrefs; }
private Collection<ProteinImpl> getProteinByXref(String primaryId, CvDatabase database, CvXrefQualifier qualifier) { XrefDao<InteractorXref> xrefDao = IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getXrefDao(InteractorXref.class); Collection<InteractorXref> xrefs = xrefDao.getByPrimaryId(primaryId, false); Collection<ProteinImpl> proteins = new ArrayList<ProteinImpl>(); for (InteractorXref xref : xrefs) { if ((null != database && database.equals(xref.getCvDatabase())) || (null == database && null == xref.getCvDatabase())) { if ((null != qualifier && qualifier.equals(xref.getCvXrefQualifier())) || (null == qualifier && null == xref.getCvXrefQualifier())) { proteins.add((ProteinImpl) xref.getParent()); } } } return proteins; }
public static <X extends Xref> Collection<X> getIdentityXrefs(AnnotatedObject<X, ?> annotatedObject) { Collection<X> xrefs = new ArrayList<X>(); Collection<X> allXrefs = annotatedObject.getXrefs(); if (!IntactCore.isInitialized(annotatedObject.getXrefs()) && IntactContext.currentInstanceExists()) { EntityManager entityManager = IntactContext.getCurrentInstance().getDaoFactory().getEntityManager(); // set the flush mode to manual to avoid hibernate trying to flush the session when querying the xrefs FlushModeType originalFlushMode = entityManager.getFlushMode(); entityManager.setFlushMode(FlushModeType.COMMIT); Class xrefClass = AnnotatedObjectUtils.getXrefClassType(annotatedObject.getClass()); allXrefs = IntactContext.getCurrentInstance().getDaoFactory().getXrefDao(xrefClass).getByParentAc(annotatedObject.getAc()); entityManager.setFlushMode(originalFlushMode); } for (X xref : allXrefs) { CvXrefQualifier qualifier = xref.getCvXrefQualifier(); String qualifierMi = null; if (qualifier != null && ((qualifierMi = qualifier.getIdentifier()) != null && qualifierMi.equals(CvXrefQualifier.IDENTITY_MI_REF))) { xrefs.add(xref); } } return xrefs; }
public static <X extends Xref> Collection<X> getIdentityXrefs(AnnotatedObject<X, ?> annotatedObject) { Collection<X> xrefs = new ArrayList<X>(); Collection<X> allXrefs = annotatedObject.getXrefs(); if (!IntactCore.isInitialized(annotatedObject.getXrefs()) && IntactContext.currentInstanceExists()) { EntityManager entityManager = IntactContext.getCurrentInstance().getDaoFactory().getEntityManager(); // set the flush mode to manual to avoid hibernate trying to flush the session when querying the xrefs FlushModeType originalFlushMode = entityManager.getFlushMode(); entityManager.setFlushMode(FlushModeType.COMMIT); Class xrefClass = AnnotatedObjectUtils.getXrefClassType(annotatedObject.getClass()); allXrefs = IntactContext.getCurrentInstance().getDaoFactory().getXrefDao(xrefClass).getByParentAc(annotatedObject.getAc()); entityManager.setFlushMode(originalFlushMode); } for (X xref : allXrefs) { CvXrefQualifier qualifier = xref.getCvXrefQualifier(); String qualifierMi = null; if (qualifier != null && ((qualifierMi = qualifier.getIdentifier()) != null && qualifierMi.equals(CvXrefQualifier.IDENTITY_MI_REF))) { xrefs.add(xref); } } return xrefs; }
private Xref synchronizeXref( Xref xref, AnnotatedObject parent ) { if (xref.getAc() != null) { return IntactContext.getCurrentInstance().getDataContext().getDaoFactory() .getXrefDao().getByAc(xref.getAc()); } xref.setCvDatabase( synchronize( xref.getCvDatabase() ) ); xref.setCvXrefQualifier( synchronize( xref.getCvXrefQualifier() ) ); xref.setParent(parent); if (xref.getAc() == null && xref.getAc() != null) { annotatedObjectsToPersist.put(keyBuilder.keyForXref(xref), xref); } return xref; }
private Xref synchronizeXref( Xref xref, AnnotatedObject parent ) { if (xref.getAc() != null) { return IntactContext.getCurrentInstance().getDataContext().getDaoFactory() .getXrefDao().getByAc(xref.getAc()); } xref.setCvDatabase( synchronize( xref.getCvDatabase() ) ); xref.setCvXrefQualifier( synchronize( xref.getCvXrefQualifier() ) ); xref.setParent(parent); if (xref.getAc() == null && xref.getAc() != null) { annotatedObjectsToPersist.put(keyBuilder.keyForXref(xref), xref); } return xref; }
XrefDao<CvObjectXref> xrefDao = factory.getXrefDao(CvObjectXref.class);