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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations