Search in sources :

Example 1 with DistributionAutomationRequestMessage

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

the class DistributionAutomationService method processRequest.

private String processRequest(final String organisationIdentification, final String deviceIdentification, final Serializable request, final DeviceFunction deviceFunction, final MessageType messageType) throws OsgpException {
    final Organisation organisation = this.domainHelperService.findOrganisation(organisationIdentification);
    final String correlationUid = this.correlationIdProviderService.getCorrelationId(organisationIdentification, deviceIdentification);
    final RtuDevice device = this.domainHelperService.findDevice(deviceIdentification);
    this.domainHelperService.isAllowed(organisation, device, deviceFunction);
    final DistributionAutomationRequestMessage message = new DistributionAutomationRequestMessage(messageType, correlationUid, organisationIdentification, deviceIdentification, request);
    try {
        this.requestMessageSender.send(message);
    } catch (final ArgumentNullOrEmptyException e) {
        throw new TechnicalException(ComponentType.WS_DISTRIBUTION_AUTOMATION, e);
    }
    return correlationUid;
}
Also used : TechnicalException(org.opensmartgridplatform.shared.exceptionhandling.TechnicalException) Organisation(org.opensmartgridplatform.domain.core.entities.Organisation) RtuDevice(org.opensmartgridplatform.domain.core.entities.RtuDevice) ArgumentNullOrEmptyException(org.opensmartgridplatform.domain.core.exceptions.ArgumentNullOrEmptyException) DistributionAutomationRequestMessage(org.opensmartgridplatform.adapter.ws.da.infra.jms.DistributionAutomationRequestMessage)

Example 2 with DistributionAutomationRequestMessage

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

the class DistributionAutomationService method enqueueAddRtuDeviceRequest.

public String enqueueAddRtuDeviceRequest(@Identification final String organisationIdentification, @Identification final String deviceIdentification, final AddRtuDeviceRequest addRtuDeviceRequest) throws OsgpException {
    LOGGER.debug("enqueueAddRtuDeviceRequest called with organisation {} and device {}", organisationIdentification, deviceIdentification);
    final String correlationUid = this.correlationIdProviderService.getCorrelationId(organisationIdentification, deviceIdentification);
    final DistributionAutomationRequestMessage message = new DistributionAutomationRequestMessage(MessageType.ADD_DEVICE, correlationUid, organisationIdentification, deviceIdentification, addRtuDeviceRequest);
    try {
        this.requestMessageSender.send(message);
    } catch (final ArgumentNullOrEmptyException e) {
        throw new TechnicalException(ComponentType.WS_DISTRIBUTION_AUTOMATION, e);
    }
    return correlationUid;
}
Also used : TechnicalException(org.opensmartgridplatform.shared.exceptionhandling.TechnicalException) ArgumentNullOrEmptyException(org.opensmartgridplatform.domain.core.exceptions.ArgumentNullOrEmptyException) DistributionAutomationRequestMessage(org.opensmartgridplatform.adapter.ws.da.infra.jms.DistributionAutomationRequestMessage)

Aggregations

DistributionAutomationRequestMessage (org.opensmartgridplatform.adapter.ws.da.infra.jms.DistributionAutomationRequestMessage)2 ArgumentNullOrEmptyException (org.opensmartgridplatform.domain.core.exceptions.ArgumentNullOrEmptyException)2 TechnicalException (org.opensmartgridplatform.shared.exceptionhandling.TechnicalException)2 Organisation (org.opensmartgridplatform.domain.core.entities.Organisation)1 RtuDevice (org.opensmartgridplatform.domain.core.entities.RtuDevice)1