Search in sources :

Example 26 with BusinessException

use of org.meveo.admin.exception.BusinessException in project meveo by meveo-org.

the class BaseCrudBean method exportXML.

public StreamedContent exportXML() throws IOException, MeveoApiException, BusinessException {
    if (baseCrudApi == null) {
        throw new BusinessException(getClass().getSimpleName() + " is not using a base crud api");
    }
    PaginationConfiguration configuration = new PaginationConfiguration(super.getFilters());
    File exportXML = baseCrudApi.exportXML(configuration);
    DefaultStreamedContent defaultStreamedContent = new DefaultStreamedContent();
    defaultStreamedContent.setContentEncoding("UTF-8");
    defaultStreamedContent.setContentType("application/xml");
    defaultStreamedContent.setStream(new FileInputStream(exportXML));
    defaultStreamedContent.setName(exportXML.getName());
    return defaultStreamedContent;
}
Also used : BusinessException(org.meveo.admin.exception.BusinessException) DefaultStreamedContent(org.primefaces.model.DefaultStreamedContent) File(java.io.File) PaginationConfiguration(org.meveo.admin.util.pagination.PaginationConfiguration) FileInputStream(java.io.FileInputStream)

Example 27 with BusinessException

use of org.meveo.admin.exception.BusinessException in project meveo by meveo-org.

the class BaseCrudBean method exportJSON.

public StreamedContent exportJSON() throws IOException, BusinessException, MeveoApiException {
    if (baseCrudApi == null) {
        baseCrudApi = getBaseCrudApi();
    }
    if (baseCrudApi == null) {
        throw new BusinessException(getClass().getSimpleName() + " is not using a base crud api");
    }
    PaginationConfiguration configuration = new PaginationConfiguration(getFilters());
    File exportJSON = baseCrudApi.exportJSON(configuration);
    DefaultStreamedContent defaultStreamedContent = new DefaultStreamedContent();
    defaultStreamedContent.setContentEncoding("UTF-8");
    defaultStreamedContent.setContentType("application/json");
    defaultStreamedContent.setStream(new FileInputStream(exportJSON));
    defaultStreamedContent.setName(exportJSON.getName());
    return defaultStreamedContent;
}
Also used : BusinessException(org.meveo.admin.exception.BusinessException) DefaultStreamedContent(org.primefaces.model.DefaultStreamedContent) File(java.io.File) PaginationConfiguration(org.meveo.admin.util.pagination.PaginationConfiguration) FileInputStream(java.io.FileInputStream)

Example 28 with BusinessException

use of org.meveo.admin.exception.BusinessException in project meveo by meveo-org.

the class FilterCustomFieldSearchBean method buildFilterParameters.

public void buildFilterParameters(Map<String, Object> filters) {
    if (filters != null && filters.containsKey("$FILTER")) {
        Filter entity = (Filter) filters.get("$FILTER");
        try {
            Map<CustomFieldTemplate, Object> parameterMap = customFieldDataEntryBean.loadCustomFieldsFromGUI(entity);
            filters.put("$FILTER_PARAMETERS", parameterMap);
        } catch (BusinessException e) {
            log.error("Failed to load search parameters from custom fields.", e);
            messages.error(e.getMessage());
        }
    }
}
Also used : BusinessException(org.meveo.admin.exception.BusinessException) Filter(org.meveo.model.filter.Filter) CustomFieldTemplate(org.meveo.model.crm.CustomFieldTemplate)

Example 29 with BusinessException

use of org.meveo.admin.exception.BusinessException in project meveo by meveo-org.

the class UserBean method generateKey.

public void generateKey() {
    try {
        String username = entity.getUserName();
        userApi.generateShKey(username, this.getPassphrase());
        initEntity(entity.getId());
        messages.info(new BundleKey("messages", "user.generate.successful"));
    } catch (BusinessException e) {
        messages.error(new BundleKey("messages", "user.generate.error"));
    }
}
Also used : BusinessException(org.meveo.admin.exception.BusinessException) BundleKey(org.jboss.seam.international.status.builder.BundleKey)

Example 30 with BusinessException

use of org.meveo.admin.exception.BusinessException in project meveo by meveo-org.

the class MeveoInstanceBean method synchRemoteRepositories.

@ActionMethod
public void synchRemoteRepositories() {
    try {
        Response response = meveoInstanceService.getRemoteRepositories("api/rest/mavenConfiguration", entity);
        MavenConfigurationResponseDto result = response.readEntity(MavenConfigurationResponseDto.class);
        mavenConfigurationService.updateRepository(result.getMavenConfiguration().getMavenRepositories());
        messages.info(new BundleKey("messages", "meveoInstance.remoteRepository.synch.ok"));
    } catch (BusinessException e) {
        messages.error(new BundleKey("messages", "meveoInstance.remoteRepository.synch.ko"));
    }
}
Also used : Response(javax.ws.rs.core.Response) BusinessException(org.meveo.admin.exception.BusinessException) MavenConfigurationResponseDto(org.meveo.api.dto.config.MavenConfigurationResponseDto) BundleKey(org.jboss.seam.international.status.builder.BundleKey) ActionMethod(org.meveo.admin.web.interceptor.ActionMethod)

Aggregations

BusinessException (org.meveo.admin.exception.BusinessException)229 IOException (java.io.IOException)97 File (java.io.File)59 HashMap (java.util.HashMap)50 EntityDoesNotExistsException (org.meveo.api.exception.EntityDoesNotExistsException)50 ArrayList (java.util.ArrayList)48 MeveoApiException (org.meveo.api.exception.MeveoApiException)39 ELException (org.meveo.elresolver.ELException)39 CustomFieldTemplate (org.meveo.model.crm.CustomFieldTemplate)38 CustomEntityTemplate (org.meveo.model.customEntities.CustomEntityTemplate)37 Map (java.util.Map)34 BundleKey (org.jboss.seam.international.status.builder.BundleKey)30 TransactionAttribute (javax.ejb.TransactionAttribute)28 CustomEntityInstance (org.meveo.model.customEntities.CustomEntityInstance)27 List (java.util.List)25 MeveoModule (org.meveo.model.module.MeveoModule)25 NoResultException (javax.persistence.NoResultException)24 HashSet (java.util.HashSet)22 Response (javax.ws.rs.core.Response)22 Collection (java.util.Collection)20