package gr.cite.notification.web.interceptors; import gr.cite.notification.convention.ConventionService; import gr.cite.tools.cache.CacheService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.HashMap; import java.util.List; import java.util.UUID; @Service public class UserInterceptorCacheService extends CacheService { public static class UserInterceptorCacheValue { public UserInterceptorCacheValue() { } public UserInterceptorCacheValue(String subjectId, UUID userId) { this.subjectId = subjectId; this.userId = userId; } private String subjectId; public String getSubjectId() { return subjectId; } public void setSubjectId(String subjectId) { this.subjectId = subjectId; } private UUID userId; public UUID getUserId() { return userId; } public void setUserId(UUID userId) { this.userId = userId; } } @Autowired public UserInterceptorCacheService(UserInterceptorCacheOptions options) { super(options); } @Override protected Class valueClass() { return UserInterceptorCacheValue.class; } @Override public String keyOf(UserInterceptorCacheValue value) { return this.buildKey(value.getSubjectId()); } public String buildKey(String subject) { HashMap keyParts = new HashMap<>(); keyParts.put("$subject$", subject); return this.generateKey(keyParts); } }