root/trunk/components/common/src/ome/api/IUpdate.java

Revision 5216, 3.7 KB (checked in by jmoore, 6 months ago)

ticket:1408 - updating docs for saveAndReturnIds

  • Property svn:keywords set to
    Date
    Revision
    Id
    URL
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
8package ome.api;
9
10// Java imports
11import java.util.Collection;
12import java.util.List;
13
14import ome.annotations.Validate;
15import ome.conditions.ValidationException;
16import ome.model.IObject;
17
18/**
19 * Provides methods for directly updating object graphs. IUpdate is the lowest
20 * level (level-1) interface which may make changes (INSERT, UPDATE, DELETE) to
21 * the database. All other methods of changing the database may leave it in an
22 * inconsistent state.
23 *
24 * <p>
25 * All the save* methods act recursively on the entire object graph, replacing
26 * placeholders and details where necessary, and then "merging" the final graph.
27 * This means that the objects that are passed into IUpdate.save* methods are
28 * copied over to new instances which are then returned. The original objects
29 * <b>should be discarded</b>.
30 * </p>
31 *
32 * <p>{@link #saveAndReturnIds(IObject[])} behaves slightly differently in that
33 * it does <em>not</em> handle object modifications. The graph of objects
34 * passed in can consist <em>ONLY</em> if either newly created objects without
35 * ids or of unloaded objects with ids. <em>Note:</em> The ids of the saved values
36 * may not be in order. This is caused by persistence-by-transitivity. Hibernate
37 * may detect an item later in the array if they are interconnected and therefore
38 * choose to save it first.
39 * </p>
40 *
41 * <p>
42 * All methods throw {@link ome.conditions.ValidationException} if the input
43 * objects do not pass validation, and
44 * {@link ome.conditions.OptimisticLockException} if the version of a given has
45 * already been incremented.
46 *
47 * @author <br>
48 *         Josh Moore &nbsp;&nbsp;&nbsp;&nbsp; <a
49 *         href="mailto:josh.moore@gmx.de"> josh.moore@gmx.de</a>
50 * @version 3.0 <small> (<b>Internal version:</b> $Revision$ $Date$) </small>
51 * @since OMERO3.0
52 * @see ome.util.Validation
53 * @see ome.logic.UpdateImpl
54 * @see ome.model.internal.Details
55 */
56public interface IUpdate extends ServiceInterface {
57
58    /** Logic differs from other methods. See class description
59     * @see ome.api.IUpdate */
60    List<Long> saveAndReturnIds(IObject[] objects);
61   
62    /** @see ome.api.IUpdate */
63    void saveCollection(@Validate(IObject.class)
64    Collection<IObject> graph);
65
66    /** @see ome.api.IUpdate */
67    void saveObject(IObject graph);
68
69    /** @see ome.api.IUpdate */
70    void saveArray(IObject[] graph);
71
72    /** @see ome.api.IUpdate */
73    <T extends IObject> T saveAndReturnObject(T graph);
74
75    /** @see ome.api.IUpdate */
76    IObject[] saveAndReturnArray(IObject[] graph);
77
78    /**
79     * Deletes a single entity. Unlike the other IUpdate methods, deleteObject
80     * does not propagate to related entities (e.g. foreign key relationships)
81     * and so calls to deleteObject must be properly ordered.
82     *
83     * @param row
84     *            a persistent {@link IObject{ to be deleted.
85     * @throws ValidationException
86     *             if the row is locked, has foreign key constraints, or is
87     *             otherwise marked un-deletable.
88     */
89    void deleteObject(IObject row) throws ValidationException;
90
91    /**
92     * Initiates full-text indexing for the given object. This may have to wait
93     * for the current {@link ome.services.fulltext.FullTextThread} to finish.
94     * Can only be executed by an admin. Other users must wait for the
95     * background {@link Thread} to complete.
96     *
97     * @param row
98     *            a persistent {@link IObject} to be deleted
99     * @throws ValidationException
100     *             if the object does not exist or is nul
101     */
102    void indexObject(IObject row) throws ValidationException;
103}
Note: See TracBrowser for help on using the browser.

1.2.1-PRO © 2008-2009 agile42 all rights reserved (this page was served in: 0.61542 sec.)