-
Notifications
You must be signed in to change notification settings - Fork 434
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
1,017 additions
and
37 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
headless/api/src/main/java/com/tencent/supersonic/headless/api/pojo/TagDefineParams.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.tencent.supersonic.headless.api.pojo; | ||
|
||
import lombok.Data; | ||
|
||
@Data | ||
public class TagDefineParams { | ||
|
||
private String expr; | ||
} |
8 changes: 8 additions & 0 deletions
8
headless/api/src/main/java/com/tencent/supersonic/headless/api/pojo/enums/TagDefineType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.tencent.supersonic.headless.api.pojo.enums; | ||
|
||
public enum TagDefineType { | ||
|
||
FIELD, | ||
DIMENSION, | ||
Tag | ||
} |
27 changes: 27 additions & 0 deletions
27
headless/api/src/main/java/com/tencent/supersonic/headless/api/pojo/enums/TagType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.tencent.supersonic.headless.api.pojo.enums; | ||
|
||
import java.util.Objects; | ||
|
||
public enum TagType { | ||
ATOMIC, | ||
DERIVED; | ||
|
||
public static TagType of(String src) { | ||
for (TagType tagType : TagType.values()) { | ||
if (Objects.nonNull(src) && src.equalsIgnoreCase(tagType.name())) { | ||
return tagType; | ||
} | ||
} | ||
return null; | ||
} | ||
|
||
public static Boolean isDerived(String src) { | ||
TagType tagType = of(src); | ||
return Objects.nonNull(tagType) && tagType.equals(DERIVED); | ||
} | ||
|
||
public static TagType getType(TagDefineType tagDefineType) { | ||
return Objects.nonNull(tagDefineType) && TagDefineType.Tag.equals(tagDefineType) ? TagType.DERIVED | ||
: TagType.ATOMIC; | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...ss/api/src/main/java/com/tencent/supersonic/headless/api/pojo/request/QueryStructReq.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 52 additions & 6 deletions
58
headless/api/src/main/java/com/tencent/supersonic/headless/api/pojo/request/QueryTagReq.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,64 @@ | ||
package com.tencent.supersonic.headless.api.pojo.request; | ||
|
||
import com.google.common.collect.Lists; | ||
import com.tencent.supersonic.common.pojo.Aggregator; | ||
import com.tencent.supersonic.common.pojo.DateConf; | ||
import com.tencent.supersonic.common.pojo.Filter; | ||
import com.tencent.supersonic.common.pojo.Order; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
import lombok.Data; | ||
import lombok.ToString; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.util.CollectionUtils; | ||
|
||
@Data | ||
@Slf4j | ||
@ToString | ||
public class QueryTagReq { | ||
public class QueryTagReq extends SemanticQueryReq { | ||
|
||
private Long domainId; | ||
private List<String> groups = new ArrayList<>(); | ||
private List<Aggregator> aggregators = new ArrayList<>(); | ||
private List<Filter> tagFilters = new ArrayList<>(); | ||
private List<Order> orders = new ArrayList<>(); | ||
|
||
private List<Long> tagIds; | ||
private Long limit = 20L; | ||
private Long offset = 0L; | ||
|
||
private List<String> tagNames; | ||
private String tagFiltersDate; | ||
private DateConf dateInfo; | ||
|
||
private Long limit = 2000L; | ||
} | ||
@Override | ||
public String toCustomizedString() { | ||
StringBuilder stringBuilder = new StringBuilder("{"); | ||
stringBuilder.append("\"viewId\":") | ||
.append(viewId); | ||
stringBuilder.append("\"modelIds\":") | ||
.append(modelIds); | ||
stringBuilder.append(",\"groups\":") | ||
.append(groups); | ||
stringBuilder.append(",\"aggregators\":") | ||
.append(aggregators); | ||
stringBuilder.append(",\"orders\":") | ||
.append(orders); | ||
stringBuilder.append(",\"tagFilters\":") | ||
.append(tagFilters); | ||
stringBuilder.append(",\"dateInfo\":") | ||
.append(dateInfo); | ||
stringBuilder.append(",\"params\":") | ||
.append(params); | ||
stringBuilder.append(",\"limit\":") | ||
.append(limit); | ||
stringBuilder.append('}'); | ||
return stringBuilder.toString(); | ||
} | ||
|
||
public List<String> getMetrics() { | ||
List<String> metrics = Lists.newArrayList(); | ||
if (!CollectionUtils.isEmpty(this.aggregators)) { | ||
metrics = aggregators.stream().map(Aggregator::getColumn).collect(Collectors.toList()); | ||
} | ||
return metrics; | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
headless/api/src/main/java/com/tencent/supersonic/headless/api/pojo/request/TagReq.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.tencent.supersonic.headless.api.pojo.request; | ||
|
||
import com.alibaba.fastjson.JSONObject; | ||
import com.tencent.supersonic.headless.api.pojo.SchemaItem; | ||
import com.tencent.supersonic.headless.api.pojo.TagDefineParams; | ||
import com.tencent.supersonic.headless.api.pojo.enums.TagDefineType; | ||
import com.tencent.supersonic.headless.api.pojo.enums.TagType; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
import java.util.Objects; | ||
import lombok.Data; | ||
|
||
@Data | ||
public class TagReq extends SchemaItem { | ||
|
||
private Long modelId; | ||
private Map<String, Object> ext = new HashMap<>(); | ||
private TagDefineType tagDefineType; | ||
private TagDefineParams tagDefineParams; | ||
|
||
public String getTypeParamsJson() { | ||
return JSONObject.toJSONString(tagDefineParams); | ||
} | ||
|
||
public String getExtJson() { | ||
return Objects.nonNull(ext) && ext.size() > 0 ? JSONObject.toJSONString(ext) : ""; | ||
} | ||
|
||
public TagType getType() { | ||
return TagType.getType(tagDefineType); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
headless/api/src/main/java/com/tencent/supersonic/headless/api/pojo/response/TagResp.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.tencent.supersonic.headless.api.pojo.response; | ||
|
||
import com.tencent.supersonic.headless.api.pojo.SchemaItem; | ||
import com.tencent.supersonic.headless.api.pojo.TagDefineParams; | ||
import com.tencent.supersonic.headless.api.pojo.enums.TagDefineType; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
import lombok.Data; | ||
import lombok.ToString; | ||
|
||
@Data | ||
@ToString(callSuper = true) | ||
public class TagResp extends SchemaItem { | ||
|
||
private Long modelId; | ||
|
||
private String type; | ||
|
||
private Map<String, Object> ext = new HashMap<>(); | ||
|
||
private TagDefineType tagDefineType = TagDefineType.FIELD; | ||
|
||
private TagDefineParams tagDefineParams; | ||
|
||
public String getExpr() { | ||
return tagDefineParams.getExpr(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.