Search in sources :

Example 1 with DestroyApplicationSessionResponse

use of com.hack23.cia.service.api.action.application.DestroyApplicationSessionResponse in project cia by Hack23.

the class DestroyApplicationSessionService method processService.

@Override
@Secured({ "ROLE_ANONYMOUS" })
public DestroyApplicationSessionResponse processService(final DestroyApplicationSessionRequest serviceRequest) {
    final DestroyApplicationSessionResponse inputValidation = inputValidation(serviceRequest);
    if (inputValidation != null) {
        return inputValidation;
    }
    final ApplicationSession applicationSession = applicationSessionDAO.findFirstByProperty(ApplicationSession_.sessionId, serviceRequest.getSessionId());
    if (applicationSession != null) {
        LOGGER.info("Destroy Application session: {}", applicationSession.getSessionId());
        applicationSession.setDestroyedDate(new Date());
        applicationSessionDAO.persist(applicationSession);
        return new DestroyApplicationSessionResponse(ServiceResult.SUCCESS);
    } else {
        LOGGER.warn("Failed to destroy Application session, no session found for id: {}", serviceRequest.getSessionId());
        return new DestroyApplicationSessionResponse(ServiceResult.FAILURE);
    }
}
Also used : ApplicationSession(com.hack23.cia.model.internal.application.system.impl.ApplicationSession) DestroyApplicationSessionResponse(com.hack23.cia.service.api.action.application.DestroyApplicationSessionResponse) Date(java.util.Date) Secured(org.springframework.security.access.annotation.Secured)

Aggregations

ApplicationSession (com.hack23.cia.model.internal.application.system.impl.ApplicationSession)1 DestroyApplicationSessionResponse (com.hack23.cia.service.api.action.application.DestroyApplicationSessionResponse)1 Date (java.util.Date)1 Secured (org.springframework.security.access.annotation.Secured)1