Search in sources :

Example 6 with Configuration

use of org.opensmartgridplatform.domain.core.valueobjects.Configuration in project open-smart-grid-platform by OSGP.

the class CommonSetConfigurationRequestMessageProcessor method processMessage.

@Override
public void processMessage(final ObjectMessage message) {
    LOGGER.debug("Processing common set configuration message");
    String correlationUid = null;
    String messageType = null;
    int messagePriority = MessagePriorityEnum.DEFAULT.getPriority();
    String organisationIdentification = null;
    String deviceIdentification = null;
    Boolean isScheduled = null;
    Long scheduleTime = null;
    try {
        correlationUid = message.getJMSCorrelationID();
        messageType = message.getJMSType();
        messagePriority = message.getJMSPriority();
        organisationIdentification = message.getStringProperty(Constants.ORGANISATION_IDENTIFICATION);
        deviceIdentification = message.getStringProperty(Constants.DEVICE_IDENTIFICATION);
        isScheduled = message.getBooleanProperty(Constants.IS_SCHEDULED);
        if (message.propertyExists(Constants.SCHEDULE_TIME)) {
            scheduleTime = message.getLongProperty(Constants.SCHEDULE_TIME);
        }
    } catch (final JMSException e) {
        LOGGER.error("UNRECOVERABLE ERROR, unable to read ObjectMessage instance, giving up.", e);
        LOGGER.debug("correlationUid: {}", correlationUid);
        LOGGER.debug("messageType: {}", messageType);
        LOGGER.debug("messagePriority: {}", messagePriority);
        LOGGER.debug("organisationIdentification: {}", organisationIdentification);
        LOGGER.debug("deviceIdentification: {}", deviceIdentification);
        LOGGER.debug("isScheduled: {}", isScheduled);
        return;
    }
    try {
        final Configuration configuration = (Configuration) message.getObject();
        LOGGER.info("Calling application service function: {}", messageType);
        final CorrelationIds ids = new CorrelationIds(organisationIdentification, deviceIdentification, correlationUid);
        this.configurationManagementService.setConfiguration(ids, configuration, scheduleTime, messageType, messagePriority);
    } catch (final Exception e) {
        this.handleError(e, correlationUid, organisationIdentification, deviceIdentification, messageType, messagePriority);
    }
}
Also used : Configuration(org.opensmartgridplatform.domain.core.valueobjects.Configuration) JMSException(javax.jms.JMSException) CorrelationIds(org.opensmartgridplatform.shared.infra.jms.CorrelationIds) JMSException(javax.jms.JMSException)

Aggregations

Configuration (org.opensmartgridplatform.domain.core.valueobjects.Configuration)6 FunctionalException (org.opensmartgridplatform.shared.exceptionhandling.FunctionalException)3 OsgpException (org.opensmartgridplatform.shared.exceptionhandling.OsgpException)3 ConstraintViolationException (javax.validation.ConstraintViolationException)2 ValidationException (org.opensmartgridplatform.domain.core.exceptions.ValidationException)2 DaliConfiguration (org.opensmartgridplatform.domain.core.valueobjects.DaliConfiguration)2 RelayConfiguration (org.opensmartgridplatform.domain.core.valueobjects.RelayConfiguration)2 ResponseMessage (org.opensmartgridplatform.shared.infra.jms.ResponseMessage)2 PayloadRoot (org.springframework.ws.server.endpoint.annotation.PayloadRoot)2 ResponsePayload (org.springframework.ws.server.endpoint.annotation.ResponsePayload)2 JMSException (javax.jms.JMSException)1 DateTime (org.joda.time.DateTime)1 Test (org.junit.jupiter.api.Test)1 AsyncResponse (org.opensmartgridplatform.adapter.ws.schema.core.common.AsyncResponse)1 GetConfigurationAsyncResponse (org.opensmartgridplatform.adapter.ws.schema.core.configurationmanagement.GetConfigurationAsyncResponse)1 GetConfigurationResponse (org.opensmartgridplatform.adapter.ws.schema.core.configurationmanagement.GetConfigurationResponse)1 SetConfigurationAsyncResponse (org.opensmartgridplatform.adapter.ws.schema.core.configurationmanagement.SetConfigurationAsyncResponse)1 SwitchConfigurationAsyncResponse (org.opensmartgridplatform.adapter.ws.schema.core.configurationmanagement.SwitchConfigurationAsyncResponse)1 DeviceOutputSetting (org.opensmartgridplatform.domain.core.entities.DeviceOutputSetting)1 Ssld (org.opensmartgridplatform.domain.core.entities.Ssld)1