Search in sources :

Example 6 with CommonRequestMessage

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

the class DeviceInstallationService method enqueueStopDeviceTestRequest.

// === STOP DEVICE TEST ===
@Transactional(value = "transactionManager")
public String enqueueStopDeviceTestRequest(@Identification final String organisationIdentification, @Identification final String deviceIdentification, final int messagePriority) throws FunctionalException {
    LOGGER.debug("Queue stop device test request");
    final Organisation organisation = this.domainHelperService.findOrganisation(organisationIdentification);
    final Device device = this.domainHelperService.findActiveDevice(deviceIdentification);
    this.domainHelperService.isAllowed(organisation, device, DeviceFunction.STOP_SELF_TEST);
    LOGGER.debug("enqueueStopDeviceTestRequest called with organisation {} and device {}", organisationIdentification, deviceIdentification);
    final String correlationUid = this.correlationIdProviderService.getCorrelationId(organisationIdentification, deviceIdentification);
    final MessageMetadata messageMetadata = new MessageMetadata.Builder().withDeviceIdentification(deviceIdentification).withOrganisationIdentification(organisationIdentification).withCorrelationUid(correlationUid).withMessageType(MessageType.STOP_SELF_TEST.name()).withMessagePriority(messagePriority).build();
    final CommonRequestMessage message = new CommonRequestMessage.Builder().messageMetadata(messageMetadata).build();
    this.commonRequestMessageSender.send(message);
    return correlationUid;
}
Also used : CommonRequestMessage(org.opensmartgridplatform.adapter.ws.core.infra.jms.CommonRequestMessage) MessageMetadata(org.opensmartgridplatform.shared.infra.jms.MessageMetadata) Organisation(org.opensmartgridplatform.domain.core.entities.Organisation) LightMeasurementDevice(org.opensmartgridplatform.domain.core.entities.LightMeasurementDevice) Device(org.opensmartgridplatform.domain.core.entities.Device) Transactional(org.springframework.transaction.annotation.Transactional)

Example 7 with CommonRequestMessage

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

the class DeviceInstallationService method enqueueStartDeviceTestRequest.

// === START DEVICE TEST ===
@Transactional(value = "transactionManager")
public String enqueueStartDeviceTestRequest(@Identification final String organisationIdentification, @Identification final String deviceIdentification, final int messagePriority) throws FunctionalException {
    LOGGER.debug("Queue start device test request");
    final Organisation organisation = this.domainHelperService.findOrganisation(organisationIdentification);
    final Device device = this.domainHelperService.findActiveDevice(deviceIdentification);
    this.domainHelperService.isAllowed(organisation, device, DeviceFunction.START_SELF_TEST);
    LOGGER.debug("enqueueStartDeviceTestRequest called with organisation {} and device {}", organisationIdentification, deviceIdentification);
    final String correlationUid = this.correlationIdProviderService.getCorrelationId(organisationIdentification, deviceIdentification);
    final MessageMetadata messageMetadata = new MessageMetadata.Builder().withDeviceIdentification(deviceIdentification).withOrganisationIdentification(organisationIdentification).withCorrelationUid(correlationUid).withMessageType(MessageType.START_SELF_TEST.name()).withMessagePriority(messagePriority).build();
    final CommonRequestMessage message = new CommonRequestMessage.Builder().messageMetadata(messageMetadata).build();
    this.commonRequestMessageSender.send(message);
    return correlationUid;
}
Also used : CommonRequestMessage(org.opensmartgridplatform.adapter.ws.core.infra.jms.CommonRequestMessage) MessageMetadata(org.opensmartgridplatform.shared.infra.jms.MessageMetadata) Organisation(org.opensmartgridplatform.domain.core.entities.Organisation) LightMeasurementDevice(org.opensmartgridplatform.domain.core.entities.LightMeasurementDevice) Device(org.opensmartgridplatform.domain.core.entities.Device) Transactional(org.springframework.transaction.annotation.Transactional)

Example 8 with CommonRequestMessage

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

the class DeviceInstallationService method enqueueGetStatusRequest.

// === GET STATUS ===
@Transactional(value = "transactionManager")
public String enqueueGetStatusRequest(@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("enqueueGetStatusRequest called with organisation {} and device {}", organisationIdentification, deviceIdentification);
    final String correlationUid = this.correlationIdProviderService.getCorrelationId(organisationIdentification, deviceIdentification);
    final MessageMetadata messageMetadata = new MessageMetadata.Builder().withDeviceIdentification(deviceIdentification).withOrganisationIdentification(organisationIdentification).withCorrelationUid(correlationUid).withMessageType(MessageType.GET_STATUS.name()).withMessagePriority(messagePriority).build();
    final CommonRequestMessage message = new CommonRequestMessage.Builder().messageMetadata(messageMetadata).build();
    this.commonRequestMessageSender.send(message);
    return correlationUid;
}
Also used : CommonRequestMessage(org.opensmartgridplatform.adapter.ws.core.infra.jms.CommonRequestMessage) MessageMetadata(org.opensmartgridplatform.shared.infra.jms.MessageMetadata) Organisation(org.opensmartgridplatform.domain.core.entities.Organisation) LightMeasurementDevice(org.opensmartgridplatform.domain.core.entities.LightMeasurementDevice) Device(org.opensmartgridplatform.domain.core.entities.Device) Transactional(org.springframework.transaction.annotation.Transactional)

Example 9 with CommonRequestMessage

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

the class ConfigurationManagementService method enqueueSetConfigurationRequest.

public String enqueueSetConfigurationRequest(@Identification final String organisationIdentification, @Identification final String deviceIdentification, @Valid final Configuration configuration, 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_CONFIGURATION);
    this.domainHelperService.isInMaintenance(device);
    LOGGER.debug("enqueueSetConfigurationRequest called with organisation {} and device {}", organisationIdentification, deviceIdentification);
    final String correlationUid = this.correlationIdProviderService.getCorrelationId(organisationIdentification, deviceIdentification);
    final MessageMetadata messageMetadata = new MessageMetadata.Builder().withDeviceIdentification(deviceIdentification).withOrganisationIdentification(organisationIdentification).withCorrelationUid(correlationUid).withMessageType(MessageType.SET_CONFIGURATION.name()).withMessagePriority(messagePriority).withScheduleTime(scheduledTime == null ? null : scheduledTime.getMillis()).build();
    final CommonRequestMessage message = new CommonRequestMessage.Builder().messageMetadata(messageMetadata).request(configuration).build();
    this.commonRequestMessageSender.send(message);
    return correlationUid;
}
Also used : CommonRequestMessage(org.opensmartgridplatform.adapter.ws.core.infra.jms.CommonRequestMessage) MessageMetadata(org.opensmartgridplatform.shared.infra.jms.MessageMetadata) Organisation(org.opensmartgridplatform.domain.core.entities.Organisation) Device(org.opensmartgridplatform.domain.core.entities.Device)

Example 10 with CommonRequestMessage

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

the class ConfigurationManagementService method enqueueSwitchConfigurationRequest.

public String enqueueSwitchConfigurationRequest(final String organisationIdentification, final String deviceIdentification, final String configurationBank, 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.SWITCH_CONFIGURATION_BANK);
    this.domainHelperService.isInMaintenance(device);
    LOGGER.debug("enqueueGetConfigurationRequest called with organisation {} and device {}", organisationIdentification, deviceIdentification);
    final String correlationUid = this.correlationIdProviderService.getCorrelationId(organisationIdentification, deviceIdentification);
    final MessageMetadata messageMetadata = new MessageMetadata.Builder().withDeviceIdentification(deviceIdentification).withOrganisationIdentification(organisationIdentification).withCorrelationUid(correlationUid).withMessageType(MessageType.SWITCH_CONFIGURATION_BANK.name()).withMessagePriority(messagePriority).build();
    final CommonRequestMessage message = new CommonRequestMessage.Builder().messageMetadata(messageMetadata).request(configurationBank).build();
    this.commonRequestMessageSender.send(message);
    return correlationUid;
}
Also used : CommonRequestMessage(org.opensmartgridplatform.adapter.ws.core.infra.jms.CommonRequestMessage) MessageMetadata(org.opensmartgridplatform.shared.infra.jms.MessageMetadata) Organisation(org.opensmartgridplatform.domain.core.entities.Organisation) Device(org.opensmartgridplatform.domain.core.entities.Device)

Aggregations

CommonRequestMessage (org.opensmartgridplatform.adapter.ws.core.infra.jms.CommonRequestMessage)15 Device (org.opensmartgridplatform.domain.core.entities.Device)15 Organisation (org.opensmartgridplatform.domain.core.entities.Organisation)15 MessageMetadata (org.opensmartgridplatform.shared.infra.jms.MessageMetadata)15 Transactional (org.springframework.transaction.annotation.Transactional)4 LightMeasurementDevice (org.opensmartgridplatform.domain.core.entities.LightMeasurementDevice)3 EventNotificationMessageDataContainer (org.opensmartgridplatform.domain.core.valueobjects.EventNotificationMessageDataContainer)1