public void beginTransaction( String dataConfigName ) { DaoFactory daoFactory = getDaoFactory( dataConfigName ); if ( !daoFactory.isTransactionActive() ) { log.debug( "Creating new transaction for: " + dataConfigName ); daoFactory.beginTransaction(); } else { log.debug( "Using existing transaction for: " + dataConfigName ); } }
private DaoFactory getDaoFactory() { return IntactContext.getCurrentInstance().getDataContext().getDaoFactory(); } }
/** * Default constructor. */ public FillPredictTables(PrintStream output) { daoFactory = IntactContext.getCurrentInstance().getDataContext().getDaoFactory(); this.output = output; }
public IDataSet createDbUnitDataset(String tablePrefix) throws SQLException { Connection con = IntactContext.getCurrentInstance().getDataContext().getDaoFactory().connection(); ResultSet tables = con.getMetaData().getTables(null, null, tablePrefix, new String[]{"TABLE"}); QueryDataSet allTablesDataSet = new QueryDataSet(getDatabaseConnection()); while (tables.next()) { String tableName = tables.getString(3); allTablesDataSet.addTable(tableName); } return allTablesDataSet; }
protected CvDatabase getIntact() { if ( intact == null ) { DaoFactory daoFactory = IntactContext.getCurrentInstance().getDataContext().getDaoFactory(); CvObjectDao<CvObject> cvdao = daoFactory.getCvObjectDao(); intact = cvdao.getByPrimaryId( CvDatabase.class, CvDatabase.INTACT_MI_REF ); if ( intact == null ) { throw new IllegalStateException( "Could not find CvDatabase( IntAct )." ); } } return intact; }
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; }
private void insertSearchItemForAnnotatedObject( AnnotatedObject<? extends Xref, ? extends Alias> ao, boolean includeAliases ) { if ( log.isDebugEnabled() ) { log.debug( "Inserting SearchItems for AnnotatedObject: " + ao.getShortLabel() + " (" + ao.getAc() + ")" ); } for ( SearchItem searchItem : searchItemsForAnnotatedObject( ao, includeAliases ) ) { if ( log.isDebugEnabled() ) { log.debug( "\t" + searchItem ); } IntactContext.getCurrentInstance().getDataContext().getDaoFactory() .getSearchItemDao().persist( searchItem ); } }
private Connection getConnection() { return IntactContext.getCurrentInstance().getDataContext().getDaoFactory().connection(); } }
private void insertSearchItemForXref( Xref xref ) { if ( log.isDebugEnabled() ) { log.debug( "Inserting SearchItems for Xref: " + xref.getPrimaryId() + " (" + xref.getAc() + "); Parent AC: " + xref.getParentAc() ); } SearchItem searchItem = searchItemForXref( xref ); if ( log.isDebugEnabled() ) { log.debug( "\t" + searchItem ); } IntactContext.getCurrentInstance().getDataContext().getDaoFactory() .getSearchItemDao().persist( searchItem ); }
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; }
private void deleteSearchItemsForAnnotatedObject( AnnotatedObject<? extends Xref, ? extends Alias> ao ) { if ( log.isDebugEnabled() ) { log.debug( "Deleting SearchItems for AnnotatedObject: " + ao.getShortLabel() + " (" + ao.getAc() + ")" ); } IntactContext.getCurrentInstance().getDataContext().getDaoFactory() .getSearchItemDao().deleteByAc( ao.getAc() ); }
public static MockDaoFactory configureMockDaoFactory() { if (!IntactContext.currentInstanceExists()) { MockIntactContext.initMockContext(); } return (MockDaoFactory) IntactContext.getCurrentInstance().getDataContext().getDaoFactory(); }
public GeneratedEntry addInteractionWithAc(String ac) { Interaction interaction = intactContext.getDataContext().getDaoFactory() .getInteractionDao().getByAc(ac); checkResult(interaction, ac, "interaction"); return addInteraction(interaction); }
public GeneratedEntry addExperimentWithAc(String ac) { Experiment experiment = intactContext.getDataContext().getDaoFactory() .getExperimentDao().getByAc(ac); checkResult(experiment, ac, "experiment"); return addExperiment(experiment); }
public GeneratedEntry addInteractionWithShortLabel(String shortLabel) { Interaction interaction = intactContext.getDataContext().getDaoFactory() .getInteractionDao().getByShortLabel(shortLabel); checkResult(interaction, shortLabel, "interaction"); return addInteraction(interaction); }
private void deleteSearchItemForAlias( Alias alias ) { if ( log.isDebugEnabled() ) { log.debug( "Deleting SearchItems for Alias: " + alias.getName() + " (" + alias.getAc() + "); Parent AC: " + alias.getParentAc() ); } if ( !isAliasSearchable( alias ) ) { return; } SearchItem searchItem = searchItemForAlias( alias ); IntactContext.getCurrentInstance().getDataContext().getDaoFactory() .getSearchItemDao().delete( searchItem ); }
public GeneratedEntry addExperimentWithShortLabel(String shortLabel) { Experiment experiment = intactContext.getDataContext().getDaoFactory() .getExperimentDao().getByShortLabel(shortLabel); checkResult(experiment, shortLabel, "experiment"); return addExperiment(experiment); }
public GeneratedEntry addInteractorWithShortLabel(String shortLabel) { Interactor interactor = intactContext.getDataContext().getDaoFactory() .getInteractorDao().getByShortLabel(shortLabel); checkResult(interactor, shortLabel, "interactor"); return addInteractor(interactor); }
public IDatabaseConnection getDatabaseConnection() { IntactContext context = IntactContext.getCurrentInstance(); Connection con = context.getDataContext().getDaoFactory().connection(); IDatabaseConnection connection = new DatabaseConnection(con); DatabaseConfig config = connection.getConfig(); config.setProperty( DatabaseConfig.PROPERTY_DATATYPE_FACTORY, dataTypeFactory ); return connection; }
public static void checkCvInteractorType( ) { if ( false == interatorTypeChecked ) { // Load CvInteractorType( interaction / MI: ) cvInteractionType = IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getCvObjectDao(CvInteractorType.class).getByXref(CvInteractorType.getInteractionMI()); if ( cvInteractionType == null ) { MessageHolder.getInstance().addCheckerMessage( new Message( "Could not find CvInteractorType( interaction )." ) ); } interatorTypeChecked = true; } }