Search in sources :

Example 1 with ActionMethod

use of org.meveo.admin.web.interceptor.ActionMethod in project meveo by meveo-org.

the class BaseBean method disable.

/**
 * Disable current entity. Add error message to status messages if unsuccessful.
 */
@ActionMethod
public void disable() {
    try {
        log.info("Disabling entity {} with id = {}", clazz.getName(), entity.getId());
        entity = getPersistenceService().disable((Long) entity.getId());
        messages.info(new BundleKey("messages", "disabled.successful"));
    } catch (Exception t) {
        log.info("unexpected exception when disabling!", t);
        messages.error(new BundleKey("messages", "error.unexpected"));
    }
}
Also used : BundleKey(org.jboss.seam.international.status.builder.BundleKey) ELException(org.meveo.elresolver.ELException) BusinessException(org.meveo.admin.exception.BusinessException) MeveoApiException(org.meveo.api.exception.MeveoApiException) ConstraintViolationException(org.meveo.admin.exception.ConstraintViolationException) ActionMethod(org.meveo.admin.web.interceptor.ActionMethod)

Example 2 with ActionMethod

use of org.meveo.admin.web.interceptor.ActionMethod in project meveo by meveo-org.

the class BaseBean method disable.

/**
 * Disable Entity using it's ID. Add error message to status messages if unsuccessful.
 *
 * @param id Entity id to disable
 */
@ActionMethod
public void disable(Long id) {
    try {
        log.info("Disabling entity {} with id = {}", clazz.getName(), id);
        getPersistenceService().disable(id);
        messages.info(new BundleKey("messages", "disabled.successful"));
    } catch (Throwable t) {
        log.info("unexpected exception when disabling!", t);
        messages.error(new BundleKey("messages", "error.unexpected"));
    }
}
Also used : BundleKey(org.jboss.seam.international.status.builder.BundleKey) ActionMethod(org.meveo.admin.web.interceptor.ActionMethod)

Example 3 with ActionMethod

use of org.meveo.admin.web.interceptor.ActionMethod in project meveo by meveo-org.

the class UserBean method saveSecuredEntity.

/**
 * This will add the selected business entity to the user's securedEntities
 * list.
 *
 * @param event
 * @throws BusinessException
 */
@SuppressWarnings("unlikely-arg-type")
@ActionMethod
public void saveSecuredEntity(SelectEvent event) throws BusinessException, ELException {
    log.debug("saveSecuredEntity: {}", this.selectedEntity);
    if (this.selectedEntity != null) {
        List<SecuredEntity> securedEntities = getEntity().getSecuredEntities();
        for (SecuredEntity securedEntity : securedEntities) {
            if (securedEntity.equals(this.selectedEntity)) {
                messages.info(new BundleKey("messages", "commons.uniqueField.code"));
                return;
            }
        }
        getEntity().getSecuredEntities().add(new SecuredEntity(this.selectedEntity));
        super.saveOrUpdate(false);
    }
}
Also used : SecuredEntity(org.meveo.model.admin.SecuredEntity) DetailedSecuredEntity(org.meveo.model.admin.DetailedSecuredEntity) BundleKey(org.jboss.seam.international.status.builder.BundleKey) ActionMethod(org.meveo.admin.web.interceptor.ActionMethod)

Example 4 with ActionMethod

use of org.meveo.admin.web.interceptor.ActionMethod in project meveo by meveo-org.

the class UserBean method saveOrUpdate.

/*
	 * (non-Javadoc)
	 * 
	 * @see org.meveo.admin.action.BaseBean#saveOrUpdate(boolean)
	 */
@Override
@ActionMethod
public String saveOrUpdate(boolean killConversation) throws BusinessException, ELException {
    if (entity.getId() != null) {
        if (userService.isUsernameExists(entity.getUserName(), entity.getId())) {
            messages.error(new BundleKey("messages", "exception.UsernameAlreadyExistsException"));
            return null;
        }
    } else {
        if (userService.isUsernameExists(entity.getUserName())) {
            messages.error(new BundleKey("messages", "exception.UsernameAlreadyExistsException"));
            return null;
        }
    }
    if (this.getUserGroupSelectedNode() != null) {
        UserHierarchyLevel userHierarchyLevel = (UserHierarchyLevel) this.getUserGroupSelectedNode().getData();
        getEntity().setUserLevel(userHierarchyLevel);
    }
    getEntity().getRoles().clear();
    getEntity().getRoles().addAll(roleService.refreshOrRetrieve(rolesDM.getTarget()));
    return super.saveOrUpdate(killConversation);
}
Also used : UserHierarchyLevel(org.meveo.model.hierarchy.UserHierarchyLevel) BundleKey(org.jboss.seam.international.status.builder.BundleKey) ActionMethod(org.meveo.admin.web.interceptor.ActionMethod)

Example 5 with ActionMethod

use of org.meveo.admin.web.interceptor.ActionMethod 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

ActionMethod (org.meveo.admin.web.interceptor.ActionMethod)49 BundleKey (org.jboss.seam.international.status.builder.BundleKey)41 BusinessException (org.meveo.admin.exception.BusinessException)20 ELException (org.meveo.elresolver.ELException)14 ArrayList (java.util.ArrayList)6 Map (java.util.Map)6 WFTransition (org.meveo.model.wf.WFTransition)6 MeveoApiException (org.meveo.api.exception.MeveoApiException)5 HashMap (java.util.HashMap)4 CustomEntityInstance (org.meveo.model.customEntities.CustomEntityInstance)4 IOException (java.io.IOException)3 HashSet (java.util.HashSet)3 EntityExistsException (javax.persistence.EntityExistsException)3 ConstraintViolationException (org.meveo.admin.exception.ConstraintViolationException)3 EntityAlreadyExistsException (org.meveo.exceptions.EntityAlreadyExistsException)3 File (java.io.File)2 ValidationException (org.meveo.admin.exception.ValidationException)2 CustomFieldValue (org.meveo.model.crm.custom.CustomFieldValue)2 MeveoModule (org.meveo.model.module.MeveoModule)2 ScriptInstance (org.meveo.model.scripts.ScriptInstance)2