use of org.opensmartgridplatform.domain.core.valueobjects.TransitionType in project open-smart-grid-platform by OSGP.
the class AdHocManagementService method handleLightMeasurementDeviceTransition.
// === TRANSITION MESSAGE FROM LIGHT MEASUREMENT DEVICE ===
/**
* Send transition message to SSLD's based on light measurement device trigger.
*
* @param organisationIdentification Organization issuing the request.
* @param correlationUid The generated correlation UID.
* @param event The light measurement {@link Event} for which to trigger transition messages.
*/
public void handleLightMeasurementDeviceTransition(final String organisationIdentification, final String correlationUid, final Event event) {
LightMeasurementDevice lmd = this.lightMeasurementDeviceRepository.findByDeviceIdentification(event.getDeviceIdentification());
if (lmd == null) {
LOGGER.error("No light measurement device found for device identification: {}", event.getDeviceIdentification());
return;
}
// Update last communication time for the LMD.
lmd = this.updateLmdLastCommunicationTime(lmd);
// Determine if the event is a duplicate. If so, quit.
if (this.isDuplicateEvent(event, lmd)) {
LOGGER.info("Duplicate event detected for light measurement device: {}. Event[id:{} {} {} {} {}]", lmd.getDeviceIdentification(), event.getId(), event.getDateTime(), event.getDescription(), event.getEventType(), event.getIndex());
return;
}
// Retrieve the devices per mast/segment
final CdmaRun cdmaRun = this.getCdmaDevicesPerMastSegment(lmd);
// Determine the transition type based on the event of the LMD.
final TransitionType transitionType = this.determineTransitionTypeForEvent(event);
// Send SET_TRANSITION messages to the SSLDs.
this.setTransitionService.setTransitionForCdmaRun(cdmaRun, organisationIdentification, correlationUid, transitionType);
}
Aggregations