Search in sources :

Example 6 with AdministrativeStatusType

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);
}
Also used : AdministrativeStatusType(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.AdministrativeStatusType)

Example 7 with 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());
}
Also used : AdministrativeStatusType(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.AdministrativeStatusType) ResponseMessage(org.opensmartgridplatform.shared.infra.jms.ResponseMessage) ResponseMessageResultType(org.opensmartgridplatform.shared.infra.jms.ResponseMessageResultType)

Example 8 with AdministrativeStatusType

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());
}
Also used : AdministrativeStatusType(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.AdministrativeStatusType) Test(org.junit.jupiter.api.Test)

Aggregations

AdministrativeStatusType (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.AdministrativeStatusType)8 Test (org.junit.jupiter.api.Test)5 AdministrativeStatusTypeDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.AdministrativeStatusTypeDto)4 ResponseMessage (org.opensmartgridplatform.shared.infra.jms.ResponseMessage)1 ResponseMessageResultType (org.opensmartgridplatform.shared.infra.jms.ResponseMessageResultType)1