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"));
}
}
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"));
}
}
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);
}
}
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);
}
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"));
}
}
Aggregations