Skip to content

Commit c8e2bd4

Browse files
refactor(client): replace deprecated /profile API with graphSpace list/get logic
Remove reliance on the removed '/profile' endpoint && Implement manual aggregation by listing all GraphSpaces and fetching details individually.
1 parent 49fa718 commit c8e2bd4

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

hugegraph-client/src/main/java/org/apache/hugegraph/api/space/GraphSpaceAPI.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import org.apache.hugegraph.util.JsonUtil;
2929

3030
import java.util.ArrayList;
31+
import java.util.Collections;
3132
import java.util.HashMap;
3233
import java.util.LinkedHashMap;
3334
import java.util.List;
@@ -71,15 +72,16 @@ public List<String> list() {
7172
}
7273

7374
public List<Map<String, Object>> listProfile(String prefix) {
74-
String profilePath = joinPath(this.path(), "profile");
75-
Map<String, Object> params = new LinkedHashMap<>();
76-
params.put("prefix", prefix);
77-
RestResult result = this.client.get(profilePath, params);
78-
List<Map> results = result.readList(Map.class);
75+
List<String> names = this.list();
7976
List<Map<String, Object>> profiles = new ArrayList<>();
80-
for (Object entry : results) {
81-
profiles.add(JsonUtil.fromJson(JsonUtil.toJson(entry), Map.class));
77+
for (String name : names) {
78+
if (name.startsWith(prefix)) {
79+
GraphSpace space = this.get(name);
80+
Map<String, Object> profileMap = JsonUtil.fromJson(JsonUtil.toJson(space), Map.class);
81+
profiles.add(profileMap);
82+
}
8283
}
84+
8385
return profiles;
8486
}
8587

0 commit comments

Comments
 (0)