use of org.opensmartgridplatform.domain.core.entities.ScheduledTaskWithoutData in project open-smart-grid-platform by OSGP.
the class DeviceManagementEndpoint method findScheduledTasks.
@PayloadRoot(localPart = "FindScheduledTasksRequest", namespace = DEVICE_MANAGEMENT_NAMESPACE)
@ResponsePayload
public FindScheduledTasksResponse findScheduledTasks(@OrganisationIdentification final String organisationIdentification, @RequestPayload final FindScheduledTasksRequest request) throws OsgpException {
LOGGER.info("Finding scheduled tasks for organisation: {}.", organisationIdentification);
final FindScheduledTasksResponse response = new FindScheduledTasksResponse();
try {
final List<ScheduledTaskWithoutData> scheduledTasks;
if (request.getDeviceIdentification() == null) {
scheduledTasks = this.deviceManagementService.findScheduledTasks(organisationIdentification);
} else {
scheduledTasks = this.deviceManagementService.findScheduledTasks(organisationIdentification, request.getDeviceIdentification());
}
response.getScheduledTask().addAll(this.deviceManagementMapper.mapAsList(scheduledTasks, org.opensmartgridplatform.adapter.ws.schema.core.devicemanagement.ScheduledTask.class));
} catch (final ConstraintViolationException e) {
throw new FunctionalException(FunctionalExceptionType.VALIDATION_ERROR, ComponentType.WS_CORE, new ValidationException(e.getConstraintViolations()));
} catch (final Exception e) {
this.handleException(e);
}
return response;
}
Aggregations