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

br.com.anteros.nosql.persistence.mongodb.session.MongoSession Maven / Gradle / Ivy

There is a newer version: 1.0.6
Show newest version
package br.com.anteros.nosql.persistence.mongodb.session;

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

import org.bson.Document;

import com.mongodb.ReadPreference;
import com.mongodb.WriteConcern;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;

import br.com.anteros.nosql.persistence.client.NoSQLConnection;
import br.com.anteros.nosql.persistence.converters.Key;
import br.com.anteros.nosql.persistence.dialect.NoSQLDialect;
import br.com.anteros.nosql.persistence.metadata.NoSQLDescriptionEntityManager;
import br.com.anteros.nosql.persistence.mongodb.aggregation.AggregationPipeline;
import br.com.anteros.nosql.persistence.session.FindAndModifyOptions;
import br.com.anteros.nosql.persistence.session.FindAndReplaceOptions;
import br.com.anteros.nosql.persistence.session.NoSQLPersistenceContext;
import br.com.anteros.nosql.persistence.session.NoSQLResult;
import br.com.anteros.nosql.persistence.session.NoSQLSession;
import br.com.anteros.nosql.persistence.session.NoSQLSessionFactory;
import br.com.anteros.nosql.persistence.session.NoSQLSessionListener;
import br.com.anteros.nosql.persistence.session.event.NoSQLEventPublisher;
import br.com.anteros.nosql.persistence.session.mapping.AbstractNoSQLObjectMapper;
import br.com.anteros.nosql.persistence.session.query.NoSQLCriteria;
import br.com.anteros.nosql.persistence.session.query.NoSQLQuery;
import br.com.anteros.nosql.persistence.session.query.NoSQLUpdate;
import br.com.anteros.nosql.persistence.session.transaction.NoSQLTransaction;

public interface MongoSession extends NoSQLSession{

	String UNDERSCORE_ID = "_id";
	String UNDERSCORE_ID_REF = "$_id";

	void flush() throws Exception;

	void forceFlush(Set collectionNames) throws Exception;

	void onBeforeExecuteCommit(NoSQLConnection connection) throws Exception;

	void onBeforeExecuteRollback(NoSQLConnection connection) throws Exception;

	void onAfterExecuteCommit(NoSQLConnection connection) throws Exception;

	void onAfterExecuteRollback(NoSQLConnection connection) throws Exception;

	NoSQLDescriptionEntityManager getDescriptionEntityManager();

	NoSQLDialect getDialect();

	NoSQLConnection getConnection();

	NoSQLPersistenceContext getPersistenceContext();

	void addListener(NoSQLSessionListener listener);

	void removeListener(NoSQLSessionListener listener);

	List getListeners();

	void setFormatCommands(boolean format);

	boolean isShowCommands();

	boolean isFormatCommands();

	MongoDatabase getDatabase();

	MongoDatabase getDatabase(String dbName);

	void dropCollection(String collectionName);

	boolean isProxyObject(Object object) throws Exception;

	boolean proxyIsInitialized(Object object) throws Exception;

	 T cloneEntityManaged(Object object) throws Exception;

	void evict(Class object);

	void evictAll();

	boolean isClosed() throws Exception;

	NoSQLTransaction getTransaction();

	NoSQLSessionFactory getNoSQLSessionFactory();

	void clear() throws Exception;

	boolean validationIsActive();

	void activateValidation();

	void deactivateValidation();

	void close() throws Exception;

	 Object getIdentifier(T owner) throws Exception;

	 boolean collectionExists(Class entityClass);

	boolean collectionExists(String collectionName);

	AggregationPipeline createAggregation(Class source);

	AggregationPipeline createAggregation(String collection, Class clazz);

	 long count(NoSQLQuery query, Class entityClass);

	 long count(NoSQLQuery query, Class entityClass, String collectionName);

	 long count(NoSQLQuery query, String collectionName);

	 MongoCollection createCollection(Class entityClass) throws Exception;

	MongoCollection createCollection(String collectionName) throws Exception;

	 void dropCollection(Class entityClass);

	 T execute(Class entityClass, CollectionCallback callback) throws Exception;

	 T execute(DbCallback action);

	 T execute(String collectionName, CollectionCallback callback);

	Document executeCommand(Document command) throws Exception;

	Document executeCommand(Document command, ReadPreference readPreference) throws Exception;

	Document executeCommand(String jsonCommand) throws Exception;

	void executeQuery(NoSQLQuery query, String collectionName, DocumentCallbackHandler dch) throws Exception;

	 boolean exists(NoSQLQuery query, Class entityClass);

	 boolean exists(NoSQLQuery query, Class entityClass, String collectionName);

	 boolean exists(NoSQLQuery query, String collectionName);

	 List find(NoSQLQuery query, Class entityClass);

	 List find(NoSQLQuery query, Class entityClass, String collectionName);

	 List findAll(Class entityClass);

	 List findAll(Class entityClass, String collectionName);

	 List findAllAndRemove(NoSQLQuery query, Class entityClass);

	 List findAllAndRemove(NoSQLQuery query, Class entityClass, String collectionName);

	 List findAllAndRemove(NoSQLQuery query, String collectionName);

	 T findAndModify(NoSQLQuery query, NoSQLUpdate update, Class entityClass);

	 T findAndModify(NoSQLQuery query, NoSQLUpdate update, Class entityClass,
			String collectionName);

	 T findAndModify(NoSQLQuery query, NoSQLUpdate update, FindAndModifyOptions options,
			Class entityClass);

	 T findAndModify(NoSQLQuery query, NoSQLUpdate update, FindAndModifyOptions options,
			Class entityClass, String collectionName);

	 T findAndReplace(NoSQLQuery query, S replacement, FindAndReplaceOptions options,
			Class entityType, String collectionName, Class resultType);

	 T findAndRemove(NoSQLQuery query, Class entityClass);

	 T findAndRemove(NoSQLQuery query, Class entityClass, String collectionName);

	 T findById(Object id, Class entityClass);

	 T findById(Object id, Class entityClass, String collectionName);

	 T findOne(NoSQLQuery query, Class entityClass);

	 T findOne(NoSQLQuery query, Class entityClass, String collectionName);

	String getCollectionName(Class entityClass);

	String getCollectionName(Object entity);

	Set getCollectionNames();

	 GroupByResults group(NoSQLCriteria criteria, String inputCollectionName, GroupBy groupBy,
			Class entityClass) throws Exception;

	 GroupByResults group(String inputCollectionName, GroupBy groupBy, Class entityClass) throws Exception;

	 Collection insert(Collection batchToSave, Class entityClass) throws Exception;

	 Collection insert(Collection batchToSave, String collectionName) throws Exception;

	 T insert(T objectToSave) throws Exception;

	 T insert(T objectToSave, String collectionName) throws Exception;

	 Collection insertAll(Collection objectsToSave) throws Exception;

	 MapReduceResults mapReduce(String inputCollectionName, String mapFunction, String reduceFunction,
			Class entityClass);

	 MapReduceResults mapReduce(String inputCollectionName, String mapFunction, String reduceFunction,
			MapReduceOptions mapReduceOptions, Class entityClass);

	 MapReduceResults mapReduce(NoSQLQuery query, String inputCollectionName, String mapFunction,
			String reduceFunction, Class entityClass);

	 MapReduceResults mapReduce(NoSQLQuery query, String inputCollectionName, String mapFunction,
			String reduceFunction, MapReduceOptions mapReduceOptions, Class entityClass);

	 List mapReduce(NoSQLQuery query, Class domainType, String inputCollectionName,
			String mapFunction, String reduceFunction, MapReduceOptions mapReduceOptions, Class resultType);

	NoSQLResult remove(Object object);

	NoSQLResult remove(Object object, String collectionName) throws Exception;

	 NoSQLResult remove(NoSQLQuery query, Class entityClass);

	 NoSQLResult remove(NoSQLQuery query, Class entityClass, String collectionName);

	 NoSQLResult remove(NoSQLQuery query, String collectionName);

	MongoCollection getCollection(String collectionName);

	MongoCollection getCollection(Class entityClass);

	 T save(T objectToSave);

	 T save(T entity, String collectionName);

	 NoSQLResult updateFirst(NoSQLQuery query, NoSQLUpdate update, Class entityClass)
			throws Exception;

	 NoSQLResult updateFirst(NoSQLQuery query, NoSQLUpdate update, Class entityClass,
			String collectionName) throws Exception;

	 NoSQLResult updateFirst(NoSQLQuery query, NoSQLUpdate update, String collectionName)
			throws Exception;

	 NoSQLResult updateMulti(NoSQLQuery query, NoSQLUpdate update, Class entityClass)
			throws Exception;

	 NoSQLResult updateMulti(NoSQLQuery query, NoSQLUpdate update, Class entityClass,
			String collectionName) throws Exception;

	 NoSQLResult updateMulti(NoSQLQuery query, NoSQLUpdate update, String collectionName)
			throws Exception;

	 NoSQLResult upsert(NoSQLQuery query, NoSQLUpdate update, Class entityClass)
			throws Exception;

	 NoSQLResult upsert(NoSQLQuery query, NoSQLUpdate update, Class entityClass,
			String collectionName) throws Exception;

	 NoSQLResult upsert(NoSQLQuery query, NoSQLUpdate update, String collectionName)
			throws Exception;

	 Key getKey(T entity);

	AbstractNoSQLObjectMapper mapper();

	WriteConcern getDefaultWriteConcern();

	void setEventPublisher(NoSQLEventPublisher eventPublisher);

	void commitTransaction();

	void startTransaction();

	void abortTransaction();

	 long count(Class entityClass);
	
	public boolean isWithoutTransactionControl();

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy