com.infusers.core.stats.users.ActiveUserDto Maven / Gradle / Ivy
package com.infusers.core.stats.users;
import java.io.Serializable;
import java.util.Date;
import com.infusers.core.security.common.UserLoggedInEvent;
import com.infusers.core.sse.requests.HTTPRequestDto;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
public class ActiveUserDto implements Serializable {
private static final long serialVersionUID = 1L;
private String userName;
private Date loggedInTime;
private Date lastActivityTime;
private String requestURI;
private String clientIp;
private String remarks;
public ActiveUserDto(HTTPRequestDto requestDto) {
this.set(requestDto);;
this.remarks = "User: anonymousUser or was either logged out/timed out.";
}
public ActiveUserDto(UserLoggedInEvent event) {
this.userName = event.getUserName();
this.loggedInTime = event.getLoggedInTime();
this.remarks = "User: Successfully logged in.";
}
public void set(HTTPRequestDto requestDto) {
this.userName = requestDto.getUserName();
// this.loggedInTime = loggedInTime;
this.lastActivityTime = requestDto.getCreatedAt();
this.requestURI = requestDto.getRequestURI();
this.clientIp = requestDto.getClientIp();
}
public String getKey() {
return userName;
}
@Override
public String toString() {
return "ActiveUserDto [userName=" + userName + ", loggedInTime=" + loggedInTime + ", lastActivityTime="
+ lastActivityTime + ", requestURI=" + requestURI + ", clientIp=" + clientIp + ", remarks=" + remarks
+ "]";
}
public static long getSerialversionuid() {
return serialVersionUID;
}
public String getUserName() {
return userName;
}
public Date getLoggedInTime() {
return loggedInTime;
}
public Date getLastActivityTime() {
return lastActivityTime;
}
public String getRequestURI() {
return requestURI;
}
public String getClientIp() {
return clientIp;
}
public String getRemarks() {
return remarks;
}
public void setRemarks(String remarks) {
this.remarks = remarks;
}
public void setLastActivityTime(Date lastActivityTime) {
this.lastActivityTime = lastActivityTime;
}
public void setRequestURI(String requestURI) {
this.requestURI = requestURI;
}
public void setClientIp(String clientIp) {
this.clientIp = clientIp;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy