Skip to content

Commit

Permalink
improve log message
Browse files Browse the repository at this point in the history
Change-Id: Iaf6441969871bb0c71a550e59160078aca7b02e3
  • Loading branch information
Linary committed Sep 16, 2019
1 parent 2efaa84 commit 4bc97f8
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;

import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;

import com.baidu.hugegraph.HugeGraph;
Expand Down Expand Up @@ -107,11 +108,15 @@ public String update(@Context GraphManager manager,
public String list(@Context GraphManager manager,
@PathParam("graph") String graph,
@QueryParam("names") List<String> names) {
LOG.debug("Graph [{}] get edge labels by names {}", graph, names);
if (CollectionUtils.isEmpty(names)) {
LOG.debug("Graph [{}] list edge labels", graph);
} else {
LOG.debug("Graph [{}] get edge labels by names {}", graph, names);
}

HugeGraph g = graph(manager, graph);
List<EdgeLabel> labels;
if (names == null || names.isEmpty()) {
if (CollectionUtils.isEmpty(names)) {
labels = g.schema().getEdgeLabels();
} else {
labels = new ArrayList<>(names.size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;

import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;

import com.baidu.hugegraph.HugeGraph;
Expand Down Expand Up @@ -82,19 +83,23 @@ public String create(@Context GraphManager manager,
public String list(@Context GraphManager manager,
@PathParam("graph") String graph,
@QueryParam("names") List<String> names) {
LOG.debug("Graph [{}] get index labels by names {}", graph, names);
if (CollectionUtils.isEmpty(names)) {
LOG.debug("Graph [{}] list index labels", graph);
} else {
LOG.debug("Graph [{}] get index labels by names {}", graph, names);
}

HugeGraph g = graph(manager, graph);
List<IndexLabel> labels;
if (names == null || names.isEmpty()) {
if (CollectionUtils.isEmpty(names)) {
labels = g.schema().getIndexLabels();
} else {
labels = new ArrayList<>(names.size());
for (String name : names) {
labels.add(g.schema().getIndexLabel(name));
}
}
return manager.serializer(g).writeIndexlabels(labels);
return manager.serializer(g).writeIndexlabels(mapIndexLabels(labels));
}

@GET
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;

import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;

import com.baidu.hugegraph.HugeGraph;
Expand Down Expand Up @@ -108,11 +109,15 @@ public String update(@Context GraphManager manager,
public String list(@Context GraphManager manager,
@PathParam("graph") String graph,
@QueryParam("names") List<String> names) {
LOG.debug("Graph [{}] get property keys by names {}", graph, names);
if (CollectionUtils.isEmpty(names)) {
LOG.debug("Graph [{}] list property keys", graph);
} else {
LOG.debug("Graph [{}] get property keys by names {}", graph, names);
}

HugeGraph g = graph(manager, graph);
List<PropertyKey> propKeys;
if (names == null || names.isEmpty()) {
if (CollectionUtils.isEmpty(names)) {
propKeys = g.schema().getPropertyKeys();
} else {
propKeys = new ArrayList<>(names.size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;

import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;

import com.baidu.hugegraph.HugeGraph;
Expand Down Expand Up @@ -110,11 +111,15 @@ public String update(@Context GraphManager manager,
public String list(@Context GraphManager manager,
@PathParam("graph") String graph,
@QueryParam("names") List<String> names) {
LOG.debug("Graph [{}] get vertex labels by names {}", graph, names);
if (CollectionUtils.isEmpty(names)) {
LOG.debug("Graph [{}] list vertex labels", graph);
} else {
LOG.debug("Graph [{}] get vertex labels by names {}", graph, names);
}

HugeGraph g = graph(manager, graph);
List<VertexLabel> labels;
if (names == null || names.isEmpty()) {
if (CollectionUtils.isEmpty(names)) {
labels = g.schema().getVertexLabels();
} else {
labels = new ArrayList<>(names.size());
Expand Down

0 comments on commit 4bc97f8

Please sign in to comment.