mirror of
https://github.com/Telecominfraproject/wlan-cloud-services.git
synced 2026-03-20 17:39:19 +00:00
Compare commits
2 Commits
WIFI-2664
...
WIFI-2670_
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
75c943211a | ||
|
|
a200fcc12e |
@@ -517,26 +517,52 @@ public class ClientDatastoreInMemory extends BaseInMemoryDatastore implements Cl
|
||||
@Override
|
||||
public ClientSessionCounts getSessionCounts(int customerId) {
|
||||
ClientSessionCounts counts = new ClientSessionCounts();
|
||||
int totalCount = 0;
|
||||
Map<String, Integer> perOuiMap = new HashMap<>();
|
||||
counts.setCustomerId(customerId);
|
||||
|
||||
long totalCount = 0;
|
||||
Map<String, Long> perEquipmentMap = new HashMap<>();
|
||||
Map<String, Long> perOuiMap = new HashMap<>();
|
||||
Map<String, Long> perRadioMap = new HashMap<>();
|
||||
|
||||
for (ClientSession session : idToClientSessionMap.values()) {
|
||||
if (session.getCustomerId() == customerId) {
|
||||
totalCount++;
|
||||
String equipmentIdString = Long.toString(session.getEquipmentId());
|
||||
Long cnt = perEquipmentMap.get(equipmentIdString);
|
||||
if (cnt == null) {
|
||||
cnt = 0L;
|
||||
} else {
|
||||
cnt++;
|
||||
}
|
||||
perEquipmentMap.put(equipmentIdString, cnt);
|
||||
|
||||
if (session.getOui() != null) {
|
||||
Integer cnt = perOuiMap.get(session.getOui());
|
||||
cnt = perOuiMap.get(session.getOui());
|
||||
if (cnt == null) {
|
||||
cnt = 0;
|
||||
cnt = 0L;
|
||||
} else {
|
||||
cnt++;
|
||||
}
|
||||
perOuiMap.put(session.getOui(), cnt);
|
||||
}
|
||||
|
||||
if (session.getDetails() != null && session.getDetails().getRadioType() != null) {
|
||||
String radioTypeString = session.getDetails().getRadioType().toString();
|
||||
cnt = perRadioMap.get(radioTypeString);
|
||||
if (cnt == null) {
|
||||
cnt = 0L;
|
||||
} else {
|
||||
cnt++;
|
||||
}
|
||||
perRadioMap.put(radioTypeString, cnt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
counts.setTotalCount(totalCount);
|
||||
counts.setEquipmentCounts(perEquipmentMap);
|
||||
counts.setOuiCounts(perOuiMap);
|
||||
counts.setRadioCounts(perRadioMap);
|
||||
return counts;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,38 +7,84 @@ import java.util.Map;
|
||||
import com.telecominfraproject.wlan.core.model.json.BaseJsonModel;
|
||||
|
||||
/**
|
||||
* Total and per-oui counts of the Client Sessions
|
||||
* Total and per-oui/equipment/radio counts of the Client Sessions
|
||||
*/
|
||||
public class ClientSessionCounts extends BaseJsonModel {
|
||||
|
||||
private static final long serialVersionUID = 7697349699510565184L;
|
||||
|
||||
private int totalCount;
|
||||
private Map<String, Integer> ouiCounts = new HashMap<>();
|
||||
private int customerId;
|
||||
/**
|
||||
* Total count of all client sessions for the customer Id.
|
||||
*/
|
||||
private long totalCount;
|
||||
/**
|
||||
* Counts of client sessions per equipment Id.
|
||||
*/
|
||||
private Map<String, Long> equipmentCounts = new HashMap<>();
|
||||
/**
|
||||
* Counts of client sessions per OUI.
|
||||
*/
|
||||
private Map<String, Long> ouiCounts = new HashMap<>();
|
||||
/**
|
||||
* Counts of client sessions per Radio Type.
|
||||
*/
|
||||
private Map<String, Long> radioCounts = new HashMap<>();
|
||||
|
||||
public Map<String, Integer> getOuiCounts() {
|
||||
return ouiCounts;
|
||||
public int getCustomerId() {
|
||||
return customerId;
|
||||
}
|
||||
|
||||
public void setOuiCounts(Map<String, Integer> ouiCounts) {
|
||||
this.ouiCounts = ouiCounts;
|
||||
public void setCustomerId(int customerId) {
|
||||
this.customerId = customerId;
|
||||
}
|
||||
|
||||
public int getTotalCount() {
|
||||
public long getTotalCount() {
|
||||
return totalCount;
|
||||
}
|
||||
|
||||
public void setTotalCount(int totalCount) {
|
||||
public void setTotalCount(long totalCount) {
|
||||
this.totalCount = totalCount;
|
||||
}
|
||||
|
||||
public Map<String, Long> getEquipmentCounts() {
|
||||
return equipmentCounts;
|
||||
}
|
||||
|
||||
public void setEquipmentCounts(Map<String, Long> equipmentCounts) {
|
||||
this.equipmentCounts = equipmentCounts;
|
||||
}
|
||||
|
||||
public Map<String, Long> getOuiCounts() {
|
||||
return ouiCounts;
|
||||
}
|
||||
|
||||
public void setOuiCounts(Map<String, Long> ouiCounts) {
|
||||
this.ouiCounts = ouiCounts;
|
||||
}
|
||||
|
||||
public Map<String, Long> getRadioCounts() {
|
||||
return radioCounts;
|
||||
}
|
||||
|
||||
public void setRadioCounts(Map<String, Long> radioCounts) {
|
||||
this.radioCounts = radioCounts;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClientSessionCounts clone() {
|
||||
ClientSessionCounts ret = (ClientSessionCounts) super.clone();
|
||||
if (equipmentCounts != null) {
|
||||
ret.equipmentCounts = new HashMap<>(equipmentCounts);
|
||||
}
|
||||
if (ouiCounts != null) {
|
||||
ret.ouiCounts = new HashMap<>(ouiCounts);
|
||||
}
|
||||
if (radioCounts != null) {
|
||||
ret.radioCounts = new HashMap<>(radioCounts);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user