if (!source.getLatestAlerts().isEmpty()) { List<Document> alerts = new ArrayList<Document>(); for (IDeviceAlert sa : source.getLatestAlerts()) { alerts.add(MongoDeviceAlert.toDocument(sa, true));
public static DeviceAssignmentState copy(IDeviceAssignmentState source) throws SiteWhereException { DeviceAssignmentState target = new DeviceAssignmentState(); target.setLastInteractionDate(source.getLastInteractionDate()); target.setPresenceMissingDate(source.getPresenceMissingDate()); if (source.getLastLocation() != null) { target.setLastLocation(DeviceLocation.copy(source.getLastLocation())); } List<DeviceMeasurement> measurements = new ArrayList<DeviceMeasurement>(); for (IDeviceMeasurement sm : source.getLatestMeasurements()) { measurements.add(DeviceMeasurement.copy(sm)); } target.setLatestMeasurements(measurements); List<DeviceAlert> alerts = new ArrayList<DeviceAlert>(); for (IDeviceAlert sa : source.getLatestAlerts()) { alerts.add(DeviceAlert.copy(sa)); } target.setLatestAlerts(alerts); return target; } }
if (state.getLatestAlerts() != null) { for (IDeviceAlert alert : state.getLatestAlerts()) { builder.addLatestAlerts(marshalDeviceAlert(alert));