All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.nkasenides.athlos.persistence.MultiDAO Maven / Gradle / Ivy

There is a newer version: 0.1.3
Show newest version
package com.nkasenides.athlos.persistence;

import java.util.Collection;
import java.util.List;

/**
 * Defines a Data Access Object pattern for use in DB transactions.
 * @param  The type of object being accessed.
 */
public interface MultiDAO extends DAO {

    /**
     * Retrieves an item based on its ID.
     * @param id The ID of the item to retrieve.
     * @return Returns a single object.
     */
    T get(String id);

    /**
     * Retrieves many items based on their IDs.
     * @param ids An array of string-based IDs.
     * @return Returns a List of objects.
     */
    Collection getMany(String... ids);

    /**
     * Retrieves all of the items of a particular type.
     * @return Returns a collection of objects.
     */
    Collection list();

    /**
     * Creates all of the given items in the database.
     * @param objects An array of items to create.
     * @return Returns true if the operation was successful, false otherwise.
     */
    boolean create(Collection objects);

    /**
     * Updates all of the given items in the database.
     * @param objects An array of items to update.
     * @return Returns true if the operation was successful, false otherwise.
     */
    boolean update(Collection objects);

    /**
     * Deletes all of the given items from the database.
     * @param objects An array of items to delete.
     * @return Returns true if the operation was successful, false otherwise.
     */
    boolean delete(Collection objects);

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy