Search in sources :

Example 1 with PersonServiceImpl

use of service.advanced.PersonServiceImpl 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;
}
Also used : HashMap(java.util.HashMap) PersonInfoStorage(service.advanced.PersonInfoStorage) SearchContextProvider(org.apache.cxf.jaxrs.ext.search.SearchContextProvider) PersonServiceImpl(service.advanced.PersonServiceImpl) EntityManagerFactory(javax.persistence.EntityManagerFactory) SearchService(service.advanced.SearchService) JSONProvider(org.apache.cxf.jaxrs.provider.json.JSONProvider) PersonExceptionMapper(service.advanced.PersonExceptionMapper) HashSet(java.util.HashSet)

Aggregations

HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 EntityManagerFactory (javax.persistence.EntityManagerFactory)1 SearchContextProvider (org.apache.cxf.jaxrs.ext.search.SearchContextProvider)1 JSONProvider (org.apache.cxf.jaxrs.provider.json.JSONProvider)1 PersonExceptionMapper (service.advanced.PersonExceptionMapper)1 PersonInfoStorage (service.advanced.PersonInfoStorage)1 PersonServiceImpl (service.advanced.PersonServiceImpl)1 SearchService (service.advanced.SearchService)1