get packages by dependency

This commit is contained in:
Grahame Grieve 2022-05-12 16:19:01 +10:00
parent 9c20a28710
commit eddcaba803
2 changed files with 21 additions and 0 deletions

View File

@ -7637,6 +7637,14 @@ When pattern[x] is used to constrain a complex object, it means that each proper
return hasId() ? getId() : getPath();
}
public boolean hasFixedOrPattern() {
return hasFixed() || hasPattern();
}
public Type getFixedOrPattern() {
return hasFixed() ? getFixed() : getPattern();
}
// end addition
}

View File

@ -242,4 +242,17 @@ public class PackageClient {
return result;
}
public void findDependents(Set<String> list, String id) {
CommaSeparatedStringBuilder params = new CommaSeparatedStringBuilder("&");
params.append("dependency="+id);
try {
JsonArray json = fetchJsonArray(Utilities.pathURL(address, "catalog?")+params.toString());
for (JsonElement e : json) {
JsonObject obj = (JsonObject) e;
list.add(JSONUtil.str(obj, "Name", "name"));
}
} catch (IOException e1) {
}
}
}