public static void setDryRun(IntactContext context, boolean isDryRun) { context.getSession().setAttribute(DRY_RUN_ATT, isDryRun); } }
public static boolean isDryRun(IntactContext context) { return (Boolean) context.getSession().getAttribute(DRY_RUN_ATT); }
public static CacheContext getInstance(IntactContext context) { CacheContext cacheContext = (CacheContext) context.getSession().getAttribute(ATT_NAME); if (cacheContext == null) { cacheContext = new CacheContext(); context.getSession().setAttribute(ATT_NAME, cacheContext); } return cacheContext; }
private static void persistSchemaVersionIfNecessary( IntactContext context ) { IntactSession session = context.getSession(); Object obj = session.getApplicationAttribute( SCHEMA_VERSION_TO_BE_PERSISTED_FLAG ); if ( obj == null ) { return; } boolean needsToBePersisted = ( Boolean ) obj; if ( needsToBePersisted ) { persistSchemaVersion(context); session.setApplicationAttribute( SCHEMA_VERSION_TO_BE_PERSISTED_FLAG, Boolean.FALSE ); } }
private static DaoFactory getDefaultDaoFactory(IntactContext context) { IntactSession session = context.getSession(); return DaoFactory.getCurrentInstance(session, RuntimeConfig.getCurrentInstance(session).getDefaultDataConfig()); }
public static DaoFactory getCurrentInstance( IntactContext context ) { return getCurrentInstance( context.getSession(), context.getConfig().getDefaultDataConfig() ); }
public static DaoFactory getCurrentInstance( IntactContext context, String dataConfigName ) { return getCurrentInstance( context.getSession(), context.getConfig().getDataConfig( dataConfigName ) ); }
private static void persistInstitutionAndCvsIfNecessary( IntactContext context ) throws IntactTransactionException { IntactSession session = context.getSession(); Object obj = session.getApplicationAttribute( INSTITUTION_TO_BE_PERSISTED_FLAG ); if ( obj == null ) { return; } boolean needsToBePersisted = ( Boolean ) obj; if ( needsToBePersisted ) { persistInstitution(context); persistBasicCvObjects(context); session.setApplicationAttribute( INSTITUTION_TO_BE_PERSISTED_FLAG, Boolean.FALSE ); } }
private static void persistSchemaVersion(IntactContext context) { IntactSession session = context.getSession(); SchemaVersion requiredVersion = context.getConfig().getDefaultDataConfig().getMinimumRequiredVersion(); DbInfo dbInfo = new DbInfo(DbInfo.SCHEMA_VERSION, requiredVersion.toString()); if (log.isDebugEnabled()) log.debug("Persisting schema version: " + requiredVersion.toString()); DaoFactory daoFactory = DaoFactory.getCurrentInstance(session, RuntimeConfig.getCurrentInstance(session).getDefaultDataConfig()); context.getDataContext().beginTransaction(); daoFactory.getDbInfoDao().persist(dbInfo); try { context.getDataContext().commitTransaction(); } catch (IntactTransactionException e) { log.error(e); } }