use of org.opensmartgridplatform.adapter.ws.core.infra.jms.CommonRequestMessage in project open-smart-grid-platform by OSGP.
the class DeviceManagementService method enqueueSetEventNotificationsRequest.
// === SET EVENT NOTIFICATIONS ===
@Transactional(value = "transactionManager")
public String enqueueSetEventNotificationsRequest(@Identification final String organisationIdentification, @Identification final String deviceIdentification, final List<EventNotificationType> eventNotifications, 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_EVENT_NOTIFICATIONS);
this.domainHelperService.isInMaintenance(device);
LOGGER.debug("enqueueSetEventNotificationsRequest called with organisation {} and device {}", organisationIdentification, deviceIdentification);
final String correlationUid = this.correlationIdProviderService.getCorrelationId(organisationIdentification, deviceIdentification);
final EventNotificationMessageDataContainer eventNotificationMessageDataContainer = new EventNotificationMessageDataContainer(eventNotifications);
final MessageMetadata messageMetadata = new MessageMetadata.Builder().withDeviceIdentification(deviceIdentification).withOrganisationIdentification(organisationIdentification).withCorrelationUid(correlationUid).withMessageType(MessageType.SET_EVENT_NOTIFICATIONS.name()).withMessagePriority(messagePriority).build();
final CommonRequestMessage message = new CommonRequestMessage.Builder().messageMetadata(messageMetadata).request(eventNotificationMessageDataContainer).build();
this.commonRequestMessageSender.send(message);
return correlationUid;
}
use of org.opensmartgridplatform.adapter.ws.core.infra.jms.CommonRequestMessage in project open-smart-grid-platform by OSGP.
the class DeviceManagementService method enqueueSetDeviceVerificationKeyRequest.
public String enqueueSetDeviceVerificationKeyRequest(final String organisationIdentification, final String deviceIdentification, final String verificationKey, 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_DEVICE_VERIFICATION_KEY);
this.domainHelperService.isInMaintenance(device);
LOGGER.debug("enqueueSetDeviceVerificationKeyRequest 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_DEVICE_VERIFICATION_KEY.name()).withMessagePriority(messagePriority).build();
final CommonRequestMessage message = new CommonRequestMessage.Builder().messageMetadata(messageMetadata).request(verificationKey).build();
this.commonRequestMessageSender.send(message);
return correlationUid;
}
use of org.opensmartgridplatform.adapter.ws.core.infra.jms.CommonRequestMessage in project open-smart-grid-platform by OSGP.
the class DeviceManagementService method enqueueUpdateDeviceSslCertificationRequest.
public String enqueueUpdateDeviceSslCertificationRequest(final String organisationIdentification, final String deviceIdentification, final Certification certification, 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.UPDATE_DEVICE_SSL_CERTIFICATION);
this.domainHelperService.isInMaintenance(device);
LOGGER.debug("enqueueUpdateDeviceSslCertificationRequest 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.UPDATE_DEVICE_SSL_CERTIFICATION.name()).withMessagePriority(messagePriority).build();
final CommonRequestMessage message = new CommonRequestMessage.Builder().messageMetadata(messageMetadata).request(certification).build();
this.commonRequestMessageSender.send(message);
return correlationUid;
}
use of org.opensmartgridplatform.adapter.ws.core.infra.jms.CommonRequestMessage in project open-smart-grid-platform by OSGP.
the class AdHocManagementService method enqueueSetRebootRequest.
public String enqueueSetRebootRequest(@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.SET_REBOOT);
this.domainHelperService.isInMaintenance(device);
LOGGER.debug("enqueueSetRebootRequest 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.SET_REBOOT.name()).withMessagePriority(messagePriority).build();
final CommonRequestMessage message = new CommonRequestMessage.Builder().messageMetadata(deviceMessageMetadata).build();
this.commonRequestMessageSender.send(message);
return correlationUid;
}
use of org.opensmartgridplatform.adapter.ws.core.infra.jms.CommonRequestMessage in project open-smart-grid-platform by OSGP.
the class ConfigurationManagementService method enqueueGetConfigurationRequest.
public String enqueueGetConfigurationRequest(@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_CONFIGURATION);
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.GET_CONFIGURATION.name()).withMessagePriority(messagePriority).build();
final CommonRequestMessage message = new CommonRequestMessage.Builder().messageMetadata(messageMetadata).build();
this.commonRequestMessageSender.send(message);
return correlationUid;
}
Aggregations