Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
teosarca committed Jul 11, 2018
1 parent a95476c commit 3e8b9ac
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 23 deletions.
23 changes: 0 additions & 23 deletions src/main/java/de/metas/ui/web/login/LoginRestController.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
import org.compiere.util.Login;
import org.compiere.util.LoginContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.session.events.SessionDestroyedEvent;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
Expand Down Expand Up @@ -312,24 +309,4 @@ public void logout(final HttpServletRequest request)
destroyMFSession(loginService);
}

@Component
public static class SessionDestroyedListener implements ApplicationListener<SessionDestroyedEvent>
{
@Autowired
private UserNotificationsService userNotificationsService;

public SessionDestroyedListener()
{
super();
}

@Override
public void onApplicationEvent(final SessionDestroyedEvent event)
{
final String sessionId = event.getSessionId();
userNotificationsService.disableForSession(sessionId);
}

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package de.metas.ui.web.session;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.session.events.SessionDestroyedEvent;
import org.springframework.stereotype.Component;

import de.metas.ui.web.notification.UserNotificationsService;

/*
* #%L
* metasfresh-webui-api
* %%
* Copyright (C) 2018 metas GmbH
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-2.0.html>.
* #L%
*/

@Component
public class SessionDestroyedListener implements ApplicationListener<SessionDestroyedEvent>
{
@Autowired
private UserNotificationsService userNotificationsService;

@Override
public void onApplicationEvent(final SessionDestroyedEvent event)
{
final String sessionId = event.getSessionId();
userNotificationsService.disableForSession(sessionId);
}

}

0 comments on commit 3e8b9ac

Please sign in to comment.