use of org.opensmartgridplatform.shared.exceptionhandling.OsgpException in project open-smart-grid-platform by OSGP.
the class MonitoringEndpoint method getPQValuesPeriodicAsync.
@PayloadRoot(localPart = "GetPQValuesPeriodicAsyncRequest", namespace = NAMESPACE)
@ResponsePayload
public GetPQValuesPeriodicResponse getPQValuesPeriodicAsync(@OrganisationIdentification final String organisationIdentification, @RequestPayload final GetPQValuesPeriodicAsyncRequest request) throws OsgpException {
LOGGER.info("Get PQ Values Periodic Response received from organisation: {} for correlationUid: {}.", organisationIdentification, request.getAsyncRequest().getCorrelationUid());
GetPQValuesPeriodicResponse response = new GetPQValuesPeriodicResponse();
try {
final org.opensmartgridplatform.domain.da.valueobjects.GetPQValuesResponse dataResponse = this.service.dequeueGetPQValuesPeriodicResponse(request.getAsyncRequest().getCorrelationUid());
if (dataResponse != null) {
response = this.mapper.map(dataResponse, GetPQValuesPeriodicResponse.class);
response.setResult(OsgpResultType.OK);
} else {
response.setResult(OsgpResultType.NOT_FOUND);
}
} catch (final ResponseNotFoundException e) {
LOGGER.warn("ResponseNotFoundException for getPQValuesPeriodicAsync", e);
response.setResult(OsgpResultType.NOT_FOUND);
} catch (final Exception e) {
this.handleException(LOGGER, e);
}
response.setDeviceIdentification(request.getAsyncRequest().getDeviceId());
return response;
}
use of org.opensmartgridplatform.shared.exceptionhandling.OsgpException in project open-smart-grid-platform by OSGP.
the class MonitoringEndpoint method getPQValues.
@PayloadRoot(localPart = "GetPQValuesRequest", namespace = NAMESPACE)
@ResponsePayload
public GetPQValuesAsyncResponse getPQValues(@OrganisationIdentification final String organisationIdentification, @RequestPayload final GetPQValuesRequest request) throws OsgpException {
LOGGER.info("Get PQ Values Request received from organisation: {} for device: {}.", organisationIdentification, request.getDeviceIdentification());
final GetPQValuesAsyncResponse response = new GetPQValuesAsyncResponse();
try {
final org.opensmartgridplatform.domain.da.valueobjects.GetPQValuesRequest getPQValue = this.mapper.map(request, org.opensmartgridplatform.domain.da.valueobjects.GetPQValuesRequest.class);
final String correlationUid = this.service.enqueueGetPQValuesRequest(organisationIdentification, request.getDeviceIdentification(), getPQValue);
final AsyncResponse asyncResponse = new AsyncResponse();
asyncResponse.setCorrelationUid(correlationUid);
asyncResponse.setDeviceId(request.getDeviceIdentification());
response.setAsyncResponse(asyncResponse);
} catch (final Exception e) {
this.handleException(LOGGER, e);
}
return response;
}
use of org.opensmartgridplatform.shared.exceptionhandling.OsgpException in project open-smart-grid-platform by OSGP.
the class MonitoringEndpoint method getPQValuesAsync.
@PayloadRoot(localPart = "GetPQValuesAsyncRequest", namespace = NAMESPACE)
@ResponsePayload
public GetPQValuesResponse getPQValuesAsync(@OrganisationIdentification final String organisationIdentification, @RequestPayload final GetPQValuesAsyncRequest request) throws OsgpException {
LOGGER.info("Get PQ Values Response received from organisation: {} for correlationUid: {}.", organisationIdentification, request.getAsyncRequest().getCorrelationUid());
GetPQValuesResponse response = new GetPQValuesResponse();
try {
final org.opensmartgridplatform.domain.da.valueobjects.GetPQValuesResponse dataResponse = this.service.dequeueGetPQValuesResponse(request.getAsyncRequest().getCorrelationUid());
if (dataResponse != null) {
response = this.mapper.map(dataResponse, GetPQValuesResponse.class);
response.setResult(OsgpResultType.OK);
} else {
response.setResult(OsgpResultType.NOT_FOUND);
}
} catch (final ResponseNotFoundException e) {
LOGGER.warn("ResponseNotFoundException for getGetDataResponse", e);
response.setResult(OsgpResultType.NOT_FOUND);
} catch (final Exception e) {
this.handleException(LOGGER, e);
}
response.setDeviceIdentification(request.getAsyncRequest().getDeviceId());
return response;
}
use of org.opensmartgridplatform.shared.exceptionhandling.OsgpException in project open-smart-grid-platform by OSGP.
the class AdHocManagementEndpoint method getGetDataResponse.
@PayloadRoot(localPart = "GetDataAsyncRequest", namespace = NAMESPACE)
@ResponsePayload
public GetDataResponse getGetDataResponse(@OrganisationIdentification final String organisationIdentification, @RequestPayload final GetDataAsyncRequest request) throws OsgpException {
LOGGER.info("Get Data Response received from organisation: {} for correlationUid: {}.", organisationIdentification, request.getAsyncRequest().getCorrelationUid());
GetDataResponse response = new GetDataResponse();
try {
final org.opensmartgridplatform.domain.microgrids.valueobjects.GetDataResponse dataResponse = this.service.dequeueGetDataResponse(request.getAsyncRequest().getCorrelationUid());
if (dataResponse != null) {
response = this.mapper.map(dataResponse, GetDataResponse.class);
response.setResult(OsgpResultType.OK);
} else {
response.setResult(OsgpResultType.NOT_FOUND);
}
} catch (final ResponseNotFoundException e) {
LOGGER.warn("ResponseNotFoundException for getGetDataResponse", e);
response.setResult(OsgpResultType.NOT_FOUND);
} catch (final Exception e) {
this.handleException(e);
}
return response;
}
use of org.opensmartgridplatform.shared.exceptionhandling.OsgpException in project open-smart-grid-platform by OSGP.
the class AdHocManagementEndpoint method getSetDataResponse.
@PayloadRoot(localPart = "SetDataAsyncRequest", namespace = NAMESPACE)
@ResponsePayload
public SetDataResponse getSetDataResponse(@OrganisationIdentification final String organisationIdentification, @RequestPayload final SetDataAsyncRequest request) throws OsgpException {
LOGGER.info("Get Set Data Response received from organisation: {} with correlationUid: {}.", organisationIdentification, request.getAsyncRequest().getCorrelationUid());
final SetDataResponse response = new SetDataResponse();
try {
final EmptyResponse setDataResponse = this.service.dequeueSetDataResponse(request.getAsyncRequest().getCorrelationUid());
if (setDataResponse != null) {
response.setResult(OsgpResultType.OK);
} else {
response.setResult(OsgpResultType.NOT_FOUND);
}
} catch (final ResponseNotFoundException e) {
LOGGER.warn("ResponseNotFoundException for getSetDataResponse", e);
response.setResult(OsgpResultType.NOT_FOUND);
} catch (final Exception e) {
this.handleException(e);
}
return response;
}
Aggregations