public class ThumbnailCtx
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
ThumbnailCtx.NoThumbnail
Marker exception which is thrown by all methods which wish to tell
their callers that for whatever reason the desired Thumbnail is not
available, in which case the caller can use a *Direct method instead.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_MIME_TYPE
Default thumbnail MIME type.
|
Constructor and Description |
---|
ThumbnailCtx(ome.api.IQuery queryService,
ome.api.IUpdate updateService,
ome.api.IPixels pixelsService,
ome.api.IRenderingSettings settingsService,
ome.io.nio.ThumbnailService thumbnailService,
ome.system.OmeroContext applicationContext,
SecuritySystem securitySystem,
long userId)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
java.awt.Dimension |
calculateXYWidths(ome.model.core.Pixels pixels,
int longestSide)
Calculates the ratio of the two sides of a Pixel set and returns the
X and Y widths based on the longest side maintaining aspect ratio.
|
void |
createAndPrepareMissingRenderingSettings(java.util.Set<java.lang.Long> pixelsIds)
Resets a given set of Pixels rendering settings to the default
effectively creating any which do not exist.
|
ome.model.display.Thumbnail |
createThumbnailMetadata(ome.model.core.Pixels pixels,
java.awt.Dimension dimensions)
Creates metadata for a thumbnail of a given set of pixels set and X-Y
dimensions.
|
boolean |
dirtyMetadata(long pixelsId)
Whether or not the thumbnail metadata for a given Pixels ID is dirty
(the RenderingDef has been updated since the Thumbnail was).
|
ome.model.display.Thumbnail |
getMetadata(long pixelsId)
Retrieves the Thumbnail object for a given Pixels ID.
|
ome.model.display.Thumbnail |
getMetadataSimple(long pixelsId)
Retrieves the Thumbnail object for a given Pixels ID.
|
ome.model.core.Pixels |
getPixels(long pixelsId)
Retrieves the Pixels object for a given Pixels ID.
|
ome.model.display.RenderingDef |
getSettings(long pixelsId)
Retrieves the RenderingDef object for a given Pixels ID.
|
long |
getUserId()
Retrieves the current user ID to use for queries.
|
boolean |
hasMetadata(long pixelsId)
Whether or not thumbnail metadata is available for a given Pixels ID.
|
boolean |
hasSettings(long pixelsId)
Whether or not settings are available for a given Pixels ID.
|
boolean |
isExtendedGraphCritical(java.util.Set<java.lang.Long> pixelsIds)
Whether or not we're extended graph critical for a given set of
dimension pools.
|
boolean |
isThumbnailCached(long pixelsId)
Checks to see if a thumbnail is in the on disk cache or not.
|
java.util.List<ome.model.display.Thumbnail> |
loadAllMetadata(long pixelsId)
Retrieves all thumbnail metadata available in the database for a given
Pixels ID.
|
void |
loadAndPrepareMetadata(java.util.Set<java.lang.Long> pixelsIds,
java.awt.Dimension dimensions)
Bulk loads and prepares metadata for a group of pixels sets.
|
void |
loadAndPrepareMetadata(java.util.Set<java.lang.Long> pixelsIds,
java.awt.Dimension dimensions,
boolean createMissing)
Bulk loads and prepares metadata for a group of pixels sets.
|
void |
loadAndPrepareMetadata(java.util.Set<java.lang.Long> pixelsIds,
int longestSide)
Bulk loads and prepares metadata for a group of pixels sets.
|
void |
loadAndPrepareRenderingSettings(long pixelsId,
long settingsId)
Loads and prepares a rendering settings for a Pixels ID and RenderingDef
ID.
|
void |
loadAndPrepareRenderingSettings(java.util.Set<java.lang.Long> pixelsIds)
Bulk loads a set of rendering settings for a group of pixels sets and
prepares our internal data structures.
|
void |
setUserId(long userId)
Sets the user ID to use for queries.
|
public static final java.lang.String DEFAULT_MIME_TYPE
public ThumbnailCtx(ome.api.IQuery queryService, ome.api.IUpdate updateService, ome.api.IPixels pixelsService, ome.api.IRenderingSettings settingsService, ome.io.nio.ThumbnailService thumbnailService, ome.system.OmeroContext applicationContext, SecuritySystem securitySystem, long userId)
queryService
- OMERO query service to use.updateService
- OMERO update service to use.pixelsService
- OMERO pixels service to use.settingsService
- OMERO rendering settings service to use.thumbnailService
- OMERO thumbnail service to use.applicationContext
- OMERO application contextsecuritySystem
- OMERO security system for this session.userId
- Current user ID.public long getUserId()
public void setUserId(long userId)
userId
- The user ID to use for queries.public void loadAndPrepareRenderingSettings(java.util.Set<java.lang.Long> pixelsIds)
pixelsIds
- Set of Pixels IDs to prepare rendering settings for.public void loadAndPrepareRenderingSettings(long pixelsId, long settingsId)
pixelsId
- Pixels ID to load.settingsId
- RenderingDef ID to load an prepare settings for.public void loadAndPrepareMetadata(java.util.Set<java.lang.Long> pixelsIds, int longestSide)
pixelsIds
- Pixels IDs to prepare metadata for.longestSide
- The longest side of the thumbnails requested.public void loadAndPrepareMetadata(java.util.Set<java.lang.Long> pixelsIds, java.awt.Dimension dimensions)
pixelsIds
- Pixels IDs to prepare metadata for.dimensions
- X-Y dimensions of the thumbnails requested.public void loadAndPrepareMetadata(java.util.Set<java.lang.Long> pixelsIds, java.awt.Dimension dimensions, boolean createMissing)
pixelsIds
- Pixels IDs to prepare metadata for.dimensions
- X-Y dimensions of the thumbnails requested.public java.util.List<ome.model.display.Thumbnail> loadAllMetadata(long pixelsId)
pixelsId
- Pixels ID to retrieve thumbnail metadata for.public void createAndPrepareMissingRenderingSettings(java.util.Set<java.lang.Long> pixelsIds)
pixelsIds
- Pixels IDspublic boolean hasSettings(long pixelsId)
pixelsId
- Pixels ID to check for availability.true
if settings are available and
false
otherwise.public boolean hasMetadata(long pixelsId)
pixelsId
- Pixels ID to check for availability.true
if metadata is available and
false
otherwise.public ome.model.core.Pixels getPixels(long pixelsId)
pixelsId
- Pixels ID to retrieve the Pixels object for.public ome.model.display.RenderingDef getSettings(long pixelsId)
pixelsId
- Pixels ID to retrieve the RenderingDef object for.public ome.model.display.Thumbnail getMetadata(long pixelsId) throws ThumbnailCtx.NoThumbnail
pixelsId
- Pixels ID to retrieve the Thumbnail object for.ThumbnailCtx.NoThumbnail
public ome.model.display.Thumbnail getMetadataSimple(long pixelsId) throws ome.conditions.ResourceError
pixelsId
- Pixels ID to retrieve the Thumbnail object for.ome.conditions.ResourceError
public boolean dirtyMetadata(long pixelsId)
pixelsId
- Pixels ID to check for dirty metadata.true
if the metadata is dirty false
otherwise.public boolean isThumbnailCached(long pixelsId)
pixelsId
- The Pixels set the thumbnail is for.public java.awt.Dimension calculateXYWidths(ome.model.core.Pixels pixels, int longestSide)
pixels
- The Pixels set to calculate against.longestSide
- The size of the longest side of the thumbnail
requested.public boolean isExtendedGraphCritical(java.util.Set<java.lang.Long> pixelsIds)
isGraphCritical() == true
and the Pixels set does not
belong to us.
isGraphCritical() == false
, the Pixels set does not
belong to us and the group is READ-ONLY.
pixelsIds
- Set of Pixels to check if we're graph critical for.true
if we're graph critical, and
false
otherwise.public ome.model.display.Thumbnail createThumbnailMetadata(ome.model.core.Pixels pixels, java.awt.Dimension dimensions)
pixels
- The Pixels set to create thumbnail metadata for.dimensions
- The dimensions of the thumbnail.getMetadata(long)