use of cz.metacentrum.perun.controller.model.ServiceForGUI in project perun by CESNET.
the class GeneralServiceManagerImpl method getFacilityAssignedServicesForGUI.
@Override
public List<ServiceForGUI> getFacilityAssignedServicesForGUI(PerunSession perunSession, Facility facility) throws PrivilegeException, FacilityNotExistsException, InternalErrorException {
// result list
List<ServiceForGUI> result = new ArrayList<ServiceForGUI>();
// get assigned services
List<Service> services = getServicesManager().getAssignedServices(perunSession, facility);
for (Service service : services) {
// flag
boolean allowed = true;
// new ServiceForGUI
ServiceForGUI newService = new ServiceForGUI(service);
// get their exec services
List<ExecService> execs = execServiceDao.listExecServices(service.getId());
for (ExecService exec : execs) {
// if generate
if (exec.getExecServiceType().equals(ExecService.ExecServiceType.GENERATE)) {
if (execServiceDenialDao.isExecServiceDeniedOnFacility(exec.getId(), facility.getId()) == true) {
newService.setGenAllowedOnFacility(false);
allowed = false;
} else {
newService.setGenAllowedOnFacility(true);
}
newService.setGenExecService(exec);
} else {
// if send
if (execServiceDenialDao.isExecServiceDeniedOnFacility(exec.getId(), facility.getId()) == true) {
newService.setSendAllowedOnFacility(false);
allowed = false;
} else {
newService.setSendAllowedOnFacility(true);
}
newService.setSendExecService(exec);
}
}
newService.setAllowedOnFacility(allowed);
result.add(newService);
}
return result;
}
Aggregations