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

net.anotheria.anoprise.dualcrud.DualCrudService Maven / Gradle / Ivy

Go to download

Collection of utils for different enterprise class projects. Among other stuff contains Caches, Mocking, DualCrud, MetaFactory and SessionDistributorService. Visit https://opensource.anotheria.net for details.

There is a newer version: 4.0.0
Show newest version
package net.anotheria.anoprise.dualcrud;

/**
 * This interface defines the dual crud service, a service that allows to work with two persistences in different mods.
 * @author lrosenberg
 *
 * @param 
 */
public interface DualCrudService {
	/**
	 * Creates a new instance.
	 * @param t
	 * @return
	 * @throws CrudServiceException
	 */
	T create(T t) throws CrudServiceException;
	/**
	 * Reads an existing instance.
	 * @param ownerId
	 * @return
	 * @throws CrudServiceException
	 */
	T read(String ownerId) throws CrudServiceException;
	/**
	 * Updates an existing instance.
	 * @param t
	 * @return
	 * @throws CrudServiceException
	 */
	T update(T t) throws CrudServiceException;
	/**
	 * Deletes an existing instance.
	 * @param t
	 * @throws CrudServiceException
	 */
	void delete(T t) throws CrudServiceException;
	/**
	 * Saves an instance. This is similar to exists?update:create.
	 * @param t
	 * @return
	 * @throws CrudServiceException
	 */
	T save(T t) throws CrudServiceException;
	/**
	 * Migrates an instance with given id from one persistence to another along the config.
	 * @param ownerId
	 * @throws CrudServiceException
	 */
	void migrate(String ownerId) throws CrudServiceException;
	/**
	 * Returns true if such an instance exists.
	 * @param t
	 * @return
	 * @throws CrudServiceException
	 */
	boolean exists(T t) throws CrudServiceException;

	/**
	 * Everything else ;-). 
	 * @param q
	 * @return
	 * @throws CrudServiceException
	 */
	QueryResult query(Query q) throws CrudServiceException;

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy