mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-13 13:07:32 +00:00
(improvement)(headless)(chat) Add views and adapt chat and headless (#700)
* (improvement)(headless)(chat) Add views and adapt chat and headless --------- Co-authored-by: jolunoluo
This commit is contained in:
@@ -3,22 +3,11 @@ package com.tencent.supersonic.headless.api.pojo;
|
||||
import com.google.common.collect.Lists;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Data
|
||||
public class AppConfig {
|
||||
|
||||
private List<Item> items = Lists.newArrayList();
|
||||
|
||||
public Set<Item> getAllItems() {
|
||||
Set<Item> itemSet = new HashSet<>();
|
||||
for (Item item : items) {
|
||||
itemSet.add(item);
|
||||
itemSet.addAll(item.getRelateItems());
|
||||
}
|
||||
return itemSet;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,15 @@ public class DrillDownDimension {
|
||||
|
||||
private boolean necessary;
|
||||
|
||||
private boolean inheritedFromModel;
|
||||
|
||||
public DrillDownDimension(Long dimensionId) {
|
||||
this.dimensionId = dimensionId;
|
||||
}
|
||||
|
||||
public DrillDownDimension(Long dimensionId, boolean necessary) {
|
||||
this.dimensionId = dimensionId;
|
||||
this.necessary = necessary;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.tencent.supersonic.headless.api.pojo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class MetricTypeDefaultConfig {
|
||||
|
||||
private TimeDefaultConfig timeDefaultConfig;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.tencent.supersonic.headless.api.pojo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class QueryConfig {
|
||||
|
||||
private TagTypeDefaultConfig tagTypeDefaultConfig = new TagTypeDefaultConfig();
|
||||
|
||||
private MetricTypeDefaultConfig metricTypeDefaultConfig = new MetricTypeDefaultConfig();
|
||||
|
||||
|
||||
}
|
||||
@@ -2,12 +2,12 @@ package com.tencent.supersonic.headless.api.pojo;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.common.collect.Lists;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
public class QueryStat {
|
||||
@@ -15,6 +15,8 @@ public class QueryStat {
|
||||
private Long id;
|
||||
private String traceId;
|
||||
private Long modelId;
|
||||
|
||||
private Long viewId;
|
||||
private String user;
|
||||
private String createdAt;
|
||||
/**
|
||||
@@ -91,6 +93,11 @@ public class QueryStat {
|
||||
return this;
|
||||
}
|
||||
|
||||
public QueryStat setViewId(Long viewId) {
|
||||
this.viewId = viewId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public QueryStat setUser(String user) {
|
||||
this.user = user;
|
||||
return this;
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.tencent.supersonic.headless.api.pojo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class TagTypeDefaultConfig {
|
||||
|
||||
//When displaying tag selection results, the information displayed by default
|
||||
private List<Long> dimensionIds = new ArrayList<>();
|
||||
private List<Long> metricIds = new ArrayList<>();
|
||||
|
||||
//default time to filter tag selection results
|
||||
private TimeDefaultConfig timeDefaultConfig;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.tencent.supersonic.headless.api.pojo;
|
||||
|
||||
|
||||
import com.tencent.supersonic.common.pojo.Constants;
|
||||
import com.tencent.supersonic.common.pojo.enums.TimeMode;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TimeDefaultConfig {
|
||||
|
||||
|
||||
/**
|
||||
* default time span unit
|
||||
*/
|
||||
private Integer unit = 1;
|
||||
|
||||
/**
|
||||
* default time type: day
|
||||
* DAY, WEEK, MONTH, YEAR
|
||||
*/
|
||||
private String period = Constants.DAY;
|
||||
|
||||
private TimeMode timeMode = TimeMode.LAST;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.tencent.supersonic.headless.api.pojo;
|
||||
|
||||
import lombok.Data;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ViewDetail {
|
||||
|
||||
private List<ViewModelConfig> viewModelConfigs;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.tencent.supersonic.headless.api.pojo;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ViewModelConfig {
|
||||
|
||||
private Long id;
|
||||
|
||||
private boolean includesAll;
|
||||
|
||||
private List<Long> metrics = Lists.newArrayList();
|
||||
|
||||
private List<Long> dimensions = Lists.newArrayList();
|
||||
|
||||
public ViewModelConfig(Long id, boolean includesAll) {
|
||||
this.id = id;
|
||||
this.includesAll = includesAll;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.tencent.supersonic.headless.api.pojo.enums;
|
||||
|
||||
public enum SchemaType {
|
||||
|
||||
VIEW,
|
||||
MODEL
|
||||
}
|
||||
@@ -1,10 +1,11 @@
|
||||
package com.tencent.supersonic.headless.api.pojo.request;
|
||||
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class ViewInfoReq {
|
||||
public class CanvasReq {
|
||||
|
||||
private Long id;
|
||||
|
||||
@@ -11,7 +11,6 @@ public class MetricQueryReq {
|
||||
|
||||
private List<String> metrics;
|
||||
private List<String> dimensions;
|
||||
private String rootPath = "";
|
||||
private Map<String, String> variables;
|
||||
private String where;
|
||||
private Long limit;
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.tencent.supersonic.headless.api.pojo.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ModelSchemaFilterReq {
|
||||
|
||||
/**
|
||||
* if domainIds is empty, get all domain info
|
||||
*/
|
||||
private List<Long> modelIds;
|
||||
}
|
||||
@@ -1,15 +1,14 @@
|
||||
package com.tencent.supersonic.headless.api.pojo.request;
|
||||
|
||||
import com.tencent.supersonic.headless.api.pojo.MetricTable;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ParseSqlReq {
|
||||
|
||||
private String rootPath = "";
|
||||
private Map<String, String> variables;
|
||||
private String sql = "";
|
||||
private List<MetricTable> tables;
|
||||
|
||||
@@ -2,13 +2,13 @@ package com.tencent.supersonic.headless.api.pojo.request;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.tencent.supersonic.headless.api.pojo.Cache;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
public class QueryMultiStructReq extends SemanticQueryReq {
|
||||
@@ -23,11 +23,11 @@ public class QueryMultiStructReq extends SemanticQueryReq {
|
||||
return DigestUtils.md5Hex(this.toCustomizedString());
|
||||
}
|
||||
|
||||
public List<Long> getModelIds() {
|
||||
public Long getViewId() {
|
||||
if (CollectionUtils.isEmpty(this.getQueryStructReqs())) {
|
||||
return new ArrayList<>();
|
||||
return null;
|
||||
}
|
||||
return this.getQueryStructReqs().get(0).getModelIds();
|
||||
return this.getQueryStructReqs().get(0).getViewId();
|
||||
}
|
||||
|
||||
public Cache getCacheInfo() {
|
||||
|
||||
@@ -12,7 +12,9 @@ public class QuerySqlReq extends SemanticQueryReq {
|
||||
@Override
|
||||
public String toCustomizedString() {
|
||||
StringBuilder stringBuilder = new StringBuilder("{");
|
||||
stringBuilder.append("\"modelId\":")
|
||||
stringBuilder.append("\"viewId\":")
|
||||
.append(viewId);
|
||||
stringBuilder.append("\"modelIds\":")
|
||||
.append(modelIds);
|
||||
stringBuilder.append(",\"params\":")
|
||||
.append(params);
|
||||
|
||||
@@ -44,8 +44,6 @@ import java.util.stream.Collectors;
|
||||
@Data
|
||||
@Slf4j
|
||||
public class QueryStructReq extends SemanticQueryReq {
|
||||
|
||||
private String modelName;
|
||||
private List<String> groups = new ArrayList<>();
|
||||
private List<Aggregator> aggregators = new ArrayList<>();
|
||||
private List<Order> orders = new ArrayList<>();
|
||||
@@ -94,7 +92,9 @@ public class QueryStructReq extends SemanticQueryReq {
|
||||
|
||||
public String toCustomizedString() {
|
||||
StringBuilder stringBuilder = new StringBuilder("{");
|
||||
stringBuilder.append("\"modelId\":")
|
||||
stringBuilder.append("\"viewId\":")
|
||||
.append(viewId);
|
||||
stringBuilder.append("\"modelIds\":")
|
||||
.append(modelIds);
|
||||
stringBuilder.append(",\"groups\":")
|
||||
.append(groups);
|
||||
@@ -125,7 +125,9 @@ public class QueryStructReq extends SemanticQueryReq {
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder("{");
|
||||
sb.append("\"modelId\":")
|
||||
sb.append("\"viewId\":")
|
||||
.append(viewId);
|
||||
sb.append("\"modelIds\":")
|
||||
.append(modelIds);
|
||||
sb.append(",\"groups\":")
|
||||
.append(groups);
|
||||
@@ -169,6 +171,7 @@ public class QueryStructReq extends SemanticQueryReq {
|
||||
|
||||
QuerySqlReq result = new QuerySqlReq();
|
||||
result.setSql(sql);
|
||||
result.setViewId(queryStructReq.getViewId());
|
||||
result.setModelIds(queryStructReq.getModelIdSet());
|
||||
result.setParams(new ArrayList<>());
|
||||
return result;
|
||||
@@ -211,7 +214,7 @@ public class QueryStructReq extends SemanticQueryReq {
|
||||
}
|
||||
plainSelect.setSelectItems(selectItems);
|
||||
//2.Set the table name
|
||||
Table table = new Table(queryStructReq.getModelName());
|
||||
Table table = new Table(queryStructReq.getTableName());
|
||||
plainSelect.setFromItem(table);
|
||||
|
||||
//3.Set the order by clause
|
||||
@@ -271,9 +274,14 @@ public class QueryStructReq extends SemanticQueryReq {
|
||||
return sql;
|
||||
}
|
||||
|
||||
public String getModelName() {
|
||||
return Objects.nonNull(modelName) ? modelName :
|
||||
Constants.TABLE_PREFIX + StringUtils.join(modelIds, "_");
|
||||
public String getTableName() {
|
||||
if (StringUtils.isNotBlank(viewName)) {
|
||||
return viewName;
|
||||
}
|
||||
if (viewId != null) {
|
||||
return Constants.TABLE_PREFIX + viewId;
|
||||
}
|
||||
return Constants.TABLE_PREFIX + StringUtils.join(modelIds, "_");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.tencent.supersonic.headless.api.pojo.request;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class SchemaFilterReq {
|
||||
|
||||
private Long viewId;
|
||||
|
||||
private List<Long> modelIds = Lists.newArrayList();
|
||||
|
||||
}
|
||||
@@ -3,14 +3,14 @@ package com.tencent.supersonic.headless.api.pojo.request;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.tencent.supersonic.headless.api.pojo.Cache;
|
||||
import com.tencent.supersonic.headless.api.pojo.Param;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
|
||||
|
||||
@Data
|
||||
@@ -19,7 +19,12 @@ public abstract class SemanticQueryReq {
|
||||
|
||||
protected boolean needAuth = true;
|
||||
|
||||
protected Long viewId;
|
||||
|
||||
protected String viewName;
|
||||
|
||||
protected Set<Long> modelIds = new HashSet<>();
|
||||
|
||||
protected List<Param> params = new ArrayList<>();
|
||||
|
||||
protected Cache cacheInfo = new Cache();
|
||||
@@ -38,10 +43,6 @@ public abstract class SemanticQueryReq {
|
||||
return Lists.newArrayList(modelIds);
|
||||
}
|
||||
|
||||
public String getModelIdStr() {
|
||||
return String.join(",", modelIds.stream().map(Object::toString).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
public Set<Long> getModelIdSet() {
|
||||
return modelIds;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.tencent.supersonic.headless.api.pojo.request;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class ViewFilterReq {
|
||||
|
||||
protected boolean defaultAll = true;
|
||||
|
||||
protected List<Long> viewIds = Lists.newArrayList();
|
||||
|
||||
public ViewFilterReq(Long viewId) {
|
||||
addView(viewId);
|
||||
}
|
||||
|
||||
public List<Long> getViewIds() {
|
||||
if (CollectionUtils.isEmpty(viewIds) && !defaultAll) {
|
||||
return Lists.newArrayList(-1L);
|
||||
}
|
||||
return viewIds;
|
||||
}
|
||||
|
||||
public void addView(Long viewId) {
|
||||
viewIds.add(viewId);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.tencent.supersonic.headless.api.pojo.request;
|
||||
|
||||
import com.tencent.supersonic.headless.api.pojo.QueryConfig;
|
||||
import com.tencent.supersonic.headless.api.pojo.SchemaItem;
|
||||
import com.tencent.supersonic.headless.api.pojo.ViewDetail;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ViewReq extends SchemaItem {
|
||||
|
||||
private Long domainId;
|
||||
|
||||
private ViewDetail viewDetail;
|
||||
|
||||
private String alias;
|
||||
|
||||
private String filterSql;
|
||||
|
||||
private QueryConfig queryConfig;
|
||||
|
||||
private List<String> admins;
|
||||
|
||||
private List<String> adminOrgs;
|
||||
|
||||
public String getAdmin() {
|
||||
if (admins == null) {
|
||||
return null;
|
||||
}
|
||||
return String.join(",", admins);
|
||||
}
|
||||
|
||||
public String getAdminOrg() {
|
||||
if (adminOrgs == null) {
|
||||
return null;
|
||||
}
|
||||
return String.join(",", adminOrgs);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,12 +5,15 @@ import com.google.common.collect.Lists;
|
||||
import com.tencent.supersonic.common.pojo.RecordInfo;
|
||||
import com.tencent.supersonic.headless.api.pojo.enums.AppStatus;
|
||||
import com.tencent.supersonic.headless.api.pojo.AppConfig;
|
||||
import com.tencent.supersonic.headless.api.pojo.Item;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Data
|
||||
public class AppResp extends RecordInfo {
|
||||
@@ -41,4 +44,13 @@ public class AppResp extends RecordInfo {
|
||||
owners = Arrays.asList(owner.split(","));
|
||||
}
|
||||
|
||||
public Set<Item> allItems() {
|
||||
Set<Item> itemSet = new HashSet<>();
|
||||
for (Item item : config.getItems()) {
|
||||
itemSet.add(item);
|
||||
itemSet.addAll(item.getRelateItems());
|
||||
}
|
||||
return itemSet;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import lombok.Data;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ModelSchemaRelaResp {
|
||||
public class CanvasSchemaResp {
|
||||
|
||||
private Long domainId;
|
||||
|
||||
@@ -29,8 +29,6 @@ public class ModelResp extends SchemaItem {
|
||||
|
||||
private String depends;
|
||||
|
||||
private String sourceType;
|
||||
|
||||
private String filterSql;
|
||||
|
||||
private List<String> viewers = new ArrayList<>();
|
||||
@@ -43,7 +41,7 @@ public class ModelResp extends SchemaItem {
|
||||
|
||||
private Integer isOpen;
|
||||
|
||||
private List<DrillDownDimension> drillDownDimensions;
|
||||
private List<DrillDownDimension> drillDownDimensions = Lists.newArrayList();
|
||||
|
||||
private String alias;
|
||||
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.tencent.supersonic.headless.api.pojo.response;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.tencent.supersonic.common.pojo.ModelRela;
|
||||
import com.tencent.supersonic.headless.api.pojo.enums.SchemaType;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.tencent.supersonic.common.pojo.Constants.UNDERLINE;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class SemanticSchemaResp {
|
||||
|
||||
private Long viewId;
|
||||
private List<Long> modelIds;
|
||||
private SchemaType schemaType;
|
||||
private List<MetricSchemaResp> metrics = Lists.newArrayList();
|
||||
private List<DimSchemaResp> dimensions = Lists.newArrayList();
|
||||
private List<ModelRela> modelRelas = Lists.newArrayList();
|
||||
private List<ModelResp> modelResps = Lists.newArrayList();
|
||||
private ViewResp viewResp;
|
||||
private DatabaseResp databaseResp;
|
||||
|
||||
public String getSchemaKey() {
|
||||
if (viewId == null) {
|
||||
return String.format("%s_%s", schemaType, StringUtils.join(modelIds, UNDERLINE));
|
||||
}
|
||||
return String.format("%s_%s", schemaType, viewId);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.tencent.supersonic.headless.api.pojo.response;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.tencent.supersonic.headless.api.pojo.QueryConfig;
|
||||
import com.tencent.supersonic.headless.api.pojo.SchemaItem;
|
||||
import com.tencent.supersonic.headless.api.pojo.ViewDetail;
|
||||
import com.tencent.supersonic.headless.api.pojo.ViewModelConfig;
|
||||
import lombok.Data;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Data
|
||||
public class ViewResp extends SchemaItem {
|
||||
|
||||
private Long domainId;
|
||||
|
||||
private ViewDetail viewDetail;
|
||||
|
||||
private String alias;
|
||||
|
||||
private String filterSql;
|
||||
|
||||
private List<String> admins = new ArrayList<>();
|
||||
|
||||
private List<String> adminOrgs = new ArrayList<>();
|
||||
|
||||
private QueryConfig queryConfig;
|
||||
|
||||
public List<Long> getAllMetrics() {
|
||||
return getViewModelConfigs().stream().map(ViewModelConfig::getMetrics)
|
||||
.flatMap(Collection::stream).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public List<Long> getAllDimensions() {
|
||||
return getViewModelConfigs().stream().map(ViewModelConfig::getMetrics)
|
||||
.flatMap(Collection::stream).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public List<Long> getAllModels() {
|
||||
return getViewModelConfigs().stream().map(ViewModelConfig::getId)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public List<Long> getAllIncludeAllModels() {
|
||||
return getViewModelConfigs().stream().filter(ViewModelConfig::isIncludesAll)
|
||||
.map(ViewModelConfig::getId)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private List<ViewModelConfig> getViewModelConfigs() {
|
||||
if (viewDetail == null || CollectionUtils.isEmpty(viewDetail.getViewModelConfigs())) {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
return viewDetail.getViewModelConfigs();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.tencent.supersonic.headless.api.pojo.response;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.tencent.supersonic.headless.api.pojo.Identify;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ViewSchemaResp extends ViewResp {
|
||||
|
||||
private List<MetricSchemaResp> metrics = Lists.newArrayList();
|
||||
private List<DimSchemaResp> dimensions = Lists.newArrayList();
|
||||
private List<ModelResp> modelResps = Lists.newArrayList();
|
||||
|
||||
public DimSchemaResp getPrimaryKey() {
|
||||
for (ModelResp modelResp : modelResps) {
|
||||
Identify identify = modelResp.getPrimaryIdentify();
|
||||
if (identify == null) {
|
||||
continue;
|
||||
}
|
||||
for (DimSchemaResp dimension : dimensions) {
|
||||
if (identify.getBizName().equals(dimension.getBizName())) {
|
||||
dimension.setEntityAlias(identify.getEntityNames());
|
||||
return dimension;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user