KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opensubsystems > core > persist > db > maxdb > MaxDBDataUtils


1 /*
2  * Copyright (c) 2005 - 2007 OpenSubsystems s.r.o. Slovak Republic. All rights reserved.
3  *
4  * Project: OpenSubsystems
5  *
6  * $Id: MaxDBDataUtils.java,v 1.2 2007/01/07 06:14:38 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.db.maxdb;
23
24 import java.sql.CallableStatement JavaDoc;
25 import java.sql.SQLException JavaDoc;
26
27 import org.opensubsystems.core.data.BasicDataObject;
28 import org.opensubsystems.core.data.ModifiableDataObject;
29 import org.opensubsystems.core.error.OSSException;
30 import org.opensubsystems.core.persist.db.sapdb.SapDBDataUtils;
31
32
33 /**
34  * This class collects code fragments which are reusable for managing data
35  * objects in MaxDB. Since MaxDB is rebranded SAP DB database, at this time it
36  * can reuse majority of the SAP DB functionality.
37  *
38  * @version $Id: MaxDBDataUtils.java,v 1.2 2007/01/07 06:14:38 bastafidli Exp $
39  * @author Miro Halas
40  * @code.reviewer Miro Halas
41  * @code.reviewed Initial revision
42  */

43 public final class MaxDBDataUtils
44 {
45    // Constructors /////////////////////////////////////////////////////////////
46

47    /**
48     * Private constructor since this class cannot be instantiated
49     */

50    private MaxDBDataUtils(
51    )
52    {
53       // Do nothing
54
}
55    
56    // Public methods ///////////////////////////////////////////////////////////
57
/**
58     * Insert the data, fetch from the database id and generated creation and
59     * modification timestamps for the newly created data object.
60     *
61     * Note: Since the caller created the callable statement, the caller is
62     * responsible for its closing.
63     *
64     * @param insertStatement - statement used to insert the data
65     * @param iIndex - index of the ID OUT parameter of the stored procedure
66     * @param data - data object to insert
67     * @throws SQLException - an error has occured
68     * @throws OSSException - an error has occured
69     */

70    public static void insertAndFetchGeneratedValues(
71       CallableStatement JavaDoc insertStatement,
72       int iIndex,
73       BasicDataObject data
74    ) throws SQLException JavaDoc,
75             OSSException
76    {
77       SapDBDataUtils.insertAndFetchGeneratedValues(insertStatement, iIndex, data);
78    }
79
80    /**
81     * Update the data, fetch from the database id and generated modification
82     * timestamps for the newly created data object.
83     *
84     * Note: Since the caller created the callable statement, the caller is
85     * responsible for its closing.
86     *
87     * @param updateStatement - statement used to update the data
88     * @param iIndex - index of the MODIFIED_TIMESTAMP OUT parameter of the
89     * stored procedure
90     * @param data - data object to update
91     * @throws SQLException - an error has occured
92     * @throws OSSException - an error has occured
93     */

94    public static void updateAndFetchGeneratedValues(
95       CallableStatement JavaDoc updateStatement,
96       int iIndex,
97       ModifiableDataObject data
98    ) throws SQLException JavaDoc,
99             OSSException
100    {
101       SapDBDataUtils.updateAndFetchGeneratedValues(updateStatement, iIndex, data);
102    }
103 }
104
Popular Tags