// NOTE: the cache is shared by all users.
// The current user may not have access to a cache item previously
// created by another user.
if ( !Utils.getSystemOrUserReadAccess( wcdf.getPath() ).fileExists( cdeFilePath ) ) {
throw new ThingWriteException( new FileNotFoundException( cdeFilePath ) );
}
// 3. Reading from the cache?
CdfRunJsDashboardWriteResult dashWrite;
if ( !bypassCacheRead ) {
try {
dashWrite = getDashboardWriteResultFromCache( cacheKey, cdeFilePath );
} catch ( FileNotFoundException ex ) {
// Is in cache but:
// * file doesn't exist (anymore)
// * user has insufficient permissions to access the cdfde file
throw new ThingWriteException( ex );
}
if ( dashWrite != null ) {
// Return cached write result
return dashWrite;
}
// Not in cache or cache item expired/invalidated
} else {
_logger.info( "Bypassing dashboard render cache, rendering." );
}
// 4. Get the Dashboard object
Dashboard dash;
try {
dash = this.getDashboard( wcdf, cdeFilePath, bypassCacheRead );
} catch ( ThingReadException ex ) {
throw new ThingWriteException( ex );
}
// 5. Obtain a Writer for the CdfRunJs format
dashWrite = this.writeDashboardToCdfRunJs( dash, options, bypassCacheRead );