use of service.advanced.SearchService in project tesb-rt-se by Talend.
the class PersonApplication method getSingletons.
@Override
public Set<Object> getSingletons() {
Set<Object> classes = new HashSet<Object>();
PersonInfoStorage storage = new PersonInfoStorage();
try {
Class.forName("org.hsqldb.jdbcDriver");
EntityManagerFactory emFactory = Persistence.createEntityManagerFactory("persistenceUnitOpenJPA");
storage.setEntityManager(emFactory.createEntityManager());
Map<String, String> beanPropertiesMap = new HashMap<String, String>();
beanPropertiesMap.put("fatherName", "father.name");
beanPropertiesMap.put("father", "father.name");
beanPropertiesMap.put("childName", "children.name");
storage.setBeanProperties(beanPropertiesMap);
storage.init();
} catch (Throwable ex) {
throw new RuntimeException(ex);
}
PersonServiceImpl personService = new PersonServiceImpl();
personService.setStorage(storage);
classes.add(personService);
SearchService searchService = new SearchService();
searchService.setStorage(storage);
classes.add(searchService);
// custom providers
classes.add(new PersonExceptionMapper());
JSONProvider<?> provider = new JSONProvider<Object>();
provider.setIgnoreNamespaces(true);
classes.add(provider);
classes.add(new SearchContextProvider());
return classes;
}
Aggregations