Search in sources :

Example 16 with AsyncResponse

use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.AsyncResponse in project open-smart-grid-platform by OSGP.

the class SmartMeteringInstallationEndpoint method addDevice.

@PayloadRoot(localPart = "AddDeviceRequest", namespace = SMARTMETER_INSTALLATION_NAMESPACE)
@ResponsePayload
public AddDeviceAsyncResponse addDevice(@OrganisationIdentification final String organisationIdentification, @RequestPayload final AddDeviceRequest request, @MessagePriority final String messagePriority, @ScheduleTime final String scheduleTime, @ResponseUrl final String responseUrl, @BypassRetry final String bypassRetry) throws OsgpException {
    log.info("Incoming AddDeviceRequest for meter: {}.", request.getDevice().getDeviceIdentification());
    AsyncResponse asyncResponse = null;
    try {
        final SmartMeteringDevice device = this.installationMapper.map(request.getDevice(), SmartMeteringDevice.class);
        final DeviceModel deviceModel = new DeviceModel(request.getDeviceModel().getManufacturer(), request.getDeviceModel().getModelCode(), "");
        final AddSmartMeterRequest addSmartMeterRequest = new AddSmartMeterRequest(device, deviceModel);
        final RequestMessageMetadata requestMessageMetadata = RequestMessageMetadata.newBuilder().withOrganisationIdentification(organisationIdentification).withDeviceIdentification(device.getDeviceIdentification()).withDeviceFunction(null).withMessageType(MessageType.ADD_METER).withMessagePriority(messagePriority).withScheduleTime(scheduleTime).withBypassRetry(bypassRetry).build();
        asyncResponse = this.requestService.enqueueAndSendRequest(requestMessageMetadata, addSmartMeterRequest);
        this.saveResponseUrlIfNeeded(asyncResponse.getCorrelationUid(), responseUrl);
    } catch (final ConstraintViolationException e) {
        log.error("Exception: {} while adding device: {} for organisation {}.", e.getMessage(), request.getDevice().getDeviceIdentification(), organisationIdentification, e);
        throw new FunctionalException(FunctionalExceptionType.VALIDATION_ERROR, ComponentType.WS_CORE, new ValidationException(e.getConstraintViolations()));
    } catch (final Exception e) {
        log.error("Exception: {} while adding device: {} for organisation {}.", e.getMessage(), request.getDevice().getDeviceIdentification(), organisationIdentification, e);
        this.handleException(e);
    }
    return this.installationMapper.map(asyncResponse, AddDeviceAsyncResponse.class);
}
Also used : DeviceModel(org.opensmartgridplatform.domain.core.valueobjects.DeviceModel) ValidationException(org.opensmartgridplatform.domain.core.exceptions.ValidationException) ConstraintViolationException(javax.validation.ConstraintViolationException) SmartMeteringDevice(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SmartMeteringDevice) AddSmartMeterRequest(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.AddSmartMeterRequest) FunctionalException(org.opensmartgridplatform.shared.exceptionhandling.FunctionalException) CoupleMbusDeviceByChannelAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.installation.CoupleMbusDeviceByChannelAsyncResponse) AsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.AsyncResponse) AddDeviceAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.installation.AddDeviceAsyncResponse) DecoupleMbusDeviceByChannelAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.installation.DecoupleMbusDeviceByChannelAsyncResponse) DecoupleMbusDeviceAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.installation.DecoupleMbusDeviceAsyncResponse) CoupleMbusDeviceAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.installation.CoupleMbusDeviceAsyncResponse) ValidationException(org.opensmartgridplatform.domain.core.exceptions.ValidationException) FunctionalException(org.opensmartgridplatform.shared.exceptionhandling.FunctionalException) OsgpException(org.opensmartgridplatform.shared.exceptionhandling.OsgpException) ConstraintViolationException(javax.validation.ConstraintViolationException) ResponsePayload(org.springframework.ws.server.endpoint.annotation.ResponsePayload) PayloadRoot(org.springframework.ws.server.endpoint.annotation.PayloadRoot)

Example 17 with AsyncResponse

use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.AsyncResponse in project open-smart-grid-platform by OSGP.

the class SmartMeteringInstallationEndpoint method coupleMbusDeviceByChannel.

/**
 * @param organisationIdentification the organization requesting the coupling of devices
 * @param request the CoupleMbusDeviceByChannelRequest containing the gatewayDeviceIdentification
 *     and channel
 * @param messagePriority the priority of the message
 * @param scheduleTime the time the request is scheduled for
 * @return a response containing a correlationUid and the deviceIdentification
 * @throws OsgpException
 */
@PayloadRoot(localPart = "CoupleMbusDeviceByChannelRequest", namespace = SMARTMETER_INSTALLATION_NAMESPACE)
@ResponsePayload
public CoupleMbusDeviceByChannelAsyncResponse coupleMbusDeviceByChannel(@OrganisationIdentification final String organisationIdentification, @RequestPayload final CoupleMbusDeviceByChannelRequest request, @MessagePriority final String messagePriority, @ScheduleTime final String scheduleTime, @ResponseUrl final String responseUrl, @BypassRetry final String bypassRetry) throws OsgpException {
    final CoupleMbusDeviceByChannelRequestData requestData = new CoupleMbusDeviceByChannelRequestData(request.getCoupleMbusDeviceByChannelRequestData().getChannel());
    final RequestMessageMetadata requestMessageMetadata = RequestMessageMetadata.newBuilder().withOrganisationIdentification(organisationIdentification).withDeviceIdentification(request.getDeviceIdentification()).withDeviceFunction(DeviceFunction.COUPLE_MBUS_DEVICE_BY_CHANNEL).withMessageType(MessageType.COUPLE_MBUS_DEVICE_BY_CHANNEL).withMessagePriority(messagePriority).withScheduleTime(scheduleTime).withBypassRetry(bypassRetry).build();
    final AsyncResponse asyncResponse = this.requestService.enqueueAndSendRequest(requestMessageMetadata, requestData);
    this.saveResponseUrlIfNeeded(asyncResponse.getCorrelationUid(), responseUrl);
    return this.installationMapper.map(asyncResponse, CoupleMbusDeviceByChannelAsyncResponse.class);
}
Also used : CoupleMbusDeviceByChannelRequestData(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.CoupleMbusDeviceByChannelRequestData) CoupleMbusDeviceByChannelAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.installation.CoupleMbusDeviceByChannelAsyncResponse) AsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.AsyncResponse) AddDeviceAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.installation.AddDeviceAsyncResponse) DecoupleMbusDeviceByChannelAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.installation.DecoupleMbusDeviceByChannelAsyncResponse) DecoupleMbusDeviceAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.installation.DecoupleMbusDeviceAsyncResponse) CoupleMbusDeviceAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.installation.CoupleMbusDeviceAsyncResponse) ResponsePayload(org.springframework.ws.server.endpoint.annotation.ResponsePayload) PayloadRoot(org.springframework.ws.server.endpoint.annotation.PayloadRoot)

Example 18 with AsyncResponse

use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.AsyncResponse in project open-smart-grid-platform by OSGP.

the class SmartMeteringInstallationEndpoint method coupleMbusDevice.

/**
 * @param organisationIdentification the organisation requesting the coupling of devices
 * @param request the CoupleMbusDeviceRequest containing the deviceIdentification,
 *     mbusDeviceIdentification and channel
 * @param messagePriority the priority of the message
 * @param scheduleTime the time the request is scheduled for
 * @return a response containing a correlationUid and the deviceIdentification
 * @throws OsgpException
 */
@PayloadRoot(localPart = "CoupleMbusDeviceRequest", namespace = SMARTMETER_INSTALLATION_NAMESPACE)
@ResponsePayload
public CoupleMbusDeviceAsyncResponse coupleMbusDevice(@OrganisationIdentification final String organisationIdentification, @RequestPayload final CoupleMbusDeviceRequest request, @MessagePriority final String messagePriority, @ScheduleTime final String scheduleTime, @ResponseUrl final String responseUrl, @BypassRetry final String bypassRetry) throws OsgpException {
    final CoupleMbusDeviceRequestData requestData = new CoupleMbusDeviceRequestData(request.getMbusDeviceIdentification());
    final RequestMessageMetadata requestMessageMetadata = RequestMessageMetadata.newBuilder().withOrganisationIdentification(organisationIdentification).withDeviceIdentification(request.getDeviceIdentification()).withDeviceFunction(DeviceFunction.COUPLE_MBUS_DEVICE).withMessageType(MessageType.COUPLE_MBUS_DEVICE).withMessagePriority(messagePriority).withScheduleTime(scheduleTime).withBypassRetry(bypassRetry).build();
    final AsyncResponse asyncResponse = this.requestService.enqueueAndSendRequest(requestMessageMetadata, requestData);
    this.saveResponseUrlIfNeeded(asyncResponse.getCorrelationUid(), responseUrl);
    return this.installationMapper.map(asyncResponse, CoupleMbusDeviceAsyncResponse.class);
}
Also used : CoupleMbusDeviceRequestData(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.CoupleMbusDeviceRequestData) CoupleMbusDeviceByChannelAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.installation.CoupleMbusDeviceByChannelAsyncResponse) AsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.AsyncResponse) AddDeviceAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.installation.AddDeviceAsyncResponse) DecoupleMbusDeviceByChannelAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.installation.DecoupleMbusDeviceByChannelAsyncResponse) DecoupleMbusDeviceAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.installation.DecoupleMbusDeviceAsyncResponse) CoupleMbusDeviceAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.installation.CoupleMbusDeviceAsyncResponse) ResponsePayload(org.springframework.ws.server.endpoint.annotation.ResponsePayload) PayloadRoot(org.springframework.ws.server.endpoint.annotation.PayloadRoot)

Example 19 with AsyncResponse

use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.AsyncResponse in project open-smart-grid-platform by OSGP.

the class SmartMeteringInstallationEndpoint method decoupleMbusDevice.

/**
 * @param organisationIdentification the organisation requesting the coupling of devices
 * @param request the DecoupleMbusDeviceRequest containing the deviceIdentification,
 *     mbusDeviceIdentification and channel
 * @param messagePriority the priority of the message
 * @param scheduleTime the time the request is scheduled for
 * @return a response containing a correlationUid and the deviceIdentification
 * @throws OsgpException
 */
@PayloadRoot(localPart = "DecoupleMbusDeviceRequest", namespace = SMARTMETER_INSTALLATION_NAMESPACE)
@ResponsePayload
public DecoupleMbusDeviceAsyncResponse decoupleMbusDevice(@OrganisationIdentification final String organisationIdentification, @RequestPayload final DecoupleMbusDeviceRequest request, @MessagePriority final String messagePriority, @ScheduleTime final String scheduleTime, @ResponseUrl final String responseUrl, @BypassRetry final String bypassRetry) throws OsgpException {
    final DecoupleMbusDeviceRequestData requestData = new DecoupleMbusDeviceRequestData(request.getMbusDeviceIdentification());
    final RequestMessageMetadata requestMessageMetadata = RequestMessageMetadata.newBuilder().withOrganisationIdentification(organisationIdentification).withDeviceIdentification(request.getDeviceIdentification()).withDeviceFunction(DeviceFunction.DECOUPLE_MBUS_DEVICE).withMessageType(MessageType.DECOUPLE_MBUS_DEVICE).withMessagePriority(messagePriority).withScheduleTime(scheduleTime).withBypassRetry(bypassRetry).build();
    final AsyncResponse asyncResponse = this.requestService.enqueueAndSendRequest(requestMessageMetadata, requestData);
    this.saveResponseUrlIfNeeded(asyncResponse.getCorrelationUid(), responseUrl);
    return this.installationMapper.map(asyncResponse, DecoupleMbusDeviceAsyncResponse.class);
}
Also used : DecoupleMbusDeviceRequestData(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.DecoupleMbusDeviceRequestData) CoupleMbusDeviceByChannelAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.installation.CoupleMbusDeviceByChannelAsyncResponse) AsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.AsyncResponse) AddDeviceAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.installation.AddDeviceAsyncResponse) DecoupleMbusDeviceByChannelAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.installation.DecoupleMbusDeviceByChannelAsyncResponse) DecoupleMbusDeviceAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.installation.DecoupleMbusDeviceAsyncResponse) CoupleMbusDeviceAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.installation.CoupleMbusDeviceAsyncResponse) ResponsePayload(org.springframework.ws.server.endpoint.annotation.ResponsePayload) PayloadRoot(org.springframework.ws.server.endpoint.annotation.PayloadRoot)

Example 20 with AsyncResponse

use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.AsyncResponse in project open-smart-grid-platform by OSGP.

the class SmartMeteringMonitoringEndpoint method clearAlarmRegister.

@PayloadRoot(localPart = "ClearAlarmRegisterRequest", namespace = SMARTMETER_MONITORING_NAMESPACE)
@ResponsePayload
public ClearAlarmRegisterAsyncResponse clearAlarmRegister(@OrganisationIdentification final String organisationIdentification, @RequestPayload final ClearAlarmRegisterRequest request, @MessagePriority final String messagePriority, @ScheduleTime final String scheduleTime, @ResponseUrl final String responseUrl, @BypassRetry final String bypassRetry) throws OsgpException {
    final org.opensmartgridplatform.domain.core.valueobjects.smartmetering.ClearAlarmRegisterRequest requestData = this.monitoringMapper.map(request, org.opensmartgridplatform.domain.core.valueobjects.smartmetering.ClearAlarmRegisterRequest.class);
    final RequestMessageMetadata requestMessageMetadata = RequestMessageMetadata.newBuilder().withOrganisationIdentification(organisationIdentification).withDeviceIdentification(request.getDeviceIdentification()).withDeviceFunction(DeviceFunction.CLEAR_ALARM_REGISTER).withMessageType(MessageType.CLEAR_ALARM_REGISTER).withMessagePriority(messagePriority).withScheduleTime(scheduleTime).withBypassRetry(bypassRetry).build();
    final AsyncResponse asyncResponse = this.requestService.enqueueAndSendRequest(requestMessageMetadata, requestData);
    this.saveResponseUrlIfNeeded(asyncResponse.getCorrelationUid(), responseUrl);
    return this.monitoringMapper.map(asyncResponse, ClearAlarmRegisterAsyncResponse.class);
}
Also used : GetPowerQualityProfileAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.GetPowerQualityProfileAsyncResponse) AsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.AsyncResponse) ClearAlarmRegisterAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.ClearAlarmRegisterAsyncResponse) ReadAlarmRegisterAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.ReadAlarmRegisterAsyncResponse) PeriodicMeterReadsGasAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.PeriodicMeterReadsGasAsyncResponse) ActualMeterReadsGasAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.ActualMeterReadsGasAsyncResponse) ActualPowerQualityAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.ActualPowerQualityAsyncResponse) ActualMeterReadsAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.ActualMeterReadsAsyncResponse) PeriodicMeterReadsAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.PeriodicMeterReadsAsyncResponse) ResponsePayload(org.springframework.ws.server.endpoint.annotation.ResponsePayload) PayloadRoot(org.springframework.ws.server.endpoint.annotation.PayloadRoot)

Aggregations

AsyncResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.AsyncResponse)49 PayloadRoot (org.springframework.ws.server.endpoint.annotation.PayloadRoot)48 ResponsePayload (org.springframework.ws.server.endpoint.annotation.ResponsePayload)48 ConfigureDefinableLoadProfileAsyncResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.ConfigureDefinableLoadProfileAsyncResponse)22 GenerateAndReplaceKeysAsyncResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GenerateAndReplaceKeysAsyncResponse)22 GetAdministrativeStatusAsyncResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetAdministrativeStatusAsyncResponse)22 GetConfigurationObjectAsyncResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetConfigurationObjectAsyncResponse)22 GetFirmwareVersionAsyncResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetFirmwareVersionAsyncResponse)22 GetFirmwareVersionGasAsyncResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetFirmwareVersionGasAsyncResponse)22 GetKeysAsyncResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetKeysAsyncResponse)22 GetMbusEncryptionKeyStatusAsyncResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetMbusEncryptionKeyStatusAsyncResponse)22 GetMbusEncryptionKeyStatusByChannelAsyncResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetMbusEncryptionKeyStatusByChannelAsyncResponse)22 ReplaceKeysAsyncResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.ReplaceKeysAsyncResponse)22 SetActivityCalendarAsyncResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SetActivityCalendarAsyncResponse)22 SetAdministrativeStatusAsyncResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SetAdministrativeStatusAsyncResponse)22 SetAlarmNotificationsAsyncResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SetAlarmNotificationsAsyncResponse)22 SetClockConfigurationAsyncResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SetClockConfigurationAsyncResponse)22 SetConfigurationObjectAsyncResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SetConfigurationObjectAsyncResponse)22 SetEncryptionKeyExchangeOnGMeterAsyncResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SetEncryptionKeyExchangeOnGMeterAsyncResponse)22 SetMbusUserKeyByChannelAsyncResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SetMbusUserKeyByChannelAsyncResponse)22