@Transactional public class DeleteBean extends AbstractLevel2Service implements IDelete
IDelete service interface which will use
the SecuritySystem via
SecuritySystem.runAsAdmin(AdminAction) to forcibly
delete instances.IDelete| Modifier and Type | Field and Description |
|---|---|
protected LocalAdmin |
admin |
static String |
CHANNELID_QUERY |
static String |
IMAGE_QUERY
Loads an
Image graph including: Pixels, Channel, LogicalChannel,
StatsInfo, PlaneInfo, Thumbnails, file maps, OriginalFiles, and Settings |
static org.slf4j.Logger |
log |
static String |
PLATEIMAGES_QUERY |
static String |
SETTINGSID_QUERY |
protected SessionFactory |
sf |
iQuery, iUpdate, metadata, queryFactory, sec| Constructor and Description |
|---|
DeleteBean(LocalAdmin admin,
SessionFactory sf) |
| Modifier and Type | Method and Description |
|---|---|
List<ome.model.IObject> |
checkImageDelete(long id,
boolean force)
Returns all entities which would prevent the given
Image id from
being deleted. |
protected void |
collect(ome.services.delete.UnloadedCollector delete,
ome.model.core.Image i)
Walks the
Image graph collecting unloaded instances of all
entities for later delete. |
void |
deleteChannels(long imageId) |
void |
deleteImage(long id,
boolean force)
Deletes an
Image and all related (subordinate) metadata as
defined below. |
void |
deleteImages(Set<Long> ids,
boolean force)
Deletes several
Image instances within a single transaction via
the IDelete.deleteImage(long, boolean) method. |
void |
deleteImagesByDataset(long datasetId,
boolean force)
Deletes the user-visible
Image instances of the given
Dataset within a single transaction via the
IDelete.deleteImage(long, boolean). |
void |
deletePlate(long plateId)
Deletes all the images contained in a plate as if deleted by:
deleteImage(id, true)
so that all Dataset and Annotation links are broken, with WellSamples removed
first. |
void |
deleteSettings(long imageId)
Deletes all rendering settings for the given Pixel id.
|
protected void |
getImageAndCount(ome.model.core.Image[] images,
long id,
ome.services.delete.UnloadedCollector delete)
Uses the locally defined query to load an
Image and calls
collect(UnloadedCollector, Image) in order to define a list of
what will be deleted. |
Class<? extends ServiceInterface> |
getServiceInterface() |
List<ome.model.IObject> |
previewImageDelete(long id,
boolean force)
This uses
IMAGE_QUERY to load all the subordinate metadata of the
Image which will be deleted. |
getBeanHelper, getExtendedMetadata, getQueryFactory, getSecuritySystem, selfConfigure, setExtendedMetadata, setQueryFactory, setQueryService, setSecuritySystem, setUpdateServicepublic static final org.slf4j.Logger log
public static final String IMAGE_QUERY
Image graph including: Pixels, Channel, LogicalChannel,
StatsInfo, PlaneInfo, Thumbnails, file maps, OriginalFiles, and Settingspublic static final String SETTINGSID_QUERY
public static final String CHANNELID_QUERY
public static final String PLATEIMAGES_QUERY
protected final LocalAdmin admin
protected final SessionFactory sf
public DeleteBean(LocalAdmin admin, SessionFactory sf)
public final Class<? extends ServiceInterface> getServiceInterface()
getServiceInterface in interface SelfConfigurableServicepublic List<ome.model.IObject> checkImageDelete(long id, boolean force)
IDeleteImage id from
being deleted. The force boolean determines whether or not the user's
collections should be removed in order to facilitate the delete.
Currently this only includes datasets. The force boolean
determines if Dataset instances from the same user will be
considered as constraints. Regardless of force, datasets from other users
are considered constraints.checkImageDelete in interface IDeleteid - of the Image to be deleted.force - return value will be includedpublic List<ome.model.IObject> previewImageDelete(long id, boolean force)
IMAGE_QUERY to load all the subordinate metadata of the
Image which will be deleted.previewImageDelete in interface IDeletepublic void deleteImage(long id,
boolean force)
throws ome.conditions.SecurityViolation,
ome.conditions.ValidationException
IDeleteImage and all related (subordinate) metadata as
defined below. This method calls IDelete.checkImageDelete(long, boolean)
and throws a ConstraintViolation exception with the results of
that call are not empty; then it forcibly deletes all objects returned by
IDelete.previewImageDelete(long, boolean)
The deleted metadata includes all of the following types which belong to the current user:
PixelsPixelsDimensionsPlaneInfoRenderingDefOriginalFileImageAnnotationLinkImage data graph will be considered corrupted and a
ValidationException will be thrown.
For the types:
Thumbnail
If the Image is not owned by the current user, then
SecurityViolation is thrown, unless the user is root or the group
leader.
Dataset owned by another user. If the Image is contained
in other datasets belonging to the same user, then the
force parameter decides what will happen. A force value of true implies
that the Image will be removed as well as the related
links.
The Pixels.getRelatedTo() field will be set to null for all
Pixels pointing to a Pixels instance which is about to
be deleted.deleteImage in interface IDeleteid - id of the Image to be deletedforce - Image will be removed even if contained in other
datasets. If false, a
ConstraintViolation will be raised.ome.conditions.SecurityViolation - If the Image does not belong to the current user.ome.conditions.ValidationException - throws an exception if there is any unexpected object which
prevents this object from being deleted, i.e. not in
IDelete.checkImageDelete(long, boolean) (check first)public void deleteImages(Set<Long> ids, boolean force) throws ome.conditions.SecurityViolation, ome.conditions.ValidationException, ome.conditions.ApiUsageException
IDeleteImage instances within a single transaction via
the IDelete.deleteImage(long, boolean) method.deleteImages in interface IDeleteforce - As IDelete.deleteImage(long, boolean)ome.conditions.SecurityViolation - As IDelete.deleteImage(long, boolean)ome.conditions.ValidationException - As IDelete.deleteImage(long, boolean)ome.conditions.ApiUsageException - As IDelete.deleteImage(long, boolean)public void deleteImagesByDataset(long datasetId,
boolean force)
throws ome.conditions.SecurityViolation,
ome.conditions.ValidationException,
ome.conditions.ApiUsageException
IDeleteImage instances of the given
Dataset within a single transaction via the
IDelete.deleteImage(long, boolean). In addition, before Image
deletion is attempted, the links to the given
Dataset are first removed, otherwise this method would always
require a "force" argument of true.deleteImagesByDataset in interface IDeleteforce - As IDelete.deleteImage(long, boolean)ome.conditions.ValidationException - As IDelete.deleteImage(long, boolean)ome.conditions.ApiUsageException - As IDelete.deleteImage(long, boolean)ome.conditions.SecurityViolationpublic void deleteSettings(long imageId)
IDeletedeleteSettings in interface IDeletepublic void deleteChannels(long imageId)
public void deletePlate(long plateId)
IDelete
deleteImage(id, true)
so that all Dataset and Annotation links are broken, with WellSamples removed
first. Then all Wells in the Plate and the Plate itself are removed.
WellAnnotationLinks, and PlateAnnotationLinks are
deleted as necessary.deletePlate in interface IDeleteprotected void getImageAndCount(ome.model.core.Image[] images,
long id,
ome.services.delete.UnloadedCollector delete)
Image and calls
collect(UnloadedCollector, Image) in order to define a list of
what will be deleted.
This method fulfills the previewImageDelete(long, boolean)
contract and as such is used by deleteImage(long, boolean) in
order to fulfill its contract.protected void collect(ome.services.delete.UnloadedCollector delete,
ome.model.core.Image i)
Image graph collecting unloaded instances of all
entities for later delete.
Version: 5.1.1-ice35-b43
Copyright © 2015 The University of Dundee & Open Microscopy Environment. All Rights Reserved.