Search in sources :

Example 6 with PublicLightingRequestMessage

use of org.opensmartgridplatform.adapter.ws.publiclighting.infra.jms.PublicLightingRequestMessage in project open-smart-grid-platform by OSGP.

the class AdHocManagementService method enqueueResumeScheduleRequest.

public String enqueueResumeScheduleRequest(@Identification final String organisationIdentification, @Identification final String deviceIdentification, @Valid final ResumeScheduleData resumeScheduleData, 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.RESUME_SCHEDULE);
    this.domainHelperService.isInMaintenance(device);
    LOGGER.debug("enqueueResumeScheduleRequest called with organisation {}, device {} and resumeScheduleData {} ", organisationIdentification, deviceIdentification, resumeScheduleData);
    final String correlationUid = this.correlationIdProviderService.getCorrelationId(organisationIdentification, deviceIdentification);
    final MessageMetadata deviceMessageMetadata = new Builder().withDeviceIdentification(deviceIdentification).withOrganisationIdentification(organisationIdentification).withCorrelationUid(correlationUid).withMessageType(MessageType.RESUME_SCHEDULE.name()).withMessagePriority(messagePriority).build();
    final PublicLightingRequestMessage message = new PublicLightingRequestMessage.Builder().messageMetadata(deviceMessageMetadata).request(resumeScheduleData).build();
    this.messageSender.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) Builder(org.opensmartgridplatform.shared.infra.jms.MessageMetadata.Builder) PublicLightingRequestMessage(org.opensmartgridplatform.adapter.ws.publiclighting.infra.jms.PublicLightingRequestMessage)

Aggregations

PublicLightingRequestMessage (org.opensmartgridplatform.adapter.ws.publiclighting.infra.jms.PublicLightingRequestMessage)6 Device (org.opensmartgridplatform.domain.core.entities.Device)6 Organisation (org.opensmartgridplatform.domain.core.entities.Organisation)6 MessageMetadata (org.opensmartgridplatform.shared.infra.jms.MessageMetadata)6 Builder (org.opensmartgridplatform.shared.infra.jms.MessageMetadata.Builder)5 LightValueMessageDataContainer (org.opensmartgridplatform.domain.core.valueobjects.LightValueMessageDataContainer)1