Search in sources :

Example 1 with CustomFieldInstanceService

use of org.meveo.service.crm.impl.CustomFieldInstanceService in project meveo by meveo-org.

the class MeveoFunctionMapper method getCustomFieldInstanceService.

@SuppressWarnings("unchecked")
private static CustomFieldInstanceService getCustomFieldInstanceService() {
    if (customFieldInstanceService == null) {
        try {
            InitialContext initialContext = new InitialContext();
            BeanManager beanManager = (BeanManager) initialContext.lookup("java:comp/BeanManager");
            Bean<CustomFieldInstanceService> bean = (Bean<CustomFieldInstanceService>) beanManager.resolve(beanManager.getBeans(CustomFieldInstanceService.class));
            customFieldInstanceService = (CustomFieldInstanceService) beanManager.getReference(bean, bean.getBeanClass(), beanManager.createCreationalContext(bean));
        } catch (NamingException e) {
            Logger log = LoggerFactory.getLogger(MeveoFunctionMapper.class);
            log.error("Unable to access CustomFieldInstanceService", e);
            throw new RuntimeException(e);
        }
    }
    return customFieldInstanceService;
}
Also used : NamingException(javax.naming.NamingException) CustomFieldInstanceService(org.meveo.service.crm.impl.CustomFieldInstanceService) Logger(org.slf4j.Logger) BeanManager(javax.enterprise.inject.spi.BeanManager) InitialContext(javax.naming.InitialContext) ParamBean(org.meveo.commons.utils.ParamBean) Bean(javax.enterprise.inject.spi.Bean)

Aggregations

Bean (javax.enterprise.inject.spi.Bean)1 BeanManager (javax.enterprise.inject.spi.BeanManager)1 InitialContext (javax.naming.InitialContext)1 NamingException (javax.naming.NamingException)1 ParamBean (org.meveo.commons.utils.ParamBean)1 CustomFieldInstanceService (org.meveo.service.crm.impl.CustomFieldInstanceService)1 Logger (org.slf4j.Logger)1