use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.management.EventLogCategory in project open-smart-grid-platform by OSGP.
the class FindEventsRequestDataFactory method fromParameterMap.
public static FindEventsRequestData fromParameterMap(final Map<String, String> requestParameters) {
final EventLogCategory eventLogCategory = EventLogCategory.fromValue(getString(requestParameters, PlatformSmartmeteringKeys.EVENT_TYPE));
final XMLGregorianCalendar beginDate = createXMLGregorianCalendar(requestParameters, PlatformSmartmeteringKeys.KEY_BEGIN_DATE);
final XMLGregorianCalendar endDate = createXMLGregorianCalendar(requestParameters, PlatformSmartmeteringKeys.KEY_END_DATE);
final FindEventsRequestData findEventsRequestData = new FindEventsRequestData();
findEventsRequestData.setEventLogCategory(eventLogCategory);
findEventsRequestData.setFrom(beginDate);
findEventsRequestData.setUntil(endDate);
return findEventsRequestData;
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.management.EventLogCategory in project open-smart-grid-platform by OSGP.
the class EventConverter method convertFrom.
@Override
public Event convertFrom(final org.opensmartgridplatform.adapter.ws.schema.smartmetering.management.Event source, final Type<Event> destinationType, final MappingContext context) {
if (source == null) {
return null;
}
final DateTime timestamp = new DateTime(source.getTimestamp().toGregorianCalendar().getTime());
final org.opensmartgridplatform.domain.core.valueobjects.smartmetering.EventLogCategory eventLogCategory = org.opensmartgridplatform.domain.core.valueobjects.smartmetering.EventLogCategory.fromValue(source.getEventLogCategory().value());
final org.opensmartgridplatform.domain.core.valueobjects.smartmetering.EventType eventType = org.opensmartgridplatform.domain.core.valueobjects.smartmetering.EventType.fromValue(source.getEventType().value());
final List<EventDetail> eventDetails = source.getEventDetails().stream().map(sourceEventDetail -> new EventDetail(sourceEventDetail.getName(), sourceEventDetail.getValue())).collect(Collectors.toList());
return new Event(timestamp, eventType, source.getEventCounter(), eventLogCategory, eventDetails);
}
Aggregations