Clover coverage report - JFox Service-Oriented Application Framework - 1.0
Coverage timestamp: 星期一 八月 21 2006 22:56:01 CST
file stats: LOC: 239   Methods: 0
NCLOC: 37   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
IbatisService.java - - - -
coverage
 1   
 /**
 2   
  * @(#)IbatisService.java
 3   
  * 
 4   
  * JFoxSOAF, Service-Oriented Application Framework
 5   
  * 
 6   
  * Copyright(c) JFoxSOAF Team
 7   
  * 
 8   
  * Licensed under the GNU LGPL, Version 2.1 (the "License"); 
 9   
  * you may not use this file except in compliance with the License. 
 10   
  * You may obtain a copy of the License at  
 11   
  * 
 12   
  * http://www.gnu.org/copyleft/lesser.html
 13   
  * 
 14   
  * Unless required by applicable law or agreed to in writing, software
 15   
  * distributed under the License is distributed on an "AS IS" BASIS, 
 16   
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
 17   
  * See the License for the specific language governing permissions and 
 18   
  * limitations under the License. 
 19   
  * 
 20   
  * For more information, please visit:
 21   
  * http://www.jfox.cn/confluence/display/JFoxSOAF/Home
 22   
  * http://www.huihoo.org/jfox/jfoxsoaf
 23   
  */
 24   
 
 25   
 package org.huihoo.jfox.soaf.services.persistence;
 26   
 
 27   
 import java.sql.SQLException;
 28   
 import java.util.List;
 29   
 import java.util.Map;
 30   
 
 31   
 import org.huihoo.jfox.soaf.exception.DAOException;
 32   
 
 33   
 import com.ibatis.common.util.PaginatedList;
 34   
 import com.ibatis.dao.client.DaoManager;
 35   
 import com.ibatis.sqlmap.client.SqlMapException;
 36   
 import com.ibatis.sqlmap.client.SqlMapSession;
 37   
 import com.ibatis.sqlmap.client.event.RowHandler;
 38   
 
 39   
 /**
 40   
  * <p>
 41   
  * Ibatis persistence service wrapper.
 42   
  * </p>
 43   
  * 
 44   
  * @author <a href="mailto:founder_chen@yahoo.com.cn">Peter Cheng </a>
 45   
  * @version $Revision: 1.7 $ $Date: 2006/02/15 08:45:45 $
 46   
  * @version Revision: 1.0
 47   
  */
 48   
 
 49   
 public interface IbatisService {
 50   
 
 51   
     /**
 52   
      * Get DaoManager.
 53   
      * 
 54   
      * @return
 55   
      * @throws SqlMapException
 56   
      */
 57   
     DaoManager getDaoManager() throws SqlMapException;
 58   
 
 59   
     /**
 60   
      * Returns a single threaded SqlMapSession implementation for use by one
 61   
      * user.
 62   
      * 
 63   
      * @see org.huihoo.jfox.soaf.services.persistence.IbatisService#openSession()
 64   
      */
 65   
     SqlMapSession openSession() throws SQLException;
 66   
 
 67   
     /**
 68   
      * Commits the currently started transaction.
 69   
      * 
 70   
      * @throws SQLException
 71   
      */
 72   
     void commit() throws SQLException;
 73   
 
 74   
     /**
 75   
      * Close session.
 76   
      */
 77   
     void closeSession() throws SQLException;
 78   
 
 79   
     /**
 80   
      * Executes a mapped SQL INSERT statement. Insert is a bit different from
 81   
      * other update methods, as it provides facilities for returning the primary
 82   
      * key of the newly inserted row (rather than the effected rows). This
 83   
      * functionality is of course optional.
 84   
      * 
 85   
      * @param id
 86   
      * @param parameterObject
 87   
      * @return The primary key of the newly inserted row. This might be
 88   
      *         automatically generated by the RDBMS, or selected from a sequence
 89   
      *         table or other source.
 90   
      * @throws SQLException
 91   
      * @throws DAOException
 92   
      */
 93   
     Object insert(String id, Object parameterObject) throws SQLException,
 94   
             DAOException;
 95   
 
 96   
     /**
 97   
      * Executes a mapped SQL UPDATE statement. Update can also be used for any
 98   
      * other update statement type, such as inserts and deletes. Update returns
 99   
      * the number of rows effected.
 100   
      * 
 101   
      * @param id
 102   
      * @param parameterObject
 103   
      * @return The number of rows effected.
 104   
      * @throws SQLException
 105   
      * @throws DAOException
 106   
      */
 107   
     int update(String id, Object parameterObject) throws SQLException,
 108   
             DAOException;
 109   
 
 110   
     /**
 111   
      * Executes a mapped SQL DELETE statement. Delete returns the number of rows
 112   
      * effected.
 113   
      * 
 114   
      * @param id
 115   
      * @param parameterObject
 116   
      * @return The number of rows effected
 117   
      * @throws SQLException
 118   
      * @throws DAOException
 119   
      */
 120   
     int delete(String id, Object parameterObject) throws SQLException,
 121   
             DAOException;
 122   
 
 123   
     /**
 124   
      * Executes a mapped SQL SELECT statement that returns data to populate a
 125   
      * single object instance. <p/>The parameter object is generally used to
 126   
      * supply the input data for the WHERE clause parameter(s) of the SELECT
 127   
      * statement.
 128   
      * 
 129   
      * @param id
 130   
      *            The name of the statement to execute.
 131   
      * @param parameterObject
 132   
      *            The parameter object (e.g. JavaBean, Map, XML etc.).
 133   
      * @return The single result object populated with the result set data.
 134   
      */
 135   
     Object queryForObject(String id, Object parameterObject)
 136   
             throws SQLException, DAOException;
 137   
 
 138   
     /**
 139   
      * Executes a mapped SQL SELECT statement that returns data to populate the
 140   
      * supplied result object.
 141   
      * 
 142   
      * @param id
 143   
      * @param parameterObject
 144   
      * @param resultObject
 145   
      * @return The single result object as supplied by the resultObject
 146   
      *         parameter, populated with the result set data.
 147   
      * @throws SQLException
 148   
      * @throws DAOException
 149   
      */
 150   
     Object queryForObject(String id, Object parameterObject, Object resultObject)
 151   
             throws SQLException, DAOException;
 152   
 
 153   
     /**
 154   
      * Executes a mapped SQL SELECT statement that returns data to populate a
 155   
      * number of result objects.
 156   
      * 
 157   
      * @param id
 158   
      * @param parameterObject
 159   
      * @return A List of result objects.
 160   
      * @throws SQLException
 161   
      * @throws DAOException
 162   
      */
 163   
     List queryForList(String id, Object parameterObject) throws SQLException,
 164   
             DAOException;
 165   
 
 166   
     /**
 167   
      * Executes a mapped SQL SELECT statement that returns data to populate a
 168   
      * number of result objects within a certain range.
 169   
      * 
 170   
      * @param id
 171   
      * @param parameterObject
 172   
      * @param skip
 173   
      * @param max
 174   
      * @return A List of result objects.
 175   
      * @throws SQLException
 176   
      * @throws DAOException
 177   
      */
 178   
     List queryForList(String id, Object parameterObject, int skip, int max)
 179   
             throws SQLException, DAOException;
 180   
 
 181   
     /**
 182   
      * Executes a mapped SQL SELECT statement that returns a number of result
 183   
      * objects that will be handled one at a time by a RowHandler.
 184   
      * 
 185   
      * @param id
 186   
      * @param parameterObject
 187   
      * @param rowHandler
 188   
      * @throws SQLException
 189   
      * @throws DAOException
 190   
      */
 191   
     void queryWithRowHandler(String id, Object parameterObject,
 192   
             RowHandler rowHandler) throws SQLException, DAOException;
 193   
 
 194   
     /**
 195   
      * Executes a mapped SQL SELECT statement that returns data to populate a
 196   
      * number of result objects a page at a time.
 197   
      * 
 198   
      * @param id
 199   
      * @param parameterObject
 200   
      * @param pageSize
 201   
      * @return A PaginatedList of result objects.
 202   
      * @throws SQLException
 203   
      * @throws DAOException
 204   
      */
 205   
     PaginatedList queryForPaginatedList(String id, Object parameterObject,
 206   
             int pageSize) throws SQLException, DAOException;
 207   
 
 208   
     /**
 209   
      * Executes a mapped SQL SELECT statement that returns data to populate a
 210   
      * number of result objects that will be keyed into a Map.
 211   
      * 
 212   
      * @param id
 213   
      * @param parameterObject
 214   
      * @param keyProp
 215   
      * @return A Map keyed by keyProp with values being the result object
 216   
      *         instance.
 217   
      * @throws SQLException
 218   
      * @throws DAOException
 219   
      */
 220   
     Map queryForMap(String id, Object parameterObject, String keyProp)
 221   
             throws SQLException, DAOException;
 222   
 
 223   
     /**
 224   
      * Executes a mapped SQL SELECT statement that returns data to populate a
 225   
      * number of result objects from which one property will be keyed into a
 226   
      * Map.
 227   
      * 
 228   
      * @param id
 229   
      * @param parameterObject
 230   
      * @param keyProp
 231   
      * @param valueProp
 232   
      * @return A Map keyed by keyProp with values of valueProp.
 233   
      * @throws SQLException
 234   
      * @throws DAOException
 235   
      */
 236   
     Map queryForMap(String id, Object parameterObject, String keyProp,
 237   
             String valueProp) throws SQLException, DAOException;
 238   
 
 239   
 }