use of org.eclipse.jnosql.mapping.graph.GraphTemplate in project jnosql-diana by eclipse.
the class RepositoryGraphBean method create.
@Override
public Repository create(CreationalContext<Repository> creationalContext) {
ClassMappings classMappings = getInstance(ClassMappings.class);
GraphTemplate repository = provider.isEmpty() ? getInstance(GraphTemplate.class) : getInstance(GraphTemplate.class, DatabaseQualifier.ofGraph(provider));
GraphConverter converter = getInstance(GraphConverter.class);
Graph graph = provider.isEmpty() ? getInstance(Graph.class) : getInstance(Graph.class, DatabaseQualifier.ofGraph(provider));
Converters converters = getInstance(Converters.class);
GraphRepositoryProxy handler = new GraphRepositoryProxy(repository, classMappings, type, graph, converter, converters);
return (Repository) Proxy.newProxyInstance(type.getClassLoader(), new Class[] { type }, handler);
}
use of org.eclipse.jnosql.mapping.graph.GraphTemplate in project jnosql-diana by eclipse.
the class DefaultGraphRepositoryProducer method get.
@Override
public <T, K, R extends Repository<T, K>> R get(Class<R> repositoryClass, Graph manager) {
Objects.requireNonNull(repositoryClass, "repository class is required");
Objects.requireNonNull(manager, "manager class is required");
GraphTemplate template = producer.get(manager);
GraphRepositoryProxy<R, K> handler = new GraphRepositoryProxy(template, classMappings, repositoryClass, manager, converter, converters);
return (R) Proxy.newProxyInstance(repositoryClass.getClassLoader(), new Class[] { repositoryClass }, handler);
}
use of org.eclipse.jnosql.mapping.graph.GraphTemplate in project jnosql-diana by eclipse.
the class GraphTemplateConverterTest method shouldReturnTemplate.
@Test
public void shouldReturnTemplate() {
final String prefix = UUID.randomUUID().toString();
System.setProperty(prefix, prefix);
System.setProperty(prefix + ".settings.key", "value");
System.setProperty(prefix + ".settings.key2", "value2");
System.setProperty(prefix + ".provider", GraphConfigurationMock.class.getName());
System.setProperty(prefix + ".database", "bucket");
final GraphTemplate template = config.getValue(prefix, GraphTemplate.class);
Assertions.assertNotNull(template);
System.clearProperty(prefix);
System.clearProperty(prefix + ".settings.key");
System.clearProperty(prefix + ".settings.key2");
System.clearProperty(prefix + ".provider");
System.clearProperty(prefix + ".database");
}
Aggregations