Commit f05e4386 authored by michael.simon's avatar michael.simon
Browse files

Change registration to correctly roll back transaction

parent d264a666
...@@ -10,6 +10,9 @@ ...@@ -10,6 +10,9 @@
******************************************************************************/ ******************************************************************************/
package edu.kit.scc.webreg.exc; package edu.kit.scc.webreg.exc;
import javax.ejb.ApplicationException;
@ApplicationException(rollback=true)
public class RegisterException extends Exception { public class RegisterException extends Exception {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
...@@ -121,7 +121,7 @@ public class ApprovalServiceImpl implements ApprovalService { ...@@ -121,7 +121,7 @@ public class ApprovalServiceImpl implements ApprovalService {
RegisterUserWorkflow workflow = getRegisterWorkflowInstance(registry.getRegisterBean()); RegisterUserWorkflow workflow = getRegisterWorkflowInstance(registry.getRegisterBean());
try { try {
registry = registryDao.persist(registry);
ServiceEntity serviceEntity = serviceDao.findByIdWithServiceProps(registry.getService().getId()); ServiceEntity serviceEntity = serviceDao.findByIdWithServiceProps(registry.getService().getId());
UserEntity userEntity = userDao.findByIdWithAll(registry.getUser().getId()); UserEntity userEntity = userDao.findByIdWithAll(registry.getUser().getId());
...@@ -137,7 +137,9 @@ public class ApprovalServiceImpl implements ApprovalService { ...@@ -137,7 +137,9 @@ public class ApprovalServiceImpl implements ApprovalService {
registry.setRegistryStatus(RegistryStatus.ACTIVE); registry.setRegistryStatus(RegistryStatus.ACTIVE);
registry.setLastStatusChange(new Date()); registry.setLastStatusChange(new Date());
registry.setLastReconcile(new Date()); registry.setLastReconcile(new Date());
registry = registryDao.persist(registry);
HashSet<GroupEntity> userGroups = new HashSet<GroupEntity>(userEntity.getGroups().size()); HashSet<GroupEntity> userGroups = new HashSet<GroupEntity>(userEntity.getGroups().size());
for (UserGroupEntity userGroup : userEntity.getGroups()) { for (UserGroupEntity userGroup : userEntity.getGroups()) {
......
...@@ -137,6 +137,8 @@ public class RegisterUserServiceImpl implements RegisterUserService { ...@@ -137,6 +137,8 @@ public class RegisterUserServiceImpl implements RegisterUserService {
registry.setRegistryStatus(RegistryStatus.CREATED); registry.setRegistryStatus(RegistryStatus.CREATED);
registry.setLastStatusChange(new Date()); registry.setLastStatusChange(new Date());
registry = registryDao.persist(registry);
if (registry.getApprovalBean() != null) { if (registry.getApprovalBean() != null) {
logger.debug("Registering {} for approval {}", user.getEppn(), registry.getApprovalBean()); logger.debug("Registering {} for approval {}", user.getEppn(), registry.getApprovalBean());
approvalService.registerApproval(registry); approvalService.registerApproval(registry);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment