use of com.baidu.hugegraph.entity.schema.VertexLabelStyle in project incubator-hugegraph-toolchain by apache.
the class VertexLabelService method convert.
private static VertexLabel convert(VertexLabelUpdateEntity entity, HugeClient client) {
if (entity == null) {
return null;
}
Set<String> properties = new HashSet<>();
if (entity.getAppendProperties() != null) {
entity.getAppendProperties().forEach(p -> {
properties.add(p.getName());
});
}
VertexLabel.Builder builder;
builder = client.schema().vertexLabel(entity.getName()).properties(toStringArray(properties)).nullableKeys(toStringArray(properties));
VertexLabel vertexLabel = builder.build();
Map<String, Object> userdata = vertexLabel.userdata();
/*
* The style requires the front end to pass in the full amount
* TODO: use builder or setter, now use builder throw exception
* "Can't access builder which is completed"
*/
VertexLabelStyle style = entity.getStyle();
if (style != null) {
userdata.put(USER_KEY_STYLE, JsonUtil.toJson(style));
}
return vertexLabel;
}
use of com.baidu.hugegraph.entity.schema.VertexLabelStyle in project incubator-hugegraph-toolchain by apache.
the class VertexLabelController method checkDisplayFields.
private static void checkDisplayFields(VertexLabelEntity entity) {
VertexLabelStyle style = entity.getStyle();
List<String> displayFields = style.getDisplayFields();
if (!CollectionUtils.isEmpty(displayFields)) {
Set<String> nullableProps = entity.getNullableProps();
Ex.check(!CollectionUtil.hasIntersection(displayFields, nullableProps), "schema.display-fields.cannot-be-nullable");
}
}
Aggregations