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

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

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

import br.com.anteros.nosql.persistence.mongodb.query.MongoCriteria;
import br.com.anteros.nosql.persistence.mongodb.query.MongoQuery;
import br.com.anteros.nosql.persistence.mongodb.query.rsql.visitor.ComparisonToCriteriaConverter;
import br.com.anteros.nosql.persistence.mongodb.query.rsql.visitor.RsqlMongoAdapter;
import br.com.anteros.nosql.persistence.mongodb.session.repository.MongoSimpleRepository;
import br.com.anteros.nosql.persistence.session.NoSQLSessionFactory;
import br.com.anteros.nosql.persistence.session.query.NoSQLQuery;
import br.com.anteros.nosql.persistence.session.query.Page;
import br.com.anteros.nosql.persistence.session.query.Pageable;
import br.com.anteros.nosql.persistence.session.repository.NoSQLRepository;
import br.com.anteros.nosql.persistence.session.service.AbstractSimpleService;

public class MongoSimpleService extends AbstractSimpleService {
	private Class entityClass;

	public MongoSimpleService(NoSQLSessionFactory sessionFactory) {
		super(sessionFactory);
	}

	public MongoSimpleService() {

	}

	@Override
	protected NoSQLRepository doGetDefaultRepository(NoSQLSessionFactory sessionFactory, Class entityClass) {
		this.entityClass = entityClass;
		return new MongoSimpleRepository(sessionFactory, entityClass);
	}

	@Override
	public NoSQLQuery parseRsql(String rsql) {
		RsqlMongoAdapter adapter = new RsqlMongoAdapter(new ComparisonToCriteriaConverter());
		MongoCriteria criteria = (MongoCriteria) adapter.getCriteria(rsql, entityClass);
		return MongoQuery.of(criteria);
	}


	

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy