use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.AdministrativeStatusType in project open-smart-grid-platform by OSGP.
the class GetAdministrativeStatusRequestMessageProcessor method handleMessage.
@Override
protected void handleMessage(final MessageMetadata deviceMessageMetadata, final Object dataObject) throws FunctionalException {
final AdministrativeStatusType administrativeStatusType = (AdministrativeStatusType) dataObject;
this.configurationService.getAdministrativeStatus(deviceMessageMetadata, administrativeStatusType);
}
use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.AdministrativeStatusType in project open-smart-grid-platform by OSGP.
the class ConfigurationService method handleGetAdministrativeStatusResponse.
public void handleGetAdministrativeStatusResponse(final MessageMetadata messageMetadata, final ResponseMessageResultType responseMessageResultType, final OsgpException osgpException, final AdministrativeStatusTypeDto administrativeStatusTypeDto) {
log.info("handleGetAdministrativeStatusResponse for MessageType: {}, with result: {}", messageMetadata.getMessageType(), responseMessageResultType);
ResponseMessageResultType result = responseMessageResultType;
if (osgpException != null) {
log.error(DEVICE_RESPONSE_NOT_OK_LOG_MSG, osgpException);
result = ResponseMessageResultType.NOT_OK;
}
final AdministrativeStatusType administrativeStatusType = this.configurationMapper.map(administrativeStatusTypeDto, AdministrativeStatusType.class);
final ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder().withMessageMetadata(messageMetadata).withResult(result).withOsgpException(osgpException).withDataObject(administrativeStatusType).build();
this.webServiceResponseMessageSender.send(responseMessage, messageMetadata.getMessageType());
}
use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.AdministrativeStatusType in project open-smart-grid-platform by OSGP.
the class AdministrativeStatusTypeMappingTest method testMappingTheOtherWay.
/**
* Both objects have the same name, but are in different packages. Mapping needs to be
* bidirectional, so this tests mapping the other way round.
*/
@Test
public void testMappingTheOtherWay() {
// actual mapping
final AdministrativeStatusType undefined = this.configurationMapper.map(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.AdministrativeStatusType.UNDEFINED, AdministrativeStatusType.class);
final AdministrativeStatusType off = this.configurationMapper.map(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.AdministrativeStatusType.OFF, AdministrativeStatusType.class);
final AdministrativeStatusType on = this.configurationMapper.map(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.AdministrativeStatusType.ON, AdministrativeStatusType.class);
// check mapping
assertThat(undefined).isNotNull();
assertThat(off).isNotNull();
assertThat(on).isNotNull();
assertThat(undefined.name()).isEqualTo(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.AdministrativeStatusType.UNDEFINED.name());
assertThat(off.name()).isEqualTo(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.AdministrativeStatusType.OFF.name());
assertThat(on.name()).isEqualTo(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.AdministrativeStatusType.ON.name());
}
Aggregations