use of org.hisp.dhis.common.Objects in project dhis2-core by dhis2.
the class SystemController method getObjectCounts.
@RequestMapping(value = "/objectCounts", method = RequestMethod.GET)
@ResponseBody
public RootNode getObjectCounts() {
Map<Objects, Integer> objectCounts = statisticsProvider.getObjectCounts();
RootNode rootNode = NodeUtils.createRootNode("objectCounts");
for (Objects objects : objectCounts.keySet()) {
rootNode.addChild(new SimpleNode(objects.getValue(), objectCounts.get(objects)));
}
return rootNode;
}
use of org.hisp.dhis.common.Objects in project dhis2-core by dhis2.
the class GetStatisticsAction method execute.
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@Override
public String execute() throws Exception {
Map<Objects, Integer> counts = statisticsProvider.getObjectCounts();
Date lastHour = new DateTime().minusHours(1).toDate();
objects = new EnumMapWrapper<>(Objects.class, counts);
activeUsers.put(0, userService.getActiveUsersCount(lastHour));
activeUsers.put(1, userService.getActiveUsersCount(0));
activeUsers.put(2, userService.getActiveUsersCount(1));
activeUsers.put(7, userService.getActiveUsersCount(7));
activeUsers.put(30, userService.getActiveUsersCount(30));
Map<UserInvitationStatus, Integer> invitations = new HashMap<>();
UserQueryParams inviteAll = new UserQueryParams();
inviteAll.setInvitationStatus(UserInvitationStatus.ALL);
invitations.put(UserInvitationStatus.ALL, userService.getUserCount(inviteAll));
UserQueryParams inviteExpired = new UserQueryParams();
inviteExpired.setInvitationStatus(UserInvitationStatus.EXPIRED);
invitations.put(UserInvitationStatus.EXPIRED, userService.getUserCount(inviteExpired));
userInvitations = new EnumMapWrapper<>(UserInvitationStatus.class, invitations);
dataValueCount.put(0, dataValueService.getDataValueCount(0));
dataValueCount.put(1, dataValueService.getDataValueCount(1));
dataValueCount.put(7, dataValueService.getDataValueCount(7));
dataValueCount.put(30, dataValueService.getDataValueCount(30));
eventCount.put(0, programStageInstanceService.getProgramStageInstanceCount(0));
eventCount.put(1, programStageInstanceService.getProgramStageInstanceCount(1));
eventCount.put(7, programStageInstanceService.getProgramStageInstanceCount(7));
eventCount.put(30, programStageInstanceService.getProgramStageInstanceCount(30));
return SUCCESS;
}
Aggregations