/** * PROXY METHOD: do not delete until {@link OnmsGeolocation} is truly a separate table, or projection mapping will fail. */ @Transient @Deprecated @XmlElement public Double getLongitude() { return m_geolocation == null ? null : m_geolocation.getLongitude(); }
@Override public ItemProvider<String> getItemProvider() { return node -> { Double longitude = node.getAssetRecord().getGeolocation().getLongitude(); return longitude == null ? null : longitude.toString(); }; } }),
@Override public Map<Integer, Coordinates> resolve(Collection<Integer> nodeIds) { if (nodeIds == null || nodeIds.isEmpty()) { return new HashMap<>(); // nothing to do } // Lookup all nodes and gather the address string final Criteria criteria = new CriteriaBuilder(OnmsNode.class).in("id", nodeIds).toCriteria(); final Map<Integer, String> nodeIdAddressMap = nodeDao.findMatching(criteria).stream() .filter(n -> getGeoLocation(n) != null) .filter(n -> getGeoLocation(n).getLatitude() == null && getGeoLocation(n).getLongitude() == null) .filter(n -> !Strings.isNullOrEmpty(getGeoLocation(n).asAddressString())) .collect(Collectors.toMap(OnmsNode::getId, n -> n.getAssetRecord().getGeolocation().asAddressString())); return resolve(nodeIdAddressMap); }
@Override public Map<Integer, Coordinates> resolve(Collection<Integer> nodeIds) { if (nodeIds == null || nodeIds.isEmpty()) { return new HashMap<>(); // nothing to do } // Lookup all nodes and gather the address string final Criteria criteria = new CriteriaBuilder(OnmsNode.class).in("id", nodeIds).toCriteria(); final Map<Integer, String> nodeIdAddressMap = nodeDao.findMatching(criteria).stream() .filter(n -> getGeoLocation(n) != null) .filter(n -> getGeoLocation(n).getLatitude() == null && getGeoLocation(n).getLongitude() == null) .filter(n -> !Strings.isNullOrEmpty(getGeoLocation(n).asAddressString())) .collect(Collectors.toMap(OnmsNode::getId, n -> n.getAssetRecord().getGeolocation().asAddressString())); return resolve(nodeIdAddressMap); }
@Override public List<GeolocationInfo> getLocations(GeolocationQuery query) { if (query == null) { return new ArrayList<>(); } final List<OnmsNode> nodes = getNodes(query); final List<GeolocationInfo> nodesWithCoordinates = nodes.stream() .filter(n -> geoLocation(n) != null && geoLocation(n).getLongitude() != null && geoLocation(n).getLatitude() != null) // Avoid including -inf values, just in case. See NMS-9338 .filter(n -> geoLocation(n).getLatitude() != Double.NEGATIVE_INFINITY && geoLocation(n).getLongitude() != Double.NEGATIVE_INFINITY) .map(this::convert) .collect(Collectors.toList()); if (query.getStatusCalculationStrategy() != null) { applyStatus(query, nodesWithCoordinates); } if (query.getSeverity() != null) { OnmsSeverity severity = OnmsSeverity.get(query.getSeverity().getId()); return nodesWithCoordinates.stream() .filter(n -> severity.getId() <= n.getSeverityInfo().getId()) .collect(Collectors.toList()); } return nodesWithCoordinates; }
@Override public List<GeolocationInfo> getLocations(GeolocationQuery query) { if (query == null) { return new ArrayList<>(); } final List<OnmsNode> nodes = getNodes(query); final List<GeolocationInfo> nodesWithCoordinates = nodes.stream() .filter(n -> geoLocation(n) != null && geoLocation(n).getLongitude() != null && geoLocation(n).getLatitude() != null) // Avoid including -inf values, just in case. See NMS-9338 .filter(n -> geoLocation(n).getLatitude() != Double.NEGATIVE_INFINITY && geoLocation(n).getLongitude() != Double.NEGATIVE_INFINITY) .map(this::convert) .collect(Collectors.toList()); if (query.getStatusCalculationStrategy() != null) { applyStatus(query, nodesWithCoordinates); } if (query.getSeverity() != null) { OnmsSeverity severity = OnmsSeverity.get(query.getSeverity().getId()); return nodesWithCoordinates.stream() .filter(n -> severity.getId() <= n.getSeverityInfo().getId()) .collect(Collectors.toList()); } return nodesWithCoordinates; }
@Override public DisplayStatus evaluate(final HttpServletRequest request, final Object target) { if (target instanceof OnmsNode) { final OnmsNode node = (OnmsNode)target; if (node.getAssetRecord() != null && node.getAssetRecord().getGeolocation() != null) { final OnmsGeolocation geolocation = node.getAssetRecord().getGeolocation(); if (geolocation.getLongitude() != null && geolocation.getLatitude() != null) { return DisplayStatus.DISPLAY_LINK; } } } return DisplayStatus.NO_DISPLAY; }
.add("zip", m_geolocation == null ? null : m_geolocation.getZip()) .add("country", m_geolocation == null ? null : m_geolocation.getCountry()) .add("longitude", m_geolocation == null ? null : m_geolocation.getLongitude()) .add("latitude", m_geolocation == null ? null : m_geolocation.getLatitude()) .add("building", getBuilding())
@Override public DisplayStatus evaluate(final HttpServletRequest request, final Object target) { if (target instanceof OnmsNode) { final OnmsNode node = (OnmsNode)target; if (node.getAssetRecord() != null && node.getAssetRecord().getGeolocation() != null) { final OnmsGeolocation geolocation = node.getAssetRecord().getGeolocation(); if (geolocation.getLongitude() != null && geolocation.getLatitude() != null) { return DisplayStatus.DISPLAY_LINK; } } } return DisplayStatus.NO_DISPLAY; }
if (gl !=null){ if (gl.getLatitude() !=null)body.put("asset-latitude", gl.getLatitude().toString()); if (gl.getLongitude()!=null)body.put("asset-longitude", gl.getLongitude().toString());
if (gl !=null){ if (gl.getLatitude() !=null)body.put("asset-latitude", gl.getLatitude().toString()); if (gl.getLongitude()!=null)body.put("asset-longitude", gl.getLongitude().toString());
if (gl !=null){ if (gl.getLatitude() !=null)body.put("asset-latitude", gl.getLatitude().toString()); if (gl.getLongitude()!=null)body.put("asset-longitude", gl.getLongitude().toString());
if (mergeWith.getLongitude() != null) { setLongitude(mergeWith.getLongitude());
if (onmsGeolocation != null) { geolocationInfo.setAddressInfo(toAddressInfo(onmsGeolocation)); if (onmsGeolocation.getLongitude() != null && onmsGeolocation.getLatitude() != null) { geolocationInfo.setCoordinates(new Coordinates(onmsGeolocation.getLongitude(), onmsGeolocation.getLatitude()));
if (onmsGeolocation != null) { geolocationInfo.setAddressInfo(toAddressInfo(onmsGeolocation)); if (onmsGeolocation.getLongitude() != null && onmsGeolocation.getLatitude() != null) { geolocationInfo.setCoordinates(new Coordinates(onmsGeolocation.getLongitude(), onmsGeolocation.getLatitude()));