public static void setDryRun(IntactContext context, boolean isDryRun) { context.getSession().setAttribute(DRY_RUN_ATT, isDryRun); } }
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; }
public static UserContext getCurrentInstance( IntactSession session ) { if ( !session.isRequestAvailable() ) { throw new IntactException( "Cannot get a UserContext if the IntactSession does not have request and session scope" ); } Object obj = session.getAttribute( SESSION_ATT_NAME ); if ( obj != null ) { return ( UserContext ) obj; } UserContext userContext = createDefaultUserContext( session ); session.setAttribute( SESSION_ATT_NAME, userContext ); return userContext; }
public static CvContext getCurrentInstance( IntactSession session ) { CvContext cvContext; if (session.isWebapp()) { cvContext = ( CvContext ) session.getApplicationAttribute(SESSION_PARAM_NAME); } else { cvContext = ( CvContext ) session.getAttribute(SESSION_PARAM_NAME); } if ( cvContext == null ) { log.debug( "Creating new CvContext" ); cvContext = new CvContext( session ); if (session.isWebapp()) { session.setApplicationAttribute(SESSION_PARAM_NAME, cvContext ); } else { session.setAttribute(SESSION_PARAM_NAME, cvContext ); } } // check if the transaction /* String oldTransactionId = (String) session.getAttribute(CURRENT_TRANS_ID); String transactionId = IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getCurrentTransaction().getId(); if (oldTransactionId != null && !oldTransactionId.equals(transactionId)) { if (log.isDebugEnabled()) log.debug("CvContext cache is stale"); cvContext.clearCache(); } session.setAttribute(CURRENT_TRANS_ID, transactionId); */ return cvContext; }