View Javadoc

1   /* ===================================================================
2    * Copyright 2002-05 SRI International.
3    * Released under the MOZILLA PUBLIC LICENSE Version 1.1
4    * which can be obtained at http://www.mozilla.org/MPL/MPL-1.1.html
5    * This software is distributed on an "AS IS"
6    * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
7    * See the License for the specific language governing rights and
8    * limitations under the License.
9    * =================================================================== */
10  package com.sri.emo.wizard.creation;
11  
12  import com.sri.common.dbobj.ObjectNotFoundException;
13  import com.sri.common.dbobj.RepositoryConversionException;
14  import com.sri.common.dbobj.RepositoryException;
15  import com.sri.emo.wizard.creation.model.CreationBeans;
16  
17  
18  /***
19   * The boundary interface between the controller and the underlying DBObjects.
20   *
21   * @author Michael Rimov
22   * @version 1.0
23   */
24  public interface CreationRepository {
25  
26      /***
27       * Adds a CompletionBean to the underlying data store.
28       *
29       * @param newValue CompletionBean the metadata for the wizard to update.
30       * @throws RepositoryException           upon underlying error.
31       * @throws RepositoryConversionException if there is an error converting
32       *                                       the underlying dbobjects to POJOs
33       */
34      int add(CreationBeans newValue) throws RepositoryException, RepositoryConversionException;
35  
36      /***
37       * Updates the completion bean.
38       *
39       * @param newValue CompletionBean
40       * @throws RepositoryException           upon update erorr.
41       * @throws RepositoryConversionException if there is an error converting
42       *                                       the underlying dbobjects to POJOs
43       */
44      void update(CreationBeans newValue) throws RepositoryException, RepositoryConversionException,
45              ObjectNotFoundException;
46  
47      /***
48       * Deletes the completion bean from the underlying data store.
49       *
50       * @param wizardId int the wizard surrogate key.
51       * @throws RepositoryException           upon deletion error.
52       * @throws RepositoryConversionException if there is an error converting
53       *                                       the underlying dbobjects to POJOs
54       */
55      void delete(int wizardId) throws RepositoryException, ObjectNotFoundException;
56  
57      /***
58       * Finds the completion bean by id number.
59       *
60       * @param wizardId int the underlying wizard id (surrogate key)
61       * @return CompletionBean the resulting bean.
62       * @throws RepositoryException           for database communication error.
63       * @throws ObjectNotFoundException       if the record does not exist.
64       * @throws RepositoryConversionException if there is an error converting
65       *                                       the underlying dbobjects to POJOs
66       */
67      CreationBeans findById(int wizardId) throws RepositoryException, ObjectNotFoundException,
68              RepositoryConversionException;
69  
70  
71      /***
72       * Finds the bean by an id that was generated earlier by other pieces of
73       * the factory.
74       *
75       * @param previouslyGeneratedKey Object -- typically some form of integer
76       * @return CompletionBean the resulting bean.
77       * @throws RepositoryException           for database communication error.
78       * @throws ObjectNotFoundException       if the record does not exist.
79       * @throws RepositoryConversionException if there is an error converting
80       *                                       the underlying dbobjects to POJOs
81       */
82      CreationBeans findById(Object previouslyGeneratedKey) throws RepositoryException, ObjectNotFoundException,
83              RepositoryConversionException;
84  
85  }