root/trunk/components/common/src/ome/api/IUpdate.java
| Revision 2210, 3.0 kB (checked in by jmoore, 11 months ago) | |
|---|---|
|
|
| Line | |
|---|---|
| 1 | /* |
| 2 | * ome.api.IUpdate |
| 3 | * |
| 4 | * Copyright 2006 University of Dundee. All rights reserved. |
| 5 | * Use is subject to license terms supplied in LICENSE.txt |
| 6 | */ |
| 7 | |
| 8 | package ome.api; |
| 9 | |
| 10 | // Java imports |
| 11 | import java.util.Collection; |
| 12 | |
| 13 | import ome.annotations.Validate; |
| 14 | import ome.conditions.ValidationException; |
| 15 | import ome.model.IObject; |
| 16 | |
| 17 | /** |
| 18 | * Provides methods for directly updating object graphs. IUpdate is the lowest |
| 19 | * level (level-1) interface which may make changes (INSERT, UPDATE, DELETE) to |
| 20 | * the database. All other methods of changing the database may leave it in an |
| 21 | * inconsistent state. |
| 22 | * |
| 23 | * <p> |
| 24 | * All the save* methods act recursively on the entire object graph, replacing |
| 25 | * placeholders and details where necessary, and then "merging" the final graph. |
| 26 | * This means that the objects that are passed into IUpdate.save* methods are |
| 27 | * copied over to new instances which are then returned. The original objects |
| 28 | * <b>should be discarded</b>. |
| 29 | * </p> |
| 30 | * |
| 31 | * <p> |
| 32 | * All methods throw {@link ome.conditions.ValidationException} if the input |
| 33 | * objects do not pass validation, and |
| 34 | * {@link ome.conditions.OptimisticLockException} if the version of a given has |
| 35 | * already been incremented. |
| 36 | * |
| 37 | * @author <br> |
| 38 | * Josh Moore <a |
| 39 | * href="mailto:josh.moore@gmx.de"> josh.moore@gmx.de</a> |
| 40 | * @version 3.0 <small> (<b>Internal version:</b> $Revision$ $Date$) </small> |
| 41 | * @since OMERO3.0 |
| 42 | * @see ome.util.Validation |
| 43 | * @see ome.logic.UpdateImpl |
| 44 | * @see ome.model.internal.Details |
| 45 | */ |
| 46 | public interface IUpdate extends ServiceInterface { |
| 47 | |
| 48 | /** @see ome.api.IUpdate */ |
| 49 | void saveCollection(@Validate(IObject.class) |
| 50 | Collection<IObject> graph); |
| 51 | |
| 52 | /** @see ome.api.IUpdate */ |
| 53 | void saveObject(IObject graph); |
| 54 | |
| 55 | /** @see ome.api.IUpdate */ |
| 56 | void saveArray(IObject[] graph); |
| 57 | |
| 58 | /** @see ome.api.IUpdate */ |
| 59 | <T extends IObject> T saveAndReturnObject(T graph); |
| 60 | |
| 61 | /** @see ome.api.IUpdate */ |
| 62 | IObject[] saveAndReturnArray(IObject[] graph); |
| 63 | |
| 64 | /** |
| 65 | * Deletes a single entity. Unlike the other IUpdate methods, deleteObject |
| 66 | * does not propagate to related entities (e.g. foreign key relationships) |
| 67 | * and so calls to deleteObject must be properly ordered. |
| 68 | * |
| 69 | * @param row |
| 70 | * a persistent {@link IObject{ to be deleted. |
| 71 | * @throws ValidationException |
| 72 | * if the row is locked, has foreign key constraints, or is |
| 73 | * otherwise marked un-deletable. |
| 74 | */ |
| 75 | void deleteObject(IObject row) throws ValidationException; |
| 76 | |
| 77 | /** |
| 78 | * Initiates full-text indexing for the given object. This may have to wait |
| 79 | * for the current {@link ome.services.fulltext.FullTextThread} to finish. |
| 80 | * Can only be executed by an admin. Other users must wait for the |
| 81 | * background {@link Thread} to complete. |
| 82 | * |
| 83 | * @param row |
| 84 | * a persistent {@link IObject} to be deleted |
| 85 | * @throws ValidationException |
| 86 | * if the object does not exist or is nul |
| 87 | */ |
| 88 | void indexObject(IObject row) throws ValidationException; |
| 89 | } |
Note: See TracBrowser
for help on using the browser.
