/**
 * Copyright 2010 OpenEngSB Division, Vienna University of Technology
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.openengsb.core.persistence;

import java.util.List;
import java.util.Map;

public interface PersistenceService {

    <T> List<T> query(T example);

    <T> List<T> query(List<T> examples);

    void create(Object bean) throws PersistenceException;

    void create(List<? extends Object> beans) throws PersistenceException;

    <T> void update(T oldBean, T newBean) throws PersistenceException;

    <T> void update(Map<T, T> beans) throws PersistenceException;

    <T> void delete(T example) throws PersistenceException;

    <T> void delete(List<? extends T> examples) throws PersistenceException;

}

@@ -719,458 +719,2980 @@
 p;%0A%0A
-public interface PersistenceService %7B%0A%0A    %3CT%3E List%3CT%3E query(T example);%0A%0A    %3CT%3E List%3CT%3E query(List%3CT%3E examples);%0A%0A    void create(Object bean) throws PersistenceException;%0A%0A    void create(List%3C? extends Object%3E beans) throws PersistenceException;%0A%0A    %3CT%3E void update(T oldBean, T newBean) throws PersistenceException;%0A%0A    %3CT%3E void update(Map%3CT, T%3E beans) throws PersistenceException;%0A%0A    %3CT%3E void delete(T example) throws PersistenceException;%0A
+/**%0A * %0A * The interface of the common persistence solution of the OpenEngSB. This service is meant to be used by domains and%0A * other components of the OpenEngSB to store their data.%0A */%0Apublic interface PersistenceService %7B%0A%0A    /**%0A     * Query for elements based on a given example element. Null field values are used as wildcards and will match with%0A     * any value.%0A     */%0A    %3CT%3E List%3CT%3E query(T example);%0A%0A    /**%0A     * Query for elements based on a list of example elements. This method returns the results of queries for the%0A     * examples contained in the example list accumulated in one result list.%0A     */%0A    %3CT%3E List%3CT%3E query(List%3CT%3E examples);%0A%0A    /**%0A     * Store the given element in the database. Multiple calls with the same element do not fail, but simply stores the%0A     * element twice independently. Be careful when storing object with references to other objects, as these referenced%0A     * objects are also stored in the database.%0A     * %0A     * @throws PersistenceException if the element could not be stored because of an error of the underlying database%0A     *         system.%0A     */%0A    void create(Object bean) throws PersistenceException;%0A%0A    /**%0A     * Store the given list of elements. Behaves like multiple calls to %7B@link #create(Object)%7D, except for objects with%0A     * references to other objects in the list of objects to create. These are handled correctly storing the respective%0A     * element only once.%0A     * %0A     * @throws PersistenceException if the element could not be stored because of an error of the underlying database%0A     *         system.%0A     */%0A    void create(List%3C? extends Object%3E beans) throws PersistenceException;%0A%0A    /**%0A     * Update %7B@code oldBean%7D stored in the database with the values from %7B@code newBean%7D.%0A     * %0A     * @throws PersistenceException if a query using %7B@code oldBean%7D does not return exactly one element stored in the%0A     *         database.%0A     */%0A    %3CT%3E void update(T oldBean, T newBean) throws PersistenceException;%0A%0A    /**%0A     * Update the keys of the given map stored in the database with the values of the given map. Has transactional%0A     * behavior, so if one of the update operations fails no update is performed.%0A     * %0A     * @throws PersistenceException if a query using the key element in the map does not return exactly one element%0A     *         stored in the database.%0A     */%0A    %3CT%3E void update(Map%3CT, T%3E beans) throws PersistenceException;%0A%0A    /**%0A     * %0A     * Delete all elements which are returned by a query using the given %7B@code example%7D object.%0A     * %0A     * @throws PersistenceException if no element can be found for the given query by example object%0A     */%0A    %3CT%3E void delete(T example) throws PersistenceException;%0A%0A    /**%0A     * %0A     * Delete all elements which are returned by a query using the given list of %7B@code examples%7D.%0A     * %0A     * @throws PersistenceException if the underlying database system throws an exception%0A     */
 %0A   

Add comments for public persistence interface.