/** * Create a {@link SolrInputDocument} based on information in * {@link IDeviceMeasurements}. * * @param measurements * @return * @throws SiteWhereException */ public static SolrInputDocument createDocumentFromMeasurements(IDeviceMeasurements measurements) throws SiteWhereException { SolrInputDocument document = new SolrInputDocument(); document.addField(ISolrFields.EVENT_TYPE, SolrEventType.Measurements.name()); addFieldsForEvent(document, measurements); for (String key : measurements.getMeasurements().keySet()) { document.addField(ISolrFields.MEASUREMENT_PREFIX + key, measurements.getMeasurement(key)); } return document; }
/** * Create a {@link SolrInputDocument} based on information in * {@link IDeviceMeasurement}. * * @param mx * @return * @throws SiteWhereException */ public static SolrInputDocument createDocumentFromMeasurement(IDeviceMeasurement mx) throws SiteWhereException { SolrInputDocument document = new SolrInputDocument(); document.addField(ISolrFields.EVENT_TYPE, SolrEventType.Measurement.name()); addFieldsForEvent(document, mx); document.addField(ISolrFields.MX_NAME, mx.getName()); document.addField(ISolrFields.MX_VALUE, mx.getValue()); return document; }
/** * Create a {@link SolrInputDocument} based on information in * {@link IDeviceLocation}. * * @param location * @return * @throws SiteWhereException */ public static SolrInputDocument createDocumentFromLocation(IDeviceLocation location) throws SiteWhereException { SolrInputDocument document = new SolrInputDocument(); document.addField(ISolrFields.EVENT_TYPE, SolrEventType.Location.name()); addFieldsForEvent(document, location); String latLong = "" + location.getLatitude() + ", " + location.getLongitude(); document.addField(ISolrFields.LOCATION, latLong); document.addField(ISolrFields.ELEVATION, location.getElevation()); return document; }
/** * Create a {@link SolrInputDocument} based on information in * {@link IDeviceLocation}. * * @param location * @return * @throws SiteWhereException */ public static SolrInputDocument createDocumentFromLocation(IDeviceLocation location) throws SiteWhereException { SolrInputDocument document = new SolrInputDocument(); document.addField(ISolrFields.EVENT_TYPE, SolrEventType.Location.name()); addFieldsForEvent(document, location); String latLong = "" + location.getLatitude() + ", " + location.getLongitude(); document.addField(ISolrFields.LOCATION, latLong); document.addField(ISolrFields.ELEVATION, location.getElevation()); return document; }
/** * Create a {@link SolrInputDocument} based on information in * {@link IDeviceAlert}. * * @param alert * @return * @throws SiteWhereException */ public static SolrInputDocument createDocumentFromAlert(IDeviceAlert alert) throws SiteWhereException { SolrInputDocument document = new SolrInputDocument(); document.addField(ISolrFields.EVENT_TYPE, SolrEventType.Alert.name()); addFieldsForEvent(document, alert); document.addField(ISolrFields.ALERT_TYPE, alert.getType()); document.addField(ISolrFields.ALERT_MESSAGE, alert.getMessage()); document.addField(ISolrFields.ALERT_LEVEL, alert.getLevel().name()); document.addField(ISolrFields.ALERT_SOURCE, alert.getSource().name()); return document; }
/** * Create a {@link SolrInputDocument} based on information in * {@link IDeviceAlert}. * * @param alert * @return * @throws SiteWhereException */ public static SolrInputDocument createDocumentFromAlert(IDeviceAlert alert) throws SiteWhereException { SolrInputDocument document = new SolrInputDocument(); document.addField(ISolrFields.EVENT_TYPE, SolrEventType.Alert.name()); addFieldsForEvent(document, alert); document.addField(ISolrFields.ALERT_TYPE, alert.getType()); document.addField(ISolrFields.ALERT_MESSAGE, alert.getMessage()); document.addField(ISolrFields.ALERT_LEVEL, alert.getLevel().name()); document.addField(ISolrFields.ALERT_SOURCE, alert.getSource().name()); return document; }