use of org.opensmartgridplatform.adapter.ws.core.infra.jms.CommonRequestMessage in project open-smart-grid-platform by OSGP.
the class FirmwareManagementService method enqueueSwitchFirmwareRequest.
public String enqueueSwitchFirmwareRequest(final String organisationIdentification, final String deviceIdentification, final String version, 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_FIRMWARE);
this.domainHelperService.isInMaintenance(device);
LOGGER.debug("enqueueSwitchFirmwareRequest 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_FIRMWARE.name()).withMessagePriority(messagePriority).build();
final CommonRequestMessage message = new CommonRequestMessage.Builder().messageMetadata(messageMetadata).request(version).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 FirmwareManagementService method enqueueGetFirmwareRequest.
public String enqueueGetFirmwareRequest(@Identification final String organisationIdentification, @Identification final String deviceIdentification, final int messagePriority) throws FunctionalException {
LOGGER.debug("Queue get firmware request");
final Organisation organisation = this.domainHelperService.findOrganisation(organisationIdentification);
final Device device = this.domainHelperService.findActiveDevice(deviceIdentification);
this.domainHelperService.isAllowed(organisation, device, DeviceFunction.GET_FIRMWARE_VERSION);
this.domainHelperService.isInMaintenance(device);
LOGGER.debug("enqueueGetFirmwareRequest 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_FIRMWARE_VERSION.name()).withMessagePriority(messagePriority).build();
final CommonRequestMessage message = new CommonRequestMessage.Builder().messageMetadata(messageMetadata).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 FirmwareManagementService method enqueueUpdateFirmwareRequest.
public String enqueueUpdateFirmwareRequest(@Identification final String organisationIdentification, @Identification final String deviceIdentification, final FirmwareUpdateMessageDataContainer firmwareUpdateMessageDataContainer, final DateTime scheduledTime, final int messagePriority) throws FunctionalException {
LOGGER.debug("Queue update firmware request");
final Organisation organisation = this.domainHelperService.findOrganisation(organisationIdentification);
final Device device = this.domainHelperService.findActiveDevice(deviceIdentification);
this.domainHelperService.isAllowed(organisation, device, DeviceFunction.UPDATE_FIRMWARE);
this.domainHelperService.isInMaintenance(device);
LOGGER.debug("enqueueUpdateFirmwareRequest 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_FIRMWARE.name()).withMessagePriority(messagePriority).withScheduleTime(scheduledTime == null ? null : scheduledTime.getMillis()).build();
final CommonRequestMessage message = new CommonRequestMessage.Builder().messageMetadata(messageMetadata).request(firmwareUpdateMessageDataContainer).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 enqueueSetDeviceLifecycleStatusRequest.
public String enqueueSetDeviceLifecycleStatusRequest(final String organisationIdentification, final String deviceIdentification, final DeviceLifecycleStatus deviceLifecycleStatus) throws FunctionalException {
final Organisation organisation = this.domainHelperService.findOrganisation(organisationIdentification);
final Device device = this.deviceDomainService.searchDevice(deviceIdentification);
this.domainHelperService.isAllowed(organisation, device, DeviceFunction.SET_DEVICE_LIFECYCLE_STATUS);
LOGGER.debug("enqueueSetDeviceLifecycleStatusRequest called with organisation {}, deviceLifecycleStatus {} and deviceIdentifcation {}", organisationIdentification, deviceLifecycleStatus.name(), deviceIdentification);
final String correlationUid = this.correlationIdProviderService.getCorrelationId(organisationIdentification, deviceIdentification);
final org.opensmartgridplatform.domain.core.valueobjects.DeviceLifecycleStatus newDeviceLifecycleStatus = org.opensmartgridplatform.domain.core.valueobjects.DeviceLifecycleStatus.valueOf(deviceLifecycleStatus.name());
final MessageMetadata messageMetadata = new MessageMetadata.Builder().withDeviceIdentification(deviceIdentification).withOrganisationIdentification(organisationIdentification).withCorrelationUid(correlationUid).withMessageType(MessageType.SET_DEVICE_LIFECYCLE_STATUS.name()).build();
final CommonRequestMessage message = new CommonRequestMessage.Builder().messageMetadata(messageMetadata).request(newDeviceLifecycleStatus).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 enqueueUpdateDeviceCdmaSettingsRequest.
public String enqueueUpdateDeviceCdmaSettingsRequest(final String organisationIdentification, final String deviceIdentification, final CdmaSettings cdmaSettings) throws FunctionalException {
final Organisation organisation = this.domainHelperService.findOrganisation(organisationIdentification);
final Device device = this.deviceDomainService.searchDevice(deviceIdentification);
this.domainHelperService.isAllowed(organisation, device, DeviceFunction.UPDATE_DEVICE_CDMA_SETTINGS);
LOGGER.debug("enqueueUpdateDeviceCdmaSettingsRequest called with organisation {}, deviceIdentification {}, and {}", organisationIdentification, deviceIdentification, cdmaSettings);
final String correlationUid = this.correlationIdProviderService.getCorrelationId(organisationIdentification, deviceIdentification);
final MessageMetadata messageMetadata = new MessageMetadata.Builder().withDeviceIdentification(deviceIdentification).withOrganisationIdentification(organisationIdentification).withCorrelationUid(correlationUid).withMessageType(MessageType.UPDATE_DEVICE_CDMA_SETTINGS.name()).build();
final CommonRequestMessage message = new CommonRequestMessage.Builder().messageMetadata(messageMetadata).request(cdmaSettings).build();
this.commonRequestMessageSender.send(message);
return correlationUid;
}
Aggregations