| | 524 | * Gets a list of all OSM id's of the object's parent(s) with a specified key. |
| | 525 | * |
| | 526 | * @param env the environment |
| | 527 | * @param key the OSM key |
| | 528 | * @param keyValue the regex value of the OSM key |
| | 529 | * @return a list of non-null values of the OSM id's from the object's parent(s) |
| | 530 | * @since xxx |
| | 531 | */ |
| | 532 | public static List<Long> parent_osm_ids(final Environment env, String key, String keyValue) { |
| | 533 | if (env.parent == null) { |
| | 534 | if (env.osm != null) { |
| | 535 | final ArrayList<Long> ids = new ArrayList<>(); |
| | 536 | for (IPrimitive parent : env.osm.getReferrers()) { |
| | 537 | Long value = parent.getUniqueId(); |
| | 538 | if (value != null && (key == null || parent.get(key) != null) |
| | 539 | && (keyValue == null || regexp_test(keyValue, parent.get(key)))) { |
| | 540 | ids.add(value); |
| | 541 | } |
| | 542 | } |
| | 543 | return new ArrayList<>(ids); |
| | 544 | } |
| | 545 | return Collections.emptyList(); |
| | 546 | } |
| | 547 | return Collections.singletonList(parent_osm_id(env)); |
| | 548 | } |
| | 549 | |
| | 550 | /** |
| | 551 | * Gets a list of all OSM id's of the object's parent(s) with a specified key. |
| | 552 | * |
| | 553 | * @param env the environment |
| | 554 | * @param key the OSM key |
| | 555 | * @return a list of non-null values of the OSM id's from the object's parent(s) |
| | 556 | * @since xxx |
| | 557 | */ |
| | 558 | public static List<Long> parent_osm_ids(final Environment env, String key) { // NO_UCD (unused code) |
| | 559 | return parent_osm_ids(env, key, null); |
| | 560 | } |
| | 561 | |
| | 562 | /** |
| | 563 | * Gets a list of all OSM id's of the object's parent(s). |
| | 564 | * |
| | 565 | * @param env the environment |
| | 566 | * @return a list of non-null values of the OSM id's from the object's parent(s) |
| | 567 | * @since xxx |
| | 568 | */ |
| | 569 | public static List<Long> parent_osm_ids(final Environment env) { |
| | 570 | return parent_osm_ids(env, null, null); |
| | 571 | } |
| | 572 | |
| | 573 | /** |