class AccessRequestService {

    public List<CompletedAccessRequestWrapper> getLiveRequests() {
        List<AccessRequest> liveRequests = accessRequestRepository.getLiveAccessRequests();
        Map<String, Map<String, Object>> liveRequestExpirationData = accessRequestRepository.getLiveAccessRequestExpirations()
                .stream()
                .collect(Collectors.toMap(item -> item.get("id").toString(), item -> item));

        return liveRequests.stream().map(
                item -> new CompletedAccessRequestWrapper(item)
                    .setUpdated((Date)liveRequestExpirationData.get(String.valueOf(item.getId())).get("granted_on"))
                    .setExpirationDate((Date)liveRequestExpirationData.get(String.valueOf(item.getId())).get("expire_time"))
        ).collect(Collectors.toList());
    }

    @Autowired public  AccessRequestService(TaskService taskService,
                                AccessRequestRepository accessRequestRepository,
                                GatekeeperRoleService gatekeeperRoleService,
                                RuntimeService runtimeService,
                                HistoryService historyService,
                                GatekeeperApprovalProperties gatekeeperApprovalProperties,
                                AccountInformationService accountInformationService,
                                GatekeeperOverrideProperties overridePolicy,
                                DatabaseConnectionService databaseConnectionService,
                                EntityManager entityManager);

}