|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectome.logic.AbstractLevel2Service
ome.services.delete.DeleteBean
@Transactional public class DeleteBean
Strict implementation of the IDelete
service interface which will use
the SecuritySystem
via
SecuritySystem.runAsAdmin(AdminAction)
to forcibly
delete instances.
IDelete
Field Summary | |
---|---|
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.apache.commons.logging.Log |
log
|
static String |
PLATEIMAGES_QUERY
|
static String |
SETTINGSID_QUERY
|
protected SessionFactory |
sf
|
Fields inherited from class ome.logic.AbstractLevel2Service |
---|
iQuery, iUpdate, metadata, queryFactory, sec |
Constructor Summary | |
---|---|
DeleteBean(LocalAdmin admin,
SessionFactory sf)
|
Method Summary | |
---|---|
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. |
Methods inherited from class ome.logic.AbstractLevel2Service |
---|
getBeanHelper, getExtendedMetadata, getQueryFactory, getSecuritySystem, selfConfigure, setExtendedMetadata, setQueryFactory, setQueryService, setSecuritySystem, setUpdateService |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final org.apache.commons.logging.Log log
public static final String IMAGE_QUERY
Image
graph including: Pixels, Channel, LogicalChannel,
StatsInfo, PlaneInfo, Thumbnails, file maps, OriginalFiles, and Settings
public 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
Constructor Detail |
---|
public DeleteBean(LocalAdmin admin, SessionFactory sf)
Method Detail |
---|
public final Class<? extends ServiceInterface> getServiceInterface()
getServiceInterface
in interface SelfConfigurableService
public List<ome.model.IObject> checkImageDelete(long id, boolean force)
IDelete
Image
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 IDelete
id
- of the Image
to be deleted.force
- return value will be included
public 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 IDelete
public void deleteImage(long id, boolean force) throws ome.conditions.SecurityViolation, ome.conditions.ValidationException
IDelete
Image
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:
Pixels
PixelsDimensions
PlaneInfo
RenderingDef
OriginalFile
ImageAnnotationLink
Image
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 IDelete
id
- 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
IDelete
Image
instances within a single transaction via
the IDelete.deleteImage(long, boolean)
method.
deleteImages
in interface IDelete
force
- 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
IDelete
Image
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 IDelete
force
- As IDelete.deleteImage(long, boolean)
ome.conditions.ValidationException
- As IDelete.deleteImage(long, boolean)
ome.conditions.ApiUsageException
- As IDelete.deleteImage(long, boolean)
ome.conditions.SecurityViolation
public void deleteSettings(long imageId)
IDelete
deleteSettings
in interface IDelete
public 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.
WellSampleAnnotationLinks, WellAnnotationLinks, and PlateAnnotationLinks are
deleted as necessary.
deletePlate
in interface IDelete
protected 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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Version: 4.3.3-00d1137e-b2894
Copyright © 2009 The University of Dundee. All Rights Reserved.