com.uid2.shared.store.ClientSideKeypairStoreSnapshot Maven / Gradle / Ivy
package com.uid2.shared.store;
import com.uid2.shared.model.ClientSideKeypair;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class ClientSideKeypairStoreSnapshot implements IClientSideKeypairStore.IClientSideKeypairStoreSnapshot {
private final HashMap keypairMap;
private final HashMap> siteKeypairMap;
private final List enabledKeypairs;
public ClientSideKeypairStoreSnapshot(HashMap keypairMap, HashMap> siteKeypairMap){
this.keypairMap = keypairMap;
this.siteKeypairMap = siteKeypairMap;
this.enabledKeypairs = new ArrayList<>();
for(Map.Entry entry : keypairMap.entrySet()) {
ClientSideKeypair k = entry.getValue();
if(!k.isDisabled()){
this.enabledKeypairs.add(k);
}
}
}
@Override
public List getAll() {
return new ArrayList<>(keypairMap.values());
}
@Override
public ClientSideKeypair getKeypair(String subscriptionId) {
return this.keypairMap.get(subscriptionId);
}
@Override
public List getSiteKeypairs(int siteId) {
return siteKeypairMap.get(siteId);
}
@Override
public List getEnabledKeypairs() {
return this.enabledKeypairs;
}
}