/** * Step by step: * * <p>0. validate user 1. get or create user 2. get or create or move right and activate it 3. * login user 4. redirect to need page * * @return - resolution to next page */ @SynchronizeByAllEntity(entityClass = User.class) public Resolution execute() { state = new CreateUserState(request); final CreateUserMode mode = CreateUserModeCreator.next(request, state); request.setMode(mode); mode.getValidate().execute(this); if (getContext().getValidationErrors().size() > 0) { if (mode == CreateUserMode.INVITED_NEW) { return showForInvited(); } else { return showInternal(); } } persistanceTransaction.execute( new PersistanceTransactionContext<Void>() { @Override public Void execute() { mode.getCreateUser().execute(CreateUserAction.this); mode.getRight().execute(state); return null; } }); mode.getLogin().execute(this); return mode.getRedirect().execute(state); }