66 lines
1.6 KiB
Java
66 lines
1.6 KiB
Java
package eu.eudat.depositinterface.zenodorepository.service;
|
|
|
|
import gr.cite.tools.cache.CacheService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import java.util.HashMap;
|
|
|
|
@Service
|
|
public class RepositoryLogoCacheService extends CacheService<RepositoryLogoCacheService.RepositoryLogoCacheValue> {
|
|
|
|
public static class RepositoryLogoCacheValue {
|
|
|
|
public RepositoryLogoCacheValue() {
|
|
}
|
|
|
|
public RepositoryLogoCacheValue(String repositoryId, byte[] logo) {
|
|
this.repositoryId = repositoryId;
|
|
this.logo = logo;
|
|
}
|
|
|
|
private String repositoryId;
|
|
|
|
public String getRepositoryId() {
|
|
return repositoryId;
|
|
}
|
|
|
|
public void setRepositoryId(String repositoryId) {
|
|
this.repositoryId = repositoryId;
|
|
}
|
|
|
|
private byte[] logo;
|
|
|
|
public byte[] getLogo() {
|
|
return logo;
|
|
}
|
|
|
|
public void setLogo(byte[] logo) {
|
|
this.logo = logo;
|
|
}
|
|
}
|
|
|
|
|
|
@Autowired
|
|
public RepositoryLogoCacheService(RepositoryLogoCacheOptions options) {
|
|
super(options);
|
|
}
|
|
|
|
@Override
|
|
protected Class<RepositoryLogoCacheValue> valueClass() {
|
|
return RepositoryLogoCacheValue.class;
|
|
}
|
|
|
|
@Override
|
|
public String keyOf(RepositoryLogoCacheValue value) {
|
|
return this.buildKey(value.getRepositoryId());
|
|
}
|
|
|
|
|
|
public String buildKey(String repositoryId) {
|
|
HashMap<String, String> keyParts = new HashMap<>();
|
|
keyParts.put("$repo$", repositoryId);
|
|
return this.generateKey(keyParts);
|
|
}
|
|
}
|