Search in sources :

Example 1 with TariffSwitchingRequestMessage

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;
}
Also used : MessageMetadata(org.opensmartgridplatform.shared.infra.jms.MessageMetadata) Organisation(org.opensmartgridplatform.domain.core.entities.Organisation) Device(org.opensmartgridplatform.domain.core.entities.Device) Schedule(org.opensmartgridplatform.domain.core.valueobjects.Schedule) TariffSwitchingRequestMessage(org.opensmartgridplatform.adapter.ws.tariffswitching.infra.jms.TariffSwitchingRequestMessage)

Example 2 with TariffSwitchingRequestMessage

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;
}
Also used : MessageMetadata(org.opensmartgridplatform.shared.infra.jms.MessageMetadata) Organisation(org.opensmartgridplatform.domain.core.entities.Organisation) Device(org.opensmartgridplatform.domain.core.entities.Device) TariffSwitchingRequestMessage(org.opensmartgridplatform.adapter.ws.tariffswitching.infra.jms.TariffSwitchingRequestMessage)

Aggregations

TariffSwitchingRequestMessage (org.opensmartgridplatform.adapter.ws.tariffswitching.infra.jms.TariffSwitchingRequestMessage)2 Device (org.opensmartgridplatform.domain.core.entities.Device)2 Organisation (org.opensmartgridplatform.domain.core.entities.Organisation)2 MessageMetadata (org.opensmartgridplatform.shared.infra.jms.MessageMetadata)2 Schedule (org.opensmartgridplatform.domain.core.valueobjects.Schedule)1