Search in sources :

Example 1 with AlarmRegister

use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.AlarmRegister in project open-smart-grid-platform by OSGP.

the class PushNotificationsAlarmConverter method convert.

@Override
public RetrievePushNotificationAlarmResponse convert(final PushNotificationAlarm source, final Type<? extends RetrievePushNotificationAlarmResponse> destinationType, final MappingContext context) {
    if (source == null) {
        return null;
    }
    final RetrievePushNotificationAlarmResponse response = new RetrievePushNotificationAlarmResponse();
    response.setDeviceIdentification(source.getDeviceIdentification());
    final AlarmRegister alarmRegister = new AlarmRegister();
    final List<AlarmType> alarmTypes = alarmRegister.getAlarmTypes();
    final Set<org.opensmartgridplatform.domain.core.valueobjects.smartmetering.AlarmType> alarms = source.getAlarms();
    for (final org.opensmartgridplatform.domain.core.valueobjects.smartmetering.AlarmType alarm : alarms) {
        alarmTypes.add(AlarmType.valueOf(alarm.name()));
    }
    response.setAlarmRegister(alarmRegister);
    return response;
}
Also used : AlarmType(org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.AlarmType) AlarmRegister(org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.AlarmRegister) RetrievePushNotificationAlarmResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.RetrievePushNotificationAlarmResponse)

Aggregations

AlarmType (org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.AlarmType)1 AlarmRegister (org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.AlarmRegister)1 RetrievePushNotificationAlarmResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.RetrievePushNotificationAlarmResponse)1