keycloak-scim/server-spi-private/src/main/java/org/keycloak/events/Event.java

140 lines
3.1 KiB
Java
Raw Normal View History

2016-02-03 10:20:22 +00:00
/*
* Copyright 2016 Red Hat, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
2014-08-27 10:41:40 +00:00
package org.keycloak.events;
import java.util.HashMap;
import java.util.Map;
/**
* @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
*/
public class Event {
private long time;
2014-08-27 10:41:40 +00:00
private EventType type;
private String realmId;
private String clientId;
private String userId;
2014-05-07 08:33:29 +00:00
private String sessionId;
private String ipAddress;
private String error;
private Map<String, String> details;
public long getTime() {
return time;
}
public void setTime(long time) {
this.time = time;
}
2014-08-27 10:41:40 +00:00
public EventType getType() {
return type;
}
2014-08-27 10:41:40 +00:00
public void setType(EventType type) {
this.type = type;
}
public String getRealmId() {
return realmId;
}
public void setRealmId(String realmId) {
this.realmId = maxLength(realmId, 255);
}
public String getClientId() {
return clientId;
}
public void setClientId(String clientId) {
this.clientId = maxLength(clientId, 255);
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = maxLength(userId, 255);
}
2014-05-07 08:33:29 +00:00
public String getSessionId() {
return sessionId;
}
public void setSessionId(String sessionId) {
this.sessionId = sessionId;
}
public String getIpAddress() {
return ipAddress;
}
public void setIpAddress(String ipAddress) {
this.ipAddress = ipAddress;
}
public String getError() {
return error;
}
public void setError(String error) {
this.error = error;
}
public Map<String, String> getDetails() {
return details;
}
public void setDetails(Map<String, String> details) {
this.details = details;
}
public Event clone() {
Event clone = new Event();
clone.time = time;
2014-08-27 10:41:40 +00:00
clone.type = type;
clone.realmId = realmId;
clone.clientId = clientId;
clone.userId = userId;
2014-05-07 08:33:29 +00:00
clone.sessionId = sessionId;
clone.ipAddress = ipAddress;
clone.error = error;
2015-03-30 12:05:58 +00:00
clone.details = details != null ? new HashMap<>(details) : null;
return clone;
}
static String maxLength(String string, int length){
if (string != null && string.length() > length) {
return string.substring(0, length - 1);
}
return string;
}
}