Search in sources :

Example 1 with SwitchConfigurationResponse

use of org.opensmartgridplatform.adapter.ws.schema.core.configurationmanagement.SwitchConfigurationResponse in project open-smart-grid-platform by OSGP.

the class ConfigurationManagementEndpoint method getSwitchConfigurationResponse.

@PayloadRoot(localPart = "SwitchConfigurationAsyncRequest", namespace = NAMESPACE)
@ResponsePayload
public SwitchConfigurationResponse getSwitchConfigurationResponse(@OrganisationIdentification final String organisationIdentification, @RequestPayload final SwitchConfigurationAsyncRequest request) throws OsgpException {
    LOGGER.info("Switch Configuration Async Request received from organisation: {} for device: {}.", organisationIdentification, request.getAsyncRequest().getDeviceId());
    final SwitchConfigurationResponse response = new SwitchConfigurationResponse();
    try {
        final ResponseMessage responseMessage = this.getResponseMessage(request.getAsyncRequest());
        if (responseMessage != null) {
            throwExceptionIfResultNotOk(responseMessage, "switching configuration");
            response.setResult(OsgpResultType.fromValue(responseMessage.getResult().getValue()));
        } else {
            LOGGER.debug("Get Configuration data is null");
        }
    } catch (final Exception e) {
        this.handleException(e);
    }
    return response;
}
Also used : SwitchConfigurationResponse(org.opensmartgridplatform.adapter.ws.schema.core.configurationmanagement.SwitchConfigurationResponse) ResponseMessage(org.opensmartgridplatform.shared.infra.jms.ResponseMessage) FunctionalException(org.opensmartgridplatform.shared.exceptionhandling.FunctionalException) ValidationException(org.opensmartgridplatform.domain.core.exceptions.ValidationException) 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)

Aggregations

ConstraintViolationException (javax.validation.ConstraintViolationException)1 SwitchConfigurationResponse (org.opensmartgridplatform.adapter.ws.schema.core.configurationmanagement.SwitchConfigurationResponse)1 ValidationException (org.opensmartgridplatform.domain.core.exceptions.ValidationException)1 FunctionalException (org.opensmartgridplatform.shared.exceptionhandling.FunctionalException)1 OsgpException (org.opensmartgridplatform.shared.exceptionhandling.OsgpException)1 ResponseMessage (org.opensmartgridplatform.shared.infra.jms.ResponseMessage)1 PayloadRoot (org.springframework.ws.server.endpoint.annotation.PayloadRoot)1 ResponsePayload (org.springframework.ws.server.endpoint.annotation.ResponsePayload)1