use of org.opensmartgridplatform.adapter.ws.tariffswitching.infra.jms.TariffSwitchingRequestMessage in project open-smart-grid-platform by OSGP.
the class ScheduleManagementService method enqueueSetTariffSchedule.
public String enqueueSetTariffSchedule(@Identification final String organisationIdentification, @Identification final String deviceIdentification, @NotNull @Size(min = 1, max = 50) @Valid final List<ScheduleEntry> mapAsList, final DateTime scheduledTime, final int messagePriority) throws FunctionalException {
final Organisation organisation = this.domainHelperService.findOrganisation(organisationIdentification);
final Device device = this.domainHelperService.findActiveDevice(deviceIdentification);
this.domainHelperService.isAllowed(organisation, device, DeviceFunction.SET_TARIFF_SCHEDULE);
this.domainHelperService.isInMaintenance(device);
LOGGER.debug("enqueueSetTariffSchedule called with organisation {} and device {}", organisationIdentification, deviceIdentification);
final String correlationUid = this.correlationIdProviderService.getCorrelationId(organisationIdentification, deviceIdentification);
final Schedule schedule = new Schedule(mapAsList);
final MessageMetadata deviceMessageMetadata = new MessageMetadata.Builder().withDeviceIdentification(deviceIdentification).withOrganisationIdentification(organisationIdentification).withCorrelationUid(correlationUid).withMessageType(MessageType.SET_TARIFF_SCHEDULE.name()).withMessagePriority(messagePriority).withScheduleTime(scheduledTime == null ? null : scheduledTime.getMillis()).build();
final TariffSwitchingRequestMessage message = new TariffSwitchingRequestMessage.Builder().messageMetadata(deviceMessageMetadata).request(schedule).build();
this.tariffSwitchingRequestMessageSender.send(message);
return correlationUid;
}
use of org.opensmartgridplatform.adapter.ws.tariffswitching.infra.jms.TariffSwitchingRequestMessage in project open-smart-grid-platform by OSGP.
the class AdHocManagementService method enqueueGetTariffStatusRequest.
public String enqueueGetTariffStatusRequest(@Identification final String organisationIdentification, @Identification final String deviceIdentification, final int messagePriority) throws FunctionalException {
final Organisation organisation = this.domainHelperService.findOrganisation(organisationIdentification);
final Device device = this.domainHelperService.findActiveDevice(deviceIdentification);
this.domainHelperService.isAllowed(organisation, device, DeviceFunction.GET_STATUS);
LOGGER.debug("enqueueGetTariffStatusRequest called with organisation {} and device {}", organisationIdentification, deviceIdentification);
final String correlationUid = this.correlationIdProviderService.getCorrelationId(organisationIdentification, deviceIdentification);
final MessageMetadata deviceMessageMetadata = new MessageMetadata.Builder().withDeviceIdentification(deviceIdentification).withOrganisationIdentification(organisationIdentification).withCorrelationUid(correlationUid).withMessageType(MessageType.GET_TARIFF_STATUS.name()).withMessagePriority(messagePriority).build();
final TariffSwitchingRequestMessage message = new TariffSwitchingRequestMessage.Builder().messageMetadata(deviceMessageMetadata).build();
this.tariffSwitchingRequestMessageSender.send(message);
return correlationUid;
}
Aggregations