/*
 Copyright (c) 2006 - 2007 Eric J. Feminella  <eric@ericfeminella.com>
 All rights reserved.

 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 in the Software without restriction, including without limitation the rights
 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 copies of the Software, and to permit persons to whom the Software is furnished
 to do so, subject to the following conditions:

 The above copyright notice and this permission notice shall be included in all
 copies or substantial portions of the Software.

 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
 INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
 PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

 @internal
 */

package com.ericfeminella.rpc
{
    /**
     * 
     * Defines a Generic DAO client-side CRUD implementation which
     * has been adapted from a Java typesafe AOP DAO.
     *
     * <p>
     * DAO pattern Implementations vary considerably, users can choose
     * to implement IDAO to provide a generic DAO implementation for
     * maximum flexibility
     * </p>
     *
     * <p>
     * Each DAO instance is responsible for one primary domain object
     * or entity.
     * </p>
     *
     * <p>
     * The DAO is responsible for performing CRUD on a domain object:
     *   <ul>
     *      <li>Create  INSERT</li>
     *      <li>Read    SELECT</li>
     *      <li>Update  UPDATE</li>
     *      <li>Delete  DELETE</li>
     *   </ul>
     * </p>
     *
     * <p>
     * The DAO may allow queries based on criteria as oppossed to just a
     * primary key. These are referd to as finder methods or finders.
     * </p>
     *
     */
    public interface IDAO
    {
        /**
         * 
         * Persists a new object instance into a database
         * 
         * @param the object in which to persist
         * 
         */
        function create(obj:*) : void

        /**
         * 
         * Retrieves a previously persisted object using the specified
         * id as primary key.
         *
         * <p>
         * If storage is persisted as in-memory only, calls to IDAO.read();
         * should return an object specific to the domain. If storage is
         * persisted remotely, calls to IDAO.read(); should return null.
         * The pending RPC call should handle returning the domain object
         * via mx.rpc.IResponder
         * </p>
         *
         * @param  the id to be used as the primary key
         * 
         */
        function read(id:*) : void

        /**
         * 
         * Saves changes made to a previously persistent object
         *
         * @param an updated persisted object
         * 
         */
        function update(obj:*) : void

        /**
         * 
         * Removes an object from persistent storage in a database
         *
         * @param the id to be used as the primary key
         * 
         */
        function Delete(id:*) : void
    }
}