public <T extends AnnotatedObject> AnnotatedObjectDao<T> getAnnotatedObjectDao( Class<T> entityType ) { if (entityType.isAssignableFrom(Institution.class)) { return (AnnotatedObjectDao<T>)getInstitutionDao(); } else if (Publication.class.isAssignableFrom(entityType)) { return (AnnotatedObjectDao<T>)getPublicationDao(); } else if (CvObject.class.isAssignableFrom(entityType)) { return getCvObjectDao((Class)entityType); } else if (Experiment.class.isAssignableFrom(entityType)) { return (AnnotatedObjectDao<T>)getExperimentDao(); } else if (Interaction.class.isAssignableFrom(entityType)) { return (AnnotatedObjectDao<T>)getInteractionDao(); } else if (Interactor.class.isAssignableFrom(entityType)) { return (AnnotatedObjectDao<T>)getInteractorDao(); } else if (BioSource.class.isAssignableFrom(entityType)) { return (AnnotatedObjectDao<T>)getBioSourceDao(); } else if (Component.class.isAssignableFrom(entityType)) { return (AnnotatedObjectDao<T>)getComponentDao(); } else if (Feature.class.isAssignableFrom(entityType)) { return (AnnotatedObjectDao<T>)getFeatureDao(); } else { throw new IllegalArgumentException( "No Dao for entity type: "+entityType.getClass().getName()); } }
public <T extends AnnotatedObject> AnnotatedObjectDao<T> getAnnotatedObjectDao( Class<T> entityType ) { if (entityType.isAssignableFrom(Institution.class)) { return (AnnotatedObjectDao<T>)getInstitutionDao(); } else if (Publication.class.isAssignableFrom(entityType)) { return (AnnotatedObjectDao<T>)getPublicationDao(); } else if (CvObject.class.isAssignableFrom(entityType)) { return getCvObjectDao((Class)entityType); } else if (Experiment.class.isAssignableFrom(entityType)) { return (AnnotatedObjectDao<T>)getExperimentDao(); } else if (Interaction.class.isAssignableFrom(entityType)) { return (AnnotatedObjectDao<T>)getInteractionDao(); } else if (Interactor.class.isAssignableFrom(entityType)) { return (AnnotatedObjectDao<T>)getInteractorDao(); } else if (BioSource.class.isAssignableFrom(entityType)) { return (AnnotatedObjectDao<T>)getBioSourceDao(); } else if (Component.class.isAssignableFrom(entityType)) { return (AnnotatedObjectDao<T>)getComponentDao(); } else if (Feature.class.isAssignableFrom(entityType)) { return (AnnotatedObjectDao<T>)getFeatureDao(); } else { throw new IllegalArgumentException( "No Dao for entity type: "+entityType.getClass().getName()); } }
/** * 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 features from a participant, initializing them if necessary. * Do not set the initialized collection of features because features cannot be orphan * @param component the component * @return The returned features are ensured to be initialized * @since 2.4.0 */ public static Collection<Feature> ensureInitializedFeatures(Component component) { Collection<Feature> features; if (IntactCore.isInitialized(component.getFeatures())) { features = component.getFeatures(); } else { features = IntactContext.getCurrentInstance().getDaoFactory().getFeatureDao().getByComponentAc(component.getAc()); } return features; }
/** * Retrieves the features from a participant, initializing them if necessary. * Do not set the initialized collection of features because features cannot be orphan * @param component the component * @return The returned features are ensured to be initialized * @since 2.4.0 */ public static Collection<Feature> ensureInitializedFeatures(Component component) { Collection<Feature> features; if (IntactCore.isInitialized(component.getFeatures())) { features = component.getFeatures(); } else { features = IntactContext.getCurrentInstance().getDaoFactory().getFeatureDao().getByComponentAc(component.getAc()); } return features; }