KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opensubsystems > core > persist > BasicDataFactory


1 /*
2  * Copyright (c) 2003 - 2007 OpenSubsystems s.r.o. Slovak Republic. All rights reserved.
3  *
4  * Project: OpenSubsystems
5  *
6  * $Id: BasicDataFactory.java,v 1.5 2007/01/28 06:54:51 bastafidli Exp $
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; version 2 of the License.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20  */

21
22 package org.opensubsystems.core.persist;
23
24 import java.util.Collection JavaDoc;
25
26 import org.opensubsystems.core.data.DataObject;
27 import org.opensubsystems.core.error.OSSException;
28
29 /**
30  * Basic operations to perform with the data object in the persistence store.
31  * It just defines retrieve, create and delete operations since these are the
32  * basic we need to perform any kind of data populations as well as tests with
33  * data.
34  *
35  * @version $Id: BasicDataFactory.java,v 1.5 2007/01/28 06:54:51 bastafidli Exp $
36  * @author Miro Halas
37  * @code.reviewer Miro Halas
38  * @code.reviewed Initial revision
39  */

40 public interface BasicDataFactory extends DataFactory
41 {
42    /**
43     * Create data object in the persistance store.
44     *
45     * @param data - data to create
46     * @return DataObject - newly created data
47     * @throws OSSException - an error while creating data
48     */

49    DataObject create(
50       DataObject data
51    ) throws OSSException;
52
53    /**
54     * Create collection of data objects.
55     *
56     * @param colDataObject - collection of data objects that will be created
57     * @return int - number of inserted data items
58     * @throws OSSException - error during create
59     */

60    int create(
61       Collection JavaDoc colDataObject
62    ) throws OSSException;
63
64    /**
65     * Delete specified data.
66     *
67     * @param iId - id of the data object to be deleted
68     * @param iDomainId - if the data object exists in a domain then by specifying
69     * the domain id it allows the persistance store to limit
70     * the data that will be searched and also possibly
71     * enforce in what domain the id can possibly exist. This
72     * allows to enforce security on the persistance layer
73     * that by ensuring that if the data object doesn't exist
74     * in the domain where it is expected to exist, it will
75     * not be even deleted. If the data object doesnt exist
76     * in the domain, you can pass DataObject.NEW_ID here
77     * since it won't be used.
78     * @throws OSSException - an error has occured deleting data
79     */

80    void delete(
81       int iId,
82       int iDomainId
83    ) throws OSSException;
84 }
85
Popular Tags