Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package com.avaje.ebean;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.persistence.OptimisticLockException;
import com.avaje.ebean.annotation.CacheStrategy;
import com.avaje.ebean.cache.ServerCacheManager;
import com.avaje.ebean.config.ServerConfig;
import com.avaje.ebean.text.csv.CsvReader;
import com.avaje.ebean.text.json.JsonContext;
/**
* Provides the API for fetching and saving beans to a particular DataSource.
*
* Registration with the Ebean Singleton:
* When a EbeanServer is constructed it can be registered with the Ebean
* singleton (see {@link ServerConfig#setRegister(boolean)}). The Ebean
* singleton is essentially a map of EbeanServer's that have been registered
* with it. The EbeanServer can then be retrieved later via
* {@link Ebean#getServer(String)}.
*
*
* The 'default' EbeanServer
* One EbeanServer can be designated as the 'default' or 'primary' EbeanServer
* (see {@link ServerConfig#setDefaultServer(boolean)}. Many methods on Ebean
* such as {@link Ebean#find(Class)} etc are actually just a convenient way to
* call methods on the 'default/primary' EbeanServer. This is handy for
* applications that use a single DataSource.
*
* There is one EbeanServer per Database (javax.sql.DataSource). One EbeanServer
* is referred to as the 'default' server and that is the one that
* Ebean methods such as {@link Ebean#find(Class)} use.
*
*
* Constructing a EbeanServer
* EbeanServer's are constructed by the EbeanServerFactory. They can be created
* programmatically via {@link EbeanServerFactory#create(ServerConfig)} or they
* can be automatically constructed on demand using configuration information in
* the ebean.properties file.
*
*
* Example: Get a EbeanServer
*
*
*
* // Get access to the Human Resources EbeanServer/Database
* EbeanServer hrServer = Ebean.getServer("HR");
*
*
* // fetch contact 3 from the HR database Contact contact =
* hrServer.find(Contact.class, new Integer(3));
*
* contact.setStatus("INACTIVE"); ...
*
* // save the contact back to the HR database hrServer.save(contact);
*
*
*
* EbeanServer has more API than Ebean
* EbeanServer provides additional API compared with Ebean. For example it
* provides more control over the use of Transactions that is not available in
* the Ebean API.
*
*
* External Transactions: If you wanted to use transactions created
* externally to eBean then EbeanServer provides additional methods where you
* can explicitly pass a transaction (that can be created externally).
*
*
* Bypass ThreadLocal Mechanism: If you want to bypass the built in
* ThreadLocal transaction management you can use the createTransaction()
* method. Example: a single thread requires more than one transaction.
*
*
* @see Ebean
* @see EbeanServerFactory
* @see ServerConfig
*/
public interface EbeanServer {
/**
* Return the AdminLogging which is used to control and configure the
* Transaction logging at runtime.
*/
public AdminLogging getAdminLogging();
/**
* Return the AdminAutofetch which is used to control and configure the
* Autofetch service at runtime.
*/
public AdminAutofetch getAdminAutofetch();
/**
* Return the name. This is used with {@link Ebean#getServer(String)} to get a
* EbeanServer that was registered with the Ebean singleton.
*/
public String getName();
/**
* Return the ExpressionFactory for this server.
*/
public ExpressionFactory getExpressionFactory();
/**
* Return the BeanState for a given entity bean.
*
* This will return null if the bean is not an enhanced (or subclassed) entity
* bean.
*
*/
public BeanState getBeanState(Object bean);
/**
* Return the value of the Id property for a given bean.
*/
public Object getBeanId(Object bean);
/**
* Return a map of the differences between two objects of the same type.
*
* When null is passed in for b, then the 'OldValues' of a is used for the
* difference comparison.
*
*/
public Map diff(Object a, Object b);
/**
* Validate an entity bean.
*
* The returned InvalidValue holds a tree of InvalidValue's. Typically you
* will use {@link InvalidValue#getErrors()}) to get a flat list of all the
* validation errors.
*
*/
public InvalidValue validate(Object bean);
/**
* Validate a single property on an entity bean.
*
* @param bean
* the entity bean that owns the property.
* @param propertyName
* the name of the property to validate.
* @param value
* if the value is null then the value from the bean is used to
* perform the validation.
* @return the validation errors or an empty array.
*/
public InvalidValue[] validate(Object bean, String propertyName, Object value);
/**
* Create a new instance of T that is an EntityBean (for subclassing).
*
* Note that if you are using enhancement (rather than subclassing) then you
* do not need to use this method and just new up a bean.
*
*
* Potentially useful when using subclassing and you wish to programmatically
* load a entity bean . Otherwise this method is generally not required.
*
*/
public T createEntityBean(Class type);
/**
* Create a ObjectInputStream that can be used to deserialise "Proxy" or
* "SubClassed" entity beans.
*
* This is NOT required when entity beans are "Enhanced" (via java agent or
* ant task etc).
*
*
* The reason this is needed to deserialise "Proxy" beans is because Ebean
* creates the "Proxy/SubClass" classes in a class loader - and generally the
* class loader deserialising the inputStream is not aware of these other
* classes.
*
*/
public ObjectInputStream createProxyObjectInputStream(InputStream is);
/**
* Create a CsvReader for a given beanType.
*/
public CsvReader createCsvReader(Class beanType);
/**
* Create a named query for an entity bean (refer
* {@link Ebean#createQuery(Class, String)})
*
* The query statement will be defined in a deployment orm xml file.
*
*
* @see Ebean#createQuery(Class, String)
*/
public Query createNamedQuery(Class beanType, String namedQuery);
/**
* Create a query using the query language.
*
* Note that you are allowed to add additional clauses using where() as well
* as use fetch() and setOrderBy() after the query has been created.
*
*
* Note that this method signature used to map to named queries and that has
* moved to {@link #createNamedQuery(Class, String)}.
*
*
* @param query
* the object query
*/
public Query createQuery(Class beanType, String query);
/**
* Create a query for an entity bean (refer {@link Ebean#createQuery(Class)}
* ).
*
* @see Ebean#createQuery(Class)
*/
public Query createQuery(Class beanType);
/**
* Create a query for a type of entity bean (the same as
* {@link EbeanServer#createQuery(Class)}).
*/
public Query find(Class beanType);
/**
* Return the next unique identity value for a given bean type.
*
* This will only work when a IdGenerator is on the bean such as for beans
* that use a DB sequence or UUID.
*
*
* For DB's supporting getGeneratedKeys and sequences such as Oracle10 you do
* not need to use this method generally. It is made available for more
* complex cases where it is useful to get an ID prior to some processing.
*
*/
public Object nextId(Class> beanType);
/**
* Create a filter for filtering lists of entity beans.
*/
public Filter filter(Class beanType);
/**
* Sort the list using the sortByClause.
*
* @see Ebean#sort(List, String)
*
* @param list
* the list of entity beans
* @param sortByClause
* the properties to sort the list by
*/
public void sort(List list, String sortByClause);
/**
* Create a named update for an entity bean (refer
* {@link Ebean#createNamedUpdate(Class, String)}).
*/
public Update createNamedUpdate(Class beanType, String namedUpdate);
/**
* Create a update for an entity bean where you will manually specify the
* insert update or delete statement.
*/
public Update createUpdate(Class beanType, String ormUpdate);
/**
* Create a sql query for executing native sql query statements (refer
* {@link Ebean#createSqlQuery(String)}).
*
* @see Ebean#createSqlQuery(String)
*/
public SqlQuery createSqlQuery(String sql);
/**
* Create a named sql query (refer {@link Ebean#createNamedSqlQuery(String)}
* ).
*
* The query statement will be defined in a deployment orm xml file.
*
*
* @see Ebean#createNamedSqlQuery(String)
*/
public SqlQuery createNamedSqlQuery(String namedQuery);
/**
* Create a sql update for executing native dml statements (refer
* {@link Ebean#createSqlUpdate(String)}).
*
* @see Ebean#createSqlUpdate(String)
*/
public SqlUpdate createSqlUpdate(String sql);
/**
* Create a CallableSql to execute a given stored procedure.
*/
public CallableSql createCallableSql(String callableSql);
/**
* Create a named sql update (refer {@link Ebean#createNamedSqlUpdate(String)}
* ).
*
* The statement (an Insert Update or Delete statement) will be defined in a
* deployment orm xml file.
*
*
* @see Ebean#createNamedSqlUpdate(String)
*/
public SqlUpdate createNamedSqlUpdate(String namedQuery);
/**
* Create a new transaction that is not held in TransactionThreadLocal.
*
* You will want to do this if you want multiple Transactions in a single
* thread or generally use transactions outside of the TransactionThreadLocal
* management.
*
*/
public Transaction createTransaction();
/**
* Create a new transaction additionally specifying the isolation level.
*
* Note that this transaction is NOT stored in a thread local.
*
*/
public Transaction createTransaction(TxIsolation isolation);
/**
* Start a new transaction putting it into a ThreadLocal.
*
* @see Ebean#beginTransaction()
*/
public Transaction beginTransaction();
/**
* Start a transaction additionally specifying the isolation level.
*/
public Transaction beginTransaction(TxIsolation isolation);
/**
* Returns the current transaction or null if there is no current transaction
* in scope.
*/
public Transaction currentTransaction();
/**
* Commit the current transaction.
*
* @see Ebean#commitTransaction()
*/
public void commitTransaction();
/**
* Rollback the current transaction.
*
* @see Ebean#rollbackTransaction()
*/
public void rollbackTransaction();
/**
* If the current transaction has already been committed do nothing otherwise
* rollback the transaction.
*
* Useful to put in a finally block to ensure the transaction is ended, rather
* than a rollbackTransaction() in each catch block.
*
*
* Code example:
*
*
* Ebean.startTransaction(); try { // do some fetching
* and or persisting
*
* // commit at the end Ebean.commitTransaction();
*
* } finally { // if commit didn't occur then rollback the transaction
* Ebean.endTransaction(); }
*
*
*
*
* @see Ebean#endTransaction()
*/
public void endTransaction();
/**
* Log a comment to the transaction log of the current transaction.
*
* If there is no current transaction this comment does not go anywhere.
*
*
* @see Ebean#logComment(String)
*/
public void logComment(String msg);
/**
* Refresh the values of a bean.
*
* Note that this does not refresh any OneToMany or ManyToMany properties.
*
*
* @see Ebean#refresh(Object)
*/
public void refresh(Object bean);
/**
* Refresh a many property of an entity bean.
*
* @param bean
* the entity bean containing the 'many' property
* @param propertyName
* the 'many' property to be refreshed
*
* @see Ebean#refreshMany(Object, String)
*/
public void refreshMany(Object bean, String propertyName);
/**
* Find a bean using its unique id.
*
* @see Ebean#find(Class, Object)
*/
public T find(Class beanType, Object uid);
/**
* Get a reference Object (see {@link Ebean#getReference(Class, Object)}.
*
* This will not perform a query against the database.
*
*
* @see Ebean#getReference(Class, Object)
*/
public T getReference(Class beanType, Object uid);
/**
* Return the number of 'top level' or 'root' entities this query should
* return.
*/
public int findRowCount(Query query, Transaction transaction);
/**
* Return the Id values of the query as a List.
*/
public List