1 package com.sri.emo.wizard;
2
3 import com.sri.common.dbobj.ObjectNotFoundException;
4 import com.sri.common.dbobj.RepositoryException;
5 import com.sri.emo.dbobj.WizDefinition;
6
7 import java.util.ArrayList;
8 import java.util.List;
9
10 /***
11 * Repository Interface for wizard definitions. Like all repository
12 * definitions, this interface helps us to isolate database access from the
13 * rest of the program assisting testing and componentization.
14 *
15 * @author Michael Rimov
16 * @version 1.0
17 */
18 public interface WizDefinitionRepository {
19
20 /***
21 * Constant to specify that no sort order is specified when listing
22 * Wizards.
23 */
24 static final String DEFAULT_SORT_ORDER = null;
25
26 /***
27 * <tt>Special Case</tt> constant in case there are no wizards defined.
28 */
29 static final List NO_RESULTS = new ArrayList(0);
30
31 /***
32 * Find a wizard definition by id.
33 *
34 * @param key int the wizard id.
35 * @return WizDefinition
36 * @throws NonHandleableException on underlying database error.
37 * @throws DBRecordNotFoundException if the key doesn't list anything.
38 */
39 WizDefinition findById(int key) throws ObjectNotFoundException, RepositoryException;
40
41
42 /***
43 * List all wizards available on the system
44 *
45 * @param sortOrder String the field to sort by or DEFAULT_SORT_ORDER
46 * if no specific order is desired.
47 * @return A list of wizard definitions. (NO_RESULTS if nothing is found)
48 * @throws NonHandleableException upon underlying query error.
49 */
50 List listAll(String sortOrder) throws RepositoryException;
51
52
53 /***
54 * Returns true if the current requester can add.
55 *
56 * @return boolean true.
57 * @throws NonHandleableException
58 */
59 boolean canRequesterAdd() throws RepositoryException;
60
61
62 }