public <T extends CvObject> T getByMiRef( Class<T> cvType, String miRef, boolean forceReload ) { if ( miRef == null ) { throw new NullPointerException( "miRef" ); } MiRefKey key = new MiRefKey( miRef, cvType ); if ( !forceReload && cachedByMiRef.containsKey( key ) ) { if (log.isDebugEnabled()) log.debug("Getting by miRef: "+miRef+" - Hit"); return ( T ) cachedByMiRef.get( key ); } T cvObject = null; try { cvObject = getDaoFactory().getCvObjectDao().getByPrimaryId( cvType, miRef ); } catch (Exception e) { throw new IntactException("Exception getting cvType "+cvType.getSimpleName()+" with miRef: "+miRef); } if ( cvObject == null ) { if (log.isDebugEnabled()) log.debug("Getting by miRef: "+miRef+" - Missed"); return null; } if (log.isDebugEnabled()) log.debug("Getting by miRef: "+miRef+" - DB Hit"); putCv( cvObject ); putCvInMiRef( miRef, cvObject ); return cvObject; }
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 CvDatabase getPsi() { if ( psi == null ) { DaoFactory daoFactory = IntactContext.getCurrentInstance().getDataContext().getDaoFactory(); CvObjectDao<CvObject> cvdao = daoFactory.getCvObjectDao(); psi = cvdao.getByPrimaryId( CvDatabase.class, CvDatabase.PSI_MI_MI_REF ); if ( psi == null ) { throw new IllegalStateException( "Could not find CvDatabase( IntAct )." ); } } return psi; }
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; }