@Override public String toString() { return "Transaction [id="+getId()+", committed="+wasCommitted()+"];"; } }
@Override public synchronized Session getCurrentSession() { return super.getCurrentSession(); }
@Override public IntactTransaction getCurrentTransaction() { return super.getCurrentTransaction(); }
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 CvObject getByAc( String ac, boolean forceReload ) { if ( !forceReload && cachedByAc.containsKey( ac ) ) { return cachedByAc.get( ac ); } CvObject cvObject = getDaoFactory().getCvObjectDao().getByAc( ac ); if ( cvObject == null ) { return null; } putCv( cvObject ); return cvObject; }
public GeneratedEntry addInteractionWithAc(String ac) { Interaction interaction = intactContext.getDataContext().getDaoFactory() .getInteractionDao().getByAc(ac); checkResult(interaction, ac, "interaction"); return addInteraction(interaction); }
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; }
public GeneratedEntry addInteractionWithShortLabel(String shortLabel) { Interaction interaction = intactContext.getDataContext().getDaoFactory() .getInteractionDao().getByShortLabel(shortLabel); checkResult(interaction, shortLabel, "interaction"); return addInteraction(interaction); }
private Connection getConnection() { BaseDao dao = daoFactory.getBaseDao(); con = ((Session) dao.getSession()).connection(); return con; }
public GeneratedEntry addInteractorWithShortLabel(String shortLabel) { Interactor interactor = intactContext.getDataContext().getDaoFactory() .getInteractorDao().getByShortLabel(shortLabel); checkResult(interactor, shortLabel, "interactor"); return addInteractor(interactor); }
public void commitAllActiveTransactions() throws IntactTransactionException { Collection<DataConfig> dataConfigs = RuntimeConfig.getCurrentInstance( session ).getDataConfigs(); for ( DataConfig dataConfig : dataConfigs ) { DaoFactory daoFactory = getDaoFactory( dataConfig ); if ( daoFactory.isTransactionActive() ) { daoFactory.getCurrentTransaction().commit(); } } }
private DaoFactory getDaoFactory( DataConfig dataConfig ) { return DaoFactory.getCurrentInstance( session, dataConfig ); }
public BaseDao getBaseDao() { // It is returning an ExperimentDaoImpl because HibernateBaseDaoImpl is an abstract class, and ExperimentDaoImpl // implement all HibernateBaseDaoImpl anyway. return new ExperimentDaoImpl( getCurrentSession(), intactSession ); }
/** * @since 1.5 */ public MineInteractionDao getMineInteractionDao() { return new MineInteractionDaoImpl( getCurrentSession(), intactSession ); }
public IntactTransaction beginTransaction() { log.debug( "Starting transaction..." ); Transaction transaction = getCurrentSession().beginTransaction(); // wrap it currentTransaction = new IntactTransaction( intactSession, transaction ); return currentTransaction; }
@Override public boolean isTransactionActive() { return super.isTransactionActive(); }
private SearchableQuery createSimpleQueryWithWildcards( SearchableQuery query ) { return DaoUtils.autoAddWildcards( query ); } }
public boolean isTransactionActive() { boolean active = ( currentTransaction != null && !currentTransaction.wasCommitted() ); if( log.isDebugEnabled() ) { log.debug( "Current transaction is " + (currentTransaction == null ? "null" : ( active ? "active" : "committed" ) ) ); } return active; }
public int count( Class<? extends Searchable> searchable, SearchableQuery query ) { int count = getDao().countByQuery( searchable, query ); if ( count > 0 ) { return count; } return getDao().countByQuery( searchable, createSimpleQueryWithWildcards( query ) ); }