diff --git a/dss-apps/dss-dataasset-management/data-assets-client/pom.xml b/dss-apps/dss-dataasset-management/data-assets-client/pom.xml
new file mode 100644
index 0000000000..9025f3e8c5
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/pom.xml
@@ -0,0 +1,58 @@
+
+
+
+ dss-dataasset-management
+ com.webank.wedatasphere.dss
+ 1.0.1
+
+ 4.0.0
+
+ data-assets-client
+
+
+ 8
+ 8
+
+
+
+
+ org.apache.linkis
+ linkis-gateway-httpclient-support
+ ${linkis.version}
+
+
+ org.projectlombok
+ lombok
+ 1.18.16
+ compile
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-deploy-plugin
+
+
+
+ net.alchim31.maven
+ scala-maven-plugin
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+
+
+
+
+ src/main/resources
+
+
+ ${project.artifactId}-${project.version}
+
+
+
\ No newline at end of file
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/ClassificationConstant.java b/dss-apps/dss-dataasset-management/data-assets-client/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/ClassificationConstant.java
new file mode 100644
index 0000000000..c00620f1b3
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/ClassificationConstant.java
@@ -0,0 +1,77 @@
+package com.webank.wedatasphere.dss.data.governance.entity;
+
+
+import org.apache.commons.lang.StringUtils;
+
+import java.util.Optional;
+
+public enum ClassificationConstant {
+ /**
+ * 指标
+ */
+ INDICATOR(1, "indicator"),
+ /**
+ * 度量
+ */
+ MEASURE(2,"measure"),
+ /**
+ * 维度
+ */
+ DIMENSION(0, "dimension"),
+ /**
+ * 主题
+ */
+ THEME(3, "theme"),
+ /**
+ * 分层
+ */
+ LAYER(4, "layer");
+
+ private int type;
+
+ public static final String SEPARATOR = "_";
+
+ private String typeCode;
+
+ ClassificationConstant(int type, String typeCode) {
+ this.type = type;
+
+ this.typeCode = typeCode;
+ }
+
+ public static boolean isTypeScope(int type) {
+ return type >= 0 && type < values().length;
+ }
+
+ public static boolean isTypeScope(String type) {
+ return getClassificationConstantByTypeCode(type).isPresent();
+ }
+
+ public static Optional getClassificationConstantByTypeCode(String typeCode) {
+ for (ClassificationConstant c : values()) {
+ if (StringUtils.equals(c.typeCode,typeCode)) {
+ return Optional.of(c);
+ }
+ }
+ return Optional.empty();
+ }
+
+ public static Optional getClassificationConstantByType(int type) {
+ for (ClassificationConstant c : values()) {
+ if (c.type == type) {
+ return Optional.of(c);
+ }
+ }
+ return Optional.empty();
+ }
+
+
+
+ public int getType() {
+ return type;
+ }
+
+ public String getTypeCode() {
+ return typeCode;
+ }
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/CreateLabelInfo.java b/dss-apps/dss-dataasset-management/data-assets-client/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/CreateLabelInfo.java
new file mode 100644
index 0000000000..9bf1a6139d
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/CreateLabelInfo.java
@@ -0,0 +1,10 @@
+package com.webank.wedatasphere.dss.data.governance.entity;
+
+import lombok.Data;
+
+@Data
+public class CreateLabelInfo {
+ private String name;
+
+ private String guid;
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/CreateModelTypeInfo.java b/dss-apps/dss-dataasset-management/data-assets-client/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/CreateModelTypeInfo.java
new file mode 100644
index 0000000000..cf1fa62bb4
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/CreateModelTypeInfo.java
@@ -0,0 +1,12 @@
+package com.webank.wedatasphere.dss.data.governance.entity;
+
+
+import lombok.Data;
+
+@Data
+public class CreateModelTypeInfo {
+ private String name;
+
+ private String guid;
+
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/HiveSimpleInfo.java b/dss-apps/dss-dataasset-management/data-assets-client/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/HiveSimpleInfo.java
new file mode 100644
index 0000000000..2aeaedfbbb
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/HiveSimpleInfo.java
@@ -0,0 +1,23 @@
+package com.webank.wedatasphere.dss.data.governance.entity;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+
+@Data
+public class HiveSimpleInfo implements Serializable {
+ private String guid;
+ private String name;
+ private String qualifiedName;
+ private String createTime;
+ private String owner;
+ private String aliases;
+ private String lastAccessTime;
+ private String comment;
+ private List classifications;
+ private String totalSize;
+ private String external;
+
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/HiveTblStatsDTO.java b/dss-apps/dss-dataasset-management/data-assets-client/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/HiveTblStatsDTO.java
new file mode 100644
index 0000000000..82f916c2ef
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/HiveTblStatsDTO.java
@@ -0,0 +1,18 @@
+package com.webank.wedatasphere.dss.data.governance.entity;
+
+
+import lombok.Data;
+
+@Data
+public class HiveTblStatsDTO {
+
+ private Integer columnCount = 0;
+
+ private Long totalSize = 0L;
+
+ private Integer numFiles = 0;
+
+ private Integer partitionCount = 0;
+
+ private Integer accessCount = 0;
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/PartInfo.java b/dss-apps/dss-dataasset-management/data-assets-client/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/PartInfo.java
new file mode 100644
index 0000000000..1a5d85685a
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/PartInfo.java
@@ -0,0 +1,14 @@
+package com.webank.wedatasphere.dss.data.governance.entity;
+
+import lombok.Data;
+
+
+@Data
+public class PartInfo {
+ private String partName;
+ private int reordCnt;
+ private int store;
+ private String createTime;
+ private String lastAccessTime;
+ private int fileCount;
+}
\ No newline at end of file
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/QueryType.java b/dss-apps/dss-dataasset-management/data-assets-client/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/QueryType.java
new file mode 100644
index 0000000000..f54a0e6cd5
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/QueryType.java
@@ -0,0 +1,18 @@
+package com.webank.wedatasphere.dss.data.governance.entity;
+
+
+public enum QueryType {
+ PRECISE(1),
+ FUZZY(0);
+ private int code;
+
+ QueryType(int code) {
+ this.code = code;
+ }
+
+ public int getCode() {
+ return code;
+ }
+
+
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/SearchLabelInfo.java b/dss-apps/dss-dataasset-management/data-assets-client/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/SearchLabelInfo.java
new file mode 100644
index 0000000000..c33b928d19
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/SearchLabelInfo.java
@@ -0,0 +1,9 @@
+package com.webank.wedatasphere.dss.data.governance.entity;
+
+import lombok.Data;
+
+@Data
+public class SearchLabelInfo {
+ private String name;
+ private String guid;
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/UpdateLabelInfo.java b/dss-apps/dss-dataasset-management/data-assets-client/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/UpdateLabelInfo.java
new file mode 100644
index 0000000000..c04b5c79c4
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/UpdateLabelInfo.java
@@ -0,0 +1,10 @@
+package com.webank.wedatasphere.dss.data.governance.entity;
+
+import lombok.Data;
+
+@Data
+public class UpdateLabelInfo {
+ private String name;
+
+ private String guid;
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/UpdateModelTypeInfo.java b/dss-apps/dss-dataasset-management/data-assets-client/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/UpdateModelTypeInfo.java
new file mode 100644
index 0000000000..33cee5d07b
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/UpdateModelTypeInfo.java
@@ -0,0 +1,11 @@
+package com.webank.wedatasphere.dss.data.governance.entity;
+
+
+import lombok.Data;
+
+@Data
+public class UpdateModelTypeInfo {
+ private String name;
+
+ private String guid;
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/AbstractRemoteClient.scala b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/AbstractRemoteClient.scala
new file mode 100644
index 0000000000..87b84d4a21
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/AbstractRemoteClient.scala
@@ -0,0 +1,15 @@
+package com.webank.wedatasphere.dss.data.governance
+
+import org.apache.linkis.httpclient.dws.DWSHttpClient
+import org.apache.linkis.httpclient.request.Action
+import org.apache.linkis.httpclient.response.Result
+
+abstract class AbstractRemoteClient extends RemoteClient {
+ protected val dwsHttpClient:DWSHttpClient
+
+ override def execute(action: Action): Result = action match {
+ case action: Action => dwsHttpClient.execute(action)
+ }
+
+ override def close(): Unit = dwsHttpClient.close()
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/DataAssetsRemoteClient.scala b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/DataAssetsRemoteClient.scala
new file mode 100644
index 0000000000..17144448bf
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/DataAssetsRemoteClient.scala
@@ -0,0 +1,47 @@
+package com.webank.wedatasphere.dss.data.governance
+
+
+import com.webank.wedatasphere.dss.data.governance.request._
+import com.webank.wedatasphere.dss.data.governance.response._
+
+
+trait DataAssetsRemoteClient extends RemoteClient {
+ def searchHiveTbl(action: SearchHiveTblAction): SearchHiveTblResult
+
+ def searchHiveDb(action: SearchHiveDbAction): SearchHiveDbResult
+
+ def getHiveTblPartition(action: GetHiveTblPartitionAction): GetHiveTblPartitionResult
+
+ def getHiveTblBasic(action: GetHiveTblBasicAction): GetHiveTblBasicResult
+
+ def getHiveTblCreate(action: GetHiveTblCreateAction): GetHiveTblCreateResult
+
+ def createModelType(action: CreateModelTypeAction): CreateModelTypeResult
+
+ def bindModelType(action: BindModelTypeAction): BindModelTypeResult
+
+ def updateModelType(action: UpdateModelTypeAction): UpdateModelTypeResult
+
+ def unBindModelType(action: UnBindModelTypeAction): UnBindModelTypeResult
+
+ def createLabel(action: CreateLabelAction): CreateLabelResult
+
+ def updateLabel(action: UpdateLabelAction): UpdateLabelResult
+
+ def deleteLabel(action: DeleteLabelAction): DeleteLabelResult
+
+ def bindLabel(action: BindLabelAction): BindLabelResult
+
+ def unBindLabel(action: UnBindLabelAction): UnBindLabelResult
+
+ def searchLabel(action: SearchLabelAction): SearchLabelResult
+
+ def deleteModelType(action: DeleteModelTypeAction): DeleteModelTypeResult
+
+ def searchHiveTblSize(action: HiveTblSizeAction): HiveTblSizeResult
+
+ def searchHiveTblStats(action: HiveTblStatsAction): HiveTblStatsResult
+
+ def getHiveTblPartInfoByNameResult(action: GetTblPartInfoByNameAction): GetHiveTblPartInfoByNameResult
+
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/RemoteClient.scala b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/RemoteClient.scala
new file mode 100644
index 0000000000..9d1e5028d7
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/RemoteClient.scala
@@ -0,0 +1,11 @@
+package com.webank.wedatasphere.dss.data.governance
+
+import org.apache.linkis.httpclient.request.Action
+import org.apache.linkis.httpclient.response.Result
+import java.io.Closeable
+
+trait RemoteClient extends Closeable{
+ protected def execute(action: Action): Result
+
+ override def close(): Unit
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/exception/DataAssetsClientBuilderException.scala b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/exception/DataAssetsClientBuilderException.scala
new file mode 100644
index 0000000000..5c9b205855
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/exception/DataAssetsClientBuilderException.scala
@@ -0,0 +1,5 @@
+package com.webank.wedatasphere.dss.data.governance.exception
+
+import org.apache.linkis.common.exception.ErrorException
+
+class DataAssetsClientBuilderException (errorDesc: String) extends ErrorException(23000, errorDesc)
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/impl/LinkisDataAssetsRemoteClient.scala b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/impl/LinkisDataAssetsRemoteClient.scala
new file mode 100644
index 0000000000..136216f2cb
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/impl/LinkisDataAssetsRemoteClient.scala
@@ -0,0 +1,51 @@
+package com.webank.wedatasphere.dss.data.governance.impl
+
+
+import com.webank.wedatasphere.dss.data.governance.request._
+import com.webank.wedatasphere.dss.data.governance.response._
+import com.webank.wedatasphere.dss.data.governance.{AbstractRemoteClient, DataAssetsRemoteClient}
+import org.apache.linkis.httpclient.dws.DWSHttpClient
+import org.apache.linkis.httpclient.dws.config.DWSClientConfig
+
+class LinkisDataAssetsRemoteClient(clientConfig: DWSClientConfig) extends AbstractRemoteClient with DataAssetsRemoteClient {
+ override protected val dwsHttpClient: DWSHttpClient = new DWSHttpClient(clientConfig, "DataAssets-Client")
+
+ override def searchHiveTbl(action: SearchHiveTblAction): SearchHiveTblResult = execute(action).asInstanceOf[SearchHiveTblResult]
+
+ override def getHiveTblPartition(action: GetHiveTblPartitionAction): GetHiveTblPartitionResult = execute(action).asInstanceOf[GetHiveTblPartitionResult]
+
+ override def getHiveTblBasic(action: GetHiveTblBasicAction): GetHiveTblBasicResult = execute(action).asInstanceOf[GetHiveTblBasicResult]
+
+ override def getHiveTblCreate(action: GetHiveTblCreateAction): GetHiveTblCreateResult = execute(action).asInstanceOf[GetHiveTblCreateResult]
+
+ override def searchHiveDb(action: SearchHiveDbAction): SearchHiveDbResult = execute(action).asInstanceOf[SearchHiveDbResult]
+
+ override def createModelType(action: CreateModelTypeAction): CreateModelTypeResult = execute(action).asInstanceOf[CreateModelTypeResult]
+
+ override def bindModelType(action: BindModelTypeAction): BindModelTypeResult = execute(action).asInstanceOf[BindModelTypeResult]
+
+ override def updateModelType(action: UpdateModelTypeAction): UpdateModelTypeResult = execute(action).asInstanceOf[UpdateModelTypeResult]
+
+ override def unBindModelType(action: UnBindModelTypeAction): UnBindModelTypeResult = execute(action).asInstanceOf[UnBindModelTypeResult]
+
+ override def deleteModelType(action: DeleteModelTypeAction): DeleteModelTypeResult = execute(action).asInstanceOf[DeleteModelTypeResult]
+
+ override def searchHiveTblSize(action: HiveTblSizeAction): HiveTblSizeResult = execute(action).asInstanceOf[HiveTblSizeResult]
+
+ override def searchHiveTblStats(action: HiveTblStatsAction): HiveTblStatsResult = execute(action).asInstanceOf[HiveTblStatsResult]
+
+ override def createLabel(action: CreateLabelAction): CreateLabelResult = execute(action).asInstanceOf[CreateLabelResult]
+
+ override def updateLabel(action: UpdateLabelAction): UpdateLabelResult = execute(action).asInstanceOf[UpdateLabelResult]
+
+ override def deleteLabel(action: DeleteLabelAction): DeleteLabelResult = execute(action).asInstanceOf[DeleteLabelResult]
+
+ override def bindLabel(action: BindLabelAction): BindLabelResult = execute(action).asInstanceOf[BindLabelResult]
+
+ override def unBindLabel(action: UnBindLabelAction): UnBindLabelResult = execute(action).asInstanceOf[UnBindLabelResult]
+
+ override def searchLabel(action: SearchLabelAction): SearchLabelResult = execute(action).asInstanceOf[SearchLabelResult]
+
+ override def getHiveTblPartInfoByNameResult(action: GetTblPartInfoByNameAction): GetHiveTblPartInfoByNameResult = execute(action).asInstanceOf[GetHiveTblPartInfoByNameResult]
+
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/BindLabelAction.scala b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/BindLabelAction.scala
new file mode 100644
index 0000000000..c163338f7d
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/BindLabelAction.scala
@@ -0,0 +1,77 @@
+package com.webank.wedatasphere.dss.data.governance.request
+
+import com.webank.wedatasphere.dss.data.governance.exception.DataAssetsClientBuilderException
+import org.apache.linkis.httpclient.dws.DWSHttpClient
+import org.apache.linkis.httpclient.request.POSTAction
+
+class BindLabelAction extends POSTAction with DataAssetsAction {
+
+ private var user: String = _
+
+ override def getRequestPayload: String = DWSHttpClient.jacksonJson.writeValueAsString(getRequestPayloads)
+
+ override def suffixURLs: Array[String] = Array("data-assets", "asset", "labels", "bind")
+
+ override def setUser(user: String): Unit = this.user = user
+
+ override def getUser: String = this.user
+
+}
+
+object BindLabelAction {
+ def builder(): Builder = new Builder
+
+ class Builder private[BindLabelAction] {
+ private var user: String = _
+
+ private var label: String = _
+
+ private var labelGuid: String = _
+
+ private var tableName: String = _
+
+ private var tableGuid: String = _
+
+ def setUser(user: String): Builder = {
+ this.user = user
+ this
+ }
+
+ def setTableName(tableName: String): Builder = {
+ this.tableName = tableName;
+ this
+ }
+
+ def setLabel(label : String) :Builder={
+ this.label = label
+ this
+ }
+
+ def setTableGuid(tableGuid : String) : Builder = {
+ this.tableGuid = tableGuid
+ this
+ }
+
+ def setLabelGuid(labelGuid : String) : Builder = {
+ this.labelGuid = labelGuid
+ this
+ }
+
+ def build(): BindLabelAction = {
+ var action = new BindLabelAction;
+ if ((tableName == null || label == null) && (labelGuid == null || tableGuid == null))
+ throw new DataAssetsClientBuilderException("tableName and label ,or tableGuid and labelGuid are needed!")
+
+ action.setUser(user)
+ action.addRequestPayload("label", label)
+ action.addRequestPayload("tableName", tableName)
+ action.addRequestPayload("tableGuid", tableGuid)
+ action.addRequestPayload("labelGuid", labelGuid)
+ action
+ }
+ }
+}
+
+
+
+
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/BindModelTypeAction.scala b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/BindModelTypeAction.scala
new file mode 100644
index 0000000000..f99cab178b
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/BindModelTypeAction.scala
@@ -0,0 +1,84 @@
+package com.webank.wedatasphere.dss.data.governance.request
+
+import com.webank.wedatasphere.dss.data.governance.entity.ClassificationConstant
+import com.webank.wedatasphere.dss.data.governance.exception.DataAssetsClientBuilderException
+import org.apache.linkis.httpclient.dws.DWSHttpClient
+import org.apache.linkis.httpclient.request.POSTAction
+
+class BindModelTypeAction extends POSTAction with DataAssetsAction {
+
+ private var user: String = _
+
+ private var modelName: String = _
+
+ private var modelType: String = _
+
+ private var tableName: String = _
+
+ private var guid: String = _
+
+ override def getRequestPayload: String = DWSHttpClient.jacksonJson.writeValueAsString(getRequestPayloads)
+
+ override def setUser(user: String): Unit = this.user = user
+
+ override def getUser: String = this.user
+
+ override def suffixURLs: Array[String] = Array("data-assets", "asset", "model", "bind")
+}
+
+object BindModelTypeAction {
+ def builder(): Builder = new Builder
+
+ class Builder private[BindModelTypeAction] {
+ private var user: String = _
+
+ private var modelName: String = _
+
+ private var modelType: ClassificationConstant = _
+
+ private var tableName: String = _
+
+ private var guid: String = _
+
+ def setUser(user: String): Builder = {
+ this.user = user
+ this
+ }
+
+ def setModelName(modelName: String): Builder = {
+ this.modelName = modelName;
+ this
+ }
+
+ def setModelType(modelType: ClassificationConstant): Builder = {
+ this.modelType = modelType;
+ this
+ }
+
+ def setTableName(tableName: String): Builder = {
+ this.tableName = tableName;
+ this
+ }
+
+ def setGuid(guid: String): Builder = {
+ this.guid = guid;
+ this
+ }
+
+ def build(): BindModelTypeAction = {
+ var action = new BindModelTypeAction;
+ if (tableName == null && guid == null) throw new DataAssetsClientBuilderException("tableName or guid is needed!")
+ if (modelType == null || modelName == null) throw new DataAssetsClientBuilderException("modelType and modelName is needed!")
+ action.setUser(user)
+ action.guid = guid
+ action.modelName = modelName
+ action.modelType = modelType.getTypeCode
+ action.tableName = tableName
+ action.addRequestPayload("guid", action.guid)
+ action.addRequestPayload("modelName", action.modelName)
+ action.addRequestPayload("modelType", action.modelType)
+ action.addRequestPayload("tableName", action.tableName)
+ action
+ }
+ }
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/CreateLabelAction.scala b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/CreateLabelAction.scala
new file mode 100644
index 0000000000..5c10666625
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/CreateLabelAction.scala
@@ -0,0 +1,50 @@
+package com.webank.wedatasphere.dss.data.governance.request
+
+import com.webank.wedatasphere.dss.data.governance.exception.DataAssetsClientBuilderException
+import org.apache.linkis.httpclient.dws.DWSHttpClient
+import org.apache.linkis.httpclient.request.POSTAction
+
+class CreateLabelAction extends POSTAction with DataAssetsAction {
+
+ private var user: String = _
+
+ override def getRequestPayload: String = DWSHttpClient.jacksonJson.writeValueAsString(getRequestPayloads)
+
+ override def suffixURLs: Array[String] = Array("data-assets", "asset", "labels")
+
+ override def setUser(user: String): Unit = this.user = user
+
+ override def getUser: String = this.user
+
+}
+
+object CreateLabelAction {
+ def builder(): Builder = new Builder
+
+ class Builder private[CreateLabelAction]() {
+ private var user: String = _
+ private var name: String = _
+
+ def setUser(user: String): Builder = {
+ this.user = user
+ this
+ }
+
+ def setName(name: String): Builder = {
+ this.name = name
+ this
+ }
+
+
+ def build(): CreateLabelAction = {
+ val action = new CreateLabelAction
+ if (name == null) throw new DataAssetsClientBuilderException("name is needed!")
+ action.setUser(user)
+ action.addRequestPayload("name", this.name)
+ action
+
+ }
+ }
+}
+
+
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/CreateModelTypeAction.scala b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/CreateModelTypeAction.scala
new file mode 100644
index 0000000000..4ac84dedd2
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/CreateModelTypeAction.scala
@@ -0,0 +1,61 @@
+package com.webank.wedatasphere.dss.data.governance.request
+
+import com.webank.wedatasphere.dss.data.governance.entity.ClassificationConstant
+import com.webank.wedatasphere.dss.data.governance.exception.DataAssetsClientBuilderException
+import org.apache.linkis.httpclient.dws.DWSHttpClient
+import org.apache.linkis.httpclient.request.POSTAction
+
+class CreateModelTypeAction extends POSTAction with DataAssetsAction {
+
+ private var name:String= _
+
+ private var `type`:String= _
+
+ private var user:String = _
+
+ override def getRequestPayload: String = DWSHttpClient.jacksonJson.writeValueAsString(getRequestPayloads)
+
+ override def setUser(user: String): Unit = this.user = user
+
+ override def getUser: String = user
+
+ override def suffixURLs: Array[String] = Array("data-assets", "asset", "model","type")
+}
+
+object CreateModelTypeAction{
+ def builder(): Builder = new Builder
+
+ class Builder private[CreateModelTypeAction]() {
+ private var user: String = _
+ private var name:String= _
+ private var `type`:ClassificationConstant= _
+
+ def setUser(user: String): Builder ={
+ this.user = user
+ this
+ }
+
+ def setName(name:String):Builder = {
+ this.name = name
+ this
+ }
+
+ def setType(`type`:ClassificationConstant):Builder = {
+ this.`type` = `type`;
+ this;
+ }
+
+ def build(): CreateModelTypeAction = {
+ val action = new CreateModelTypeAction
+ if(`type` == null) throw new DataAssetsClientBuilderException("type is needed!")
+ if (name == null) throw new DataAssetsClientBuilderException("name is needed!")
+ action.name = name
+ action.`type` = `type`.getTypeCode
+ action.setUser(user)
+ action.addRequestPayload("name",action.name)
+ action.addRequestPayload("type",action.`type`)
+ action
+
+ }
+ }
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/DataAssetsAction.scala b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/DataAssetsAction.scala
new file mode 100644
index 0000000000..2f4a5a90bb
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/DataAssetsAction.scala
@@ -0,0 +1,5 @@
+package com.webank.wedatasphere.dss.data.governance.request
+
+import org.apache.linkis.httpclient.dws.request.DWSHttpAction
+
+trait DataAssetsAction extends DWSHttpAction with org.apache.linkis.httpclient.request.UserAction
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/DeleteLabelAction.scala b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/DeleteLabelAction.scala
new file mode 100644
index 0000000000..d70c551e1d
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/DeleteLabelAction.scala
@@ -0,0 +1,49 @@
+package com.webank.wedatasphere.dss.data.governance.request
+
+import com.webank.wedatasphere.dss.data.governance.exception.DataAssetsClientBuilderException
+import org.apache.linkis.httpclient.dws.DWSHttpClient
+import org.apache.linkis.httpclient.request.POSTAction
+
+class DeleteLabelAction extends POSTAction with DataAssetsAction {
+
+ private var user: String = _
+
+ override def getRequestPayload: String = DWSHttpClient.jacksonJson.writeValueAsString(getRequestPayloads)
+
+ override def suffixURLs: Array[String] = Array("data-assets", "asset", "labels","delete")
+
+ override def setUser(user: String): Unit = this.user = user
+
+ override def getUser: String = this.user
+
+}
+object DeleteLabelAction {
+ def builder(): Builder = new Builder
+
+ class Builder private[DeleteLabelAction]() {
+ private var user: String = _
+ private var name: String = _
+
+ def setUser(user: String): Builder = {
+ this.user = user
+ this
+ }
+
+ def setName(name: String): Builder = {
+ this.name = name
+ this
+ }
+
+
+ def build(): DeleteLabelAction = {
+ val action = new DeleteLabelAction
+ if (name == null) throw new DataAssetsClientBuilderException("name is needed!")
+ action.setUser(user)
+ action.addRequestPayload("name", this.name)
+ action
+ }
+ }
+}
+
+
+
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/DeleteModelTypeAction.scala b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/DeleteModelTypeAction.scala
new file mode 100644
index 0000000000..4d4254385f
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/DeleteModelTypeAction.scala
@@ -0,0 +1,62 @@
+package com.webank.wedatasphere.dss.data.governance.request
+
+import com.webank.wedatasphere.dss.data.governance.entity.ClassificationConstant
+import com.webank.wedatasphere.dss.data.governance.exception.DataAssetsClientBuilderException
+import org.apache.linkis.httpclient.dws.DWSHttpClient
+import org.apache.linkis.httpclient.request.POSTAction
+
+class DeleteModelTypeAction extends POSTAction with DataAssetsAction{
+
+
+ private var name:String= _
+
+ private var `type`:String= _
+
+ private var user:String = _
+
+ override def getRequestPayload: String = DWSHttpClient.jacksonJson.writeValueAsString(getRequestPayloads)
+
+ override def setUser(user: String): Unit = this.user = user
+
+ override def getUser: String = user
+
+ override def suffixURLs: Array[String] = Array("data-assets", "asset", "model","type","delete")
+}
+
+object DeleteModelTypeAction{
+ def builder(): Builder = new Builder
+
+ class Builder private[DeleteModelTypeAction]() {
+ private var user: String = _
+ private var name:String= _
+ private var `type`:ClassificationConstant= _
+
+ def setUser(user: String): Builder ={
+ this.user = user
+ this
+ }
+
+ def setName(name:String):Builder = {
+ this.name = name
+ this
+ }
+
+ def setType(`type`:ClassificationConstant):Builder = {
+ this.`type` = `type`;
+ this;
+ }
+
+ def build(): DeleteModelTypeAction = {
+ val action = new DeleteModelTypeAction
+ if(`type` == null) throw new DataAssetsClientBuilderException("type is needed!")
+ if (name == null) throw new DataAssetsClientBuilderException("name is needed!")
+ action.name = name
+ action.`type` = `type`.getTypeCode
+ action.setUser(user)
+ action.addRequestPayload("name",action.name)
+ action.addRequestPayload("type",action.`type`)
+ action
+
+ }
+ }
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/GetHiveTblBasicAction.scala b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/GetHiveTblBasicAction.scala
new file mode 100644
index 0000000000..994cf0981a
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/GetHiveTblBasicAction.scala
@@ -0,0 +1,42 @@
+package com.webank.wedatasphere.dss.data.governance.request
+
+import com.webank.wedatasphere.dss.data.governance.exception.DataAssetsClientBuilderException
+import org.apache.linkis.httpclient.request.GetAction
+
+class GetHiveTblBasicAction extends GetAction with DataAssetsAction{
+
+ private var guid:String=_
+
+ private var user:String = _
+
+ override def setUser(user: String): Unit = this.user = user
+
+ override def getUser: String = this.user
+
+ override def suffixURLs: Array[String] = Array("data-assets", "asset", "hiveTbl",guid,"basic")
+}
+object GetHiveTblBasicAction{
+ def builder(): Builder = new Builder
+
+ class Builder private[GetHiveTblBasicAction]() {
+ private var guid:String = _
+ private var user: String = _
+
+ def setUser(user: String): Builder ={
+ this.user = user
+ this
+ }
+ def setGuid(guid:String): Builder = {
+ this.guid = guid
+ this
+ }
+
+ def build(): GetHiveTblBasicAction = {
+ val action = new GetHiveTblBasicAction
+ if(guid == null) throw new DataAssetsClientBuilderException("guid is needed!")
+ action.guid = guid
+ action.setUser(user)
+ action
+ }
+ }
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/GetHiveTblCreateAction.scala b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/GetHiveTblCreateAction.scala
new file mode 100644
index 0000000000..b3003e13f3
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/GetHiveTblCreateAction.scala
@@ -0,0 +1,41 @@
+package com.webank.wedatasphere.dss.data.governance.request
+
+import com.webank.wedatasphere.dss.data.governance.exception.DataAssetsClientBuilderException
+import org.apache.linkis.httpclient.request.GetAction
+
+class GetHiveTblCreateAction extends GetAction with DataAssetsAction{
+ private var guid:String=_
+
+ private var user:String = _
+
+ override def setUser(user: String): Unit = this.user = user
+
+ override def getUser: String = this.user
+
+ override def suffixURLs: Array[String] = Array("data-assets", "asset", "hiveTbl",guid,"create")
+}
+object GetHiveTblCreateAction{
+ def builder(): Builder = new Builder
+ class Builder private[GetHiveTblCreateAction]() {
+ private var guid:String = _
+ private var user: String = _
+
+ def setUser(user: String): Builder ={
+ this.user = user
+ this
+ }
+
+ def setGuid(guid:String): Builder = {
+ this.guid = guid
+ this
+ }
+
+ def build(): GetHiveTblCreateAction = {
+ val action = new GetHiveTblCreateAction
+ if(guid == null) throw new DataAssetsClientBuilderException("guid is needed!")
+ action.guid = guid
+ action.setUser(user)
+ action
+ }
+ }
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/GetHiveTblPartitionAction.scala b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/GetHiveTblPartitionAction.scala
new file mode 100644
index 0000000000..9517512e88
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/GetHiveTblPartitionAction.scala
@@ -0,0 +1,43 @@
+package com.webank.wedatasphere.dss.data.governance.request
+
+import com.webank.wedatasphere.dss.data.governance.exception.DataAssetsClientBuilderException
+import org.apache.linkis.httpclient.request.GetAction
+
+class GetHiveTblPartitionAction extends GetAction with DataAssetsAction{
+
+ private var guid:String=_
+
+ private var user:String = _
+
+ override def setUser(user: String): Unit = this.user = user
+
+ override def getUser: String = this.user
+
+ override def suffixURLs: Array[String] = Array("data-assets", "asset", "hiveTbl",guid,"partition")
+}
+object GetHiveTblPartitionAction{
+ def builder(): Builder = new Builder
+
+ class Builder private[GetHiveTblPartitionAction]() {
+ private var guid:String = _
+ private var user: String = _
+
+ def setUser(user: String): Builder ={
+ this.user = user
+ this
+ }
+
+ def setGuid(guid:String): Builder = {
+ this.guid = guid
+ this
+ }
+
+ def build(): GetHiveTblPartitionAction = {
+ val action = new GetHiveTblPartitionAction
+ if(guid == null) throw new DataAssetsClientBuilderException("guid is needed!")
+ action.guid = guid
+ action.setUser(user)
+ action
+ }
+ }
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/GetTblPartInfoByNameAction.scala b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/GetTblPartInfoByNameAction.scala
new file mode 100644
index 0000000000..b29b8b3160
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/GetTblPartInfoByNameAction.scala
@@ -0,0 +1,53 @@
+package com.webank.wedatasphere.dss.data.governance.request
+
+import com.webank.wedatasphere.dss.data.governance.exception.DataAssetsClientBuilderException
+import org.apache.linkis.httpclient.request.GetAction
+
+class GetTblPartInfoByNameAction extends GetAction with DataAssetsAction {
+
+
+ private var user: String = _
+
+ override def suffixURLs: Array[String] = Array("data-assets", "asset", "hiveTbl", "partition", "name")
+
+ override def setUser(user: String): Unit = this.user = user
+
+ override def getUser: String = this.user
+}
+
+object GetTblPartInfoByNameAction {
+ def builder(): Builder = new Builder
+
+ class Builder private[GetTblPartInfoByNameAction]() {
+ private var user: String = _
+ private var dbName: String = _
+ private var tableName: String = _
+
+ def setUser(user: String): Builder = {
+ this.user = user
+ this
+ }
+
+ def setDbName(dbName: String): Builder = {
+ this.dbName = dbName
+ this
+ }
+
+ def setTableName(tableName: String): Builder = {
+ this.tableName = tableName
+ this
+ }
+
+
+ def build(): GetTblPartInfoByNameAction = {
+ val action = new GetTblPartInfoByNameAction
+ if (tableName == null || dbName == null)
+ throw new DataAssetsClientBuilderException("tableName or dbName can not be null")
+
+ action.setParameter("tableName", tableName)
+ action.setParameter("dbName", dbName)
+ action.setUser(user)
+ action
+ }
+ }
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/HiveTblSizeAction.scala b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/HiveTblSizeAction.scala
new file mode 100644
index 0000000000..e8b0fb9ef5
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/HiveTblSizeAction.scala
@@ -0,0 +1,62 @@
+package com.webank.wedatasphere.dss.data.governance.request
+
+import com.webank.wedatasphere.dss.data.governance.exception.DataAssetsClientBuilderException
+import org.apache.linkis.httpclient.request.GetAction
+
+class HiveTblSizeAction extends GetAction with DataAssetsAction {
+
+
+ private var user: String = _
+
+ override def suffixURLs: Array[String] = Array("data-assets", "asset", "hiveTbl", "size")
+
+ override def setUser(user: String): Unit = this.user = user
+
+ override def getUser: String = this.user
+}
+
+object HiveTblSizeAction {
+ def builder(): Builder = new Builder
+
+ class Builder private[HiveTblSizeAction]() {
+ private var guid: String = _
+ private var user: String = _
+ private var dbName: String = _
+ private var tableName: String = _
+
+ def setUser(user: String): Builder = {
+ this.user = user
+ this
+ }
+
+ def setDbName(dbName: String): Builder = {
+ this.dbName = dbName
+ this
+ }
+
+ def setTableName(tableName: String): Builder = {
+ this.tableName = tableName
+ this
+ }
+
+ def setGuid(guid: String): Builder = {
+ this.guid = guid
+ this
+ }
+
+ def build(): HiveTblSizeAction = {
+ val action = new HiveTblSizeAction
+ if (guid == null && (tableName == null || dbName == null))
+ throw new DataAssetsClientBuilderException("That tableName or dbName being null and guid being null could not happen in the same time!")
+ if (guid != null) {
+ action.setParameter("guid", guid)
+ }
+ if (tableName != null && dbName != null) {
+ action.setParameter("tableName", tableName)
+ action.setParameter("dbName", dbName)
+ }
+ action.setUser(user)
+ action
+ }
+ }
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/HiveTblStatsAction.scala b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/HiveTblStatsAction.scala
new file mode 100644
index 0000000000..cedbdc8473
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/HiveTblStatsAction.scala
@@ -0,0 +1,68 @@
+package com.webank.wedatasphere.dss.data.governance.request
+
+import com.webank.wedatasphere.dss.data.governance.exception.DataAssetsClientBuilderException
+import org.apache.linkis.httpclient.request.GetAction
+
+class HiveTblStatsAction extends GetAction with DataAssetsAction {
+
+ private var dbName: String = _
+
+ private var tableName: String = _
+
+ private var guid: String = _
+
+ private var user: String = _
+
+ override def suffixURLs: Array[String] = Array("data-assets", "asset", "hiveTbl", "stats")
+
+ override def setUser(user: String): Unit = this.user = user
+
+ override def getUser: String = this.user
+}
+
+object HiveTblStatsAction {
+ def builder(): Builder = new Builder
+
+ class Builder private[HiveTblStatsAction]() {
+ private var guid: String = _
+ private var user: String = _
+ private var dbName: String = _
+ private var tableName: String = _
+
+ def setUser(user: String): Builder = {
+ this.user = user
+ this
+ }
+
+ def setDbName(dbName: String): Builder = {
+ this.dbName = dbName
+ this
+ }
+
+ def setTableName(tableName: String): Builder = {
+ this.tableName = tableName
+ this
+ }
+
+ def setGuid(guid: String): Builder = {
+ this.guid = guid
+ this
+ }
+
+ def build(): HiveTblStatsAction = {
+ val action = new HiveTblStatsAction
+ if (guid == null && (tableName == null || dbName == null))
+ throw new DataAssetsClientBuilderException("That tableName or dbName being null and guid being null could not happen in the same time!")
+ if (guid != null) {
+ action.setParameter("guid", guid)
+ }
+ if (tableName != null && dbName != null) {
+ action.setParameter("tableName", tableName)
+ action.setParameter("dbName", dbName)
+ }
+ action.setUser(user)
+ action
+ }
+ }
+}
+
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/SearchHiveDbAction.scala b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/SearchHiveDbAction.scala
new file mode 100644
index 0000000000..b3e57864fc
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/SearchHiveDbAction.scala
@@ -0,0 +1,72 @@
+package com.webank.wedatasphere.dss.data.governance.request
+
+import org.apache.linkis.httpclient.request.GetAction
+
+class SearchHiveDbAction extends GetAction with DataAssetsAction{
+ override def suffixURLs: Array[String] = Array("data-assets", "asset", "hiveDb","search")
+
+ private var user:String = _
+
+ override def setUser(user: String): Unit = this.user = user
+
+ override def getUser: String = this.user
+
+}
+object SearchHiveDbAction{
+ def builder(): Builder = new Builder
+
+ class Builder private[SearchHiveDbAction]() {
+ private var classification:String=_
+ private var query:String=_
+ private var owner:String=_
+ private var limit:Int=10
+ private var offset:Int=0
+ private var user: String = _
+
+ def setUser(user: String): Builder ={
+ this.user = user
+ this
+ }
+
+ def setClassification(classification:String): Builder ={
+ this.classification = classification
+ this
+ }
+
+ def setQuery(query:String): Builder ={
+ this.query = query
+ this
+ }
+
+ def setOwner(owner:String):Builder={
+ this.owner=owner
+ this
+ }
+
+ def setLimit(limit:Int):Builder={
+ this.limit=limit
+ this
+ }
+
+ def setOffset(offset:Int):Builder={
+ this.offset=offset
+ this
+ }
+
+ def build(): SearchHiveDbAction = {
+ val action = new SearchHiveDbAction
+
+ if(classification != null) action.setParameter("classification",classification)
+ if(query!=null) action.setParameter("query",query)
+ if(owner == null) action.setParameter("owner","")
+ else action.setParameter("owner",owner)
+
+ action.setParameter("limit",limit)
+ action.setParameter("offset",offset)
+
+ action.setUser(user)
+ action
+ }
+ }
+}
+
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/SearchHiveTblAction.scala b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/SearchHiveTblAction.scala
new file mode 100644
index 0000000000..1a96c1d44d
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/SearchHiveTblAction.scala
@@ -0,0 +1,79 @@
+package com.webank.wedatasphere.dss.data.governance.request
+
+import com.webank.wedatasphere.dss.data.governance.entity.QueryType
+import org.apache.linkis.httpclient.request.GetAction
+
+class SearchHiveTblAction extends GetAction with DataAssetsAction{
+ override def suffixURLs: Array[String] = Array("data-assets", "asset", "hiveTbl","search")
+
+ private var user:String = _
+
+ override def setUser(user: String): Unit = this.user = user
+
+ override def getUser: String = this.user
+
+}
+object SearchHiveTblAction{
+ def builder(): Builder = new Builder
+
+ class Builder private[SearchHiveTblAction]() {
+ private var classification:String=_
+ private var query:String=_
+ private var owner:String=_
+ private var limit:Int=10
+ private var offset:Int=0
+ private var precise: QueryType = QueryType.FUZZY
+ private var user: String = _
+
+ def setUser(user: String): Builder ={
+ this.user = user
+ this
+ }
+
+ def setClassification(classification:String): Builder ={
+ this.classification = classification
+ this
+ }
+
+ def setQuery(query:String): Builder ={
+ this.query = query
+ this
+ }
+
+ def setOwner(owner:String):Builder={
+ this.owner=owner
+ this
+ }
+
+ def setPrecise(precise : QueryType):Builder={
+ this.precise = precise
+ this
+ }
+
+ def setLimit(limit:Int):Builder={
+ this.limit=limit
+ this
+ }
+
+ def setOffset(offset:Int):Builder={
+ this.offset=offset
+ this
+ }
+
+ def build(): SearchHiveTblAction = {
+ val action = new SearchHiveTblAction
+
+ if(classification != null) action.setParameter("classification",classification)
+ if(query!=null) action.setParameter("query",query)
+ if(owner == null) action.setParameter("owner","")
+ else action.setParameter("owner",owner)
+
+ action.setParameter("limit",limit)
+ action.setParameter("offset",offset)
+ action.setParameter("precise",precise.getCode)
+
+ action.setUser(user)
+ action
+ }
+ }
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/SearchLabelAction.scala b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/SearchLabelAction.scala
new file mode 100644
index 0000000000..031dc1ce32
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/SearchLabelAction.scala
@@ -0,0 +1,59 @@
+package com.webank.wedatasphere.dss.data.governance.request
+
+import org.apache.linkis.httpclient.request.GetAction
+
+class SearchLabelAction extends GetAction with DataAssetsAction{
+ override def suffixURLs: Array[String] = Array("data-assets", "asset", "labels","search")
+
+ private var user:String = _
+
+ override def setUser(user: String): Unit = this.user = user
+
+ override def getUser: String = this.user
+
+}
+object SearchLabelAction{
+ def builder(): Builder = new Builder
+
+ class Builder private[SearchLabelAction]() {
+
+ private var query:String=_
+
+ private var limit:Int=10
+ private var offset:Int=0
+ private var user: String = _
+
+ def setUser(user: String): Builder ={
+ this.user = user
+ this
+ }
+
+
+ def setQuery(query:String): Builder ={
+ this.query = query
+ this
+ }
+
+
+
+ def setLimit(limit:Int):Builder={
+ this.limit=limit
+ this
+ }
+
+ def setOffset(offset:Int):Builder={
+ this.offset=offset
+ this
+ }
+
+ def build(): SearchLabelAction = {
+ val action = new SearchLabelAction
+ if(query!=null) action.setParameter("query",query)
+ action.setParameter("limit",limit)
+ action.setParameter("offset",offset)
+ action.setUser(user)
+ action
+ }
+ }
+}
+
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/UnBindLabelAction.scala b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/UnBindLabelAction.scala
new file mode 100644
index 0000000000..1118c4bba2
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/UnBindLabelAction.scala
@@ -0,0 +1,86 @@
+package com.webank.wedatasphere.dss.data.governance.request
+
+import com.webank.wedatasphere.dss.data.governance.exception.DataAssetsClientBuilderException
+import org.apache.linkis.httpclient.dws.DWSHttpClient
+import org.apache.linkis.httpclient.request.POSTAction
+
+class UnBindLabelAction extends POSTAction with DataAssetsAction {
+
+ private var user: String = _
+
+ override def getRequestPayload: String = DWSHttpClient.jacksonJson.writeValueAsString(getRequestPayloads)
+
+ override def suffixURLs: Array[String] = Array("data-assets", "asset", "labels", "unbind")
+
+ override def setUser(user: String): Unit = this.user = user
+
+ override def getUser: String = this.user
+
+}
+
+object UnBindLabelAction {
+ def builder(): Builder = new Builder
+
+ class Builder private[UnBindLabelAction] {
+ private var user: String = _
+
+ private var label: String = _
+
+ private var labelGuid: String = _
+
+ private var tableName: String = _
+
+ private var tableGuid: String = _
+
+ private var relationGuid: String = _
+
+ def setUser(user: String): Builder = {
+ this.user = user
+ this
+ }
+
+ def setTableName(tableName: String): Builder = {
+ this.tableName = tableName;
+ this
+ }
+
+ def setLabel(label : String) :Builder={
+ this.label = label
+ this
+ }
+
+ def setTableGuid(tableGuid : String) : Builder = {
+ this.tableGuid = tableGuid
+ this
+ }
+
+ def setLabelGuid(labelGuid : String) : Builder = {
+ this.labelGuid = labelGuid
+ this
+ }
+
+ def setRelationGuid(relationGuid : String) : Builder = {
+ this.relationGuid = relationGuid
+ this
+ }
+
+ def build(): UnBindLabelAction = {
+ var action = new UnBindLabelAction;
+ if ((tableName == null || label == null) && (labelGuid == null || tableGuid == null || relationGuid == null)) throw new DataAssetsClientBuilderException("tableName and label ,or tableGuid and labelGuid and relationGuid are needed!")
+
+ action.setUser(user)
+ action.addRequestPayload("label", label)
+ action.addRequestPayload("tableName", tableName)
+ action.addRequestPayload("tableGuid", tableGuid)
+ action.addRequestPayload("labelGuid", labelGuid)
+ action.addRequestPayload("relationGuid", relationGuid)
+ action
+ }
+ }
+}
+
+
+
+
+
+
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/UnBindModelTypeAction.scala b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/UnBindModelTypeAction.scala
new file mode 100644
index 0000000000..ab123b4c73
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/UnBindModelTypeAction.scala
@@ -0,0 +1,87 @@
+package com.webank.wedatasphere.dss.data.governance.request
+
+import com.webank.wedatasphere.dss.data.governance.entity.ClassificationConstant
+import com.webank.wedatasphere.dss.data.governance.exception.DataAssetsClientBuilderException
+import org.apache.linkis.httpclient.dws.DWSHttpClient
+import org.apache.linkis.httpclient.request.POSTAction
+
+class UnBindModelTypeAction extends POSTAction with DataAssetsAction {
+
+ private var user: String = _
+
+ private var modelName: String = _
+
+ private var modelType: String = _
+
+ private var tableName: String = _
+
+ private var guid: String = _
+
+ override def getRequestPayload: String = DWSHttpClient.jacksonJson.writeValueAsString(getRequestPayloads)
+
+ override def setUser(user: String): Unit = this.user = user
+
+ override def getUser: String = this.user
+
+ override def suffixURLs: Array[String] = Array("data-assets", "asset", "model", "unbind")
+}
+
+object UnBindModelTypeAction {
+
+ def builder() = new Builder
+
+ class Builder private[UnBindModelTypeAction] {
+ private var user: String = _
+
+ private var modelName: String = _
+
+ private var modelType: ClassificationConstant = _
+
+ private var tableName: String = _
+
+ private var guid: String = _
+
+ def setUser(user: String): Builder = {
+ this.user = user
+ this
+ }
+
+ def setModelName(modelName: String): Builder = {
+ this.modelName = modelName;
+ this
+ }
+
+ def setModelType(modelType: ClassificationConstant): Builder = {
+ this.modelType = modelType;
+ this
+ }
+
+ def setTableName(tableName: String): Builder = {
+ this.tableName = tableName;
+ this
+ }
+
+ def setGuid(guid: String): Builder = {
+ this.guid = guid;
+ this
+ }
+
+ def build(): UnBindModelTypeAction = {
+ var action = new UnBindModelTypeAction;
+ if (tableName == null && guid == null) throw new DataAssetsClientBuilderException("tableName or guid is needed!")
+ if (modelType == null || modelName == null) throw new DataAssetsClientBuilderException("modelType and modelName is needed!")
+ action.setUser(user)
+ action.guid = guid
+ action.modelName = modelName
+ action.modelType = modelType.getTypeCode
+ action.tableName = tableName
+ action.addRequestPayload("guid", action.guid)
+ action.addRequestPayload("modelName", action.modelName)
+ action.addRequestPayload("modelType", action.modelType)
+ action.addRequestPayload("tableName", action.tableName)
+ action
+ }
+ }
+}
+
+
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/UpdateLabelAction.scala b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/UpdateLabelAction.scala
new file mode 100644
index 0000000000..e40e246ece
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/UpdateLabelAction.scala
@@ -0,0 +1,57 @@
+package com.webank.wedatasphere.dss.data.governance.request
+
+import com.webank.wedatasphere.dss.data.governance.exception.DataAssetsClientBuilderException
+import org.apache.linkis.httpclient.dws.DWSHttpClient
+import org.apache.linkis.httpclient.request.POSTAction
+
+class UpdateLabelAction extends POSTAction with DataAssetsAction {
+
+ private var user: String = _
+
+ override def getRequestPayload: String = DWSHttpClient.jacksonJson.writeValueAsString(getRequestPayloads)
+
+ override def suffixURLs: Array[String] = Array("data-assets", "asset", "labels","modify")
+
+ override def setUser(user: String): Unit = this.user = user
+
+ override def getUser: String = this.user
+
+}
+object UpdateLabelAction {
+ def builder(): Builder = new Builder
+
+ class Builder private[UpdateLabelAction]() {
+ private var user: String = _
+ private var name: String = _
+ private var orgName: String = _
+
+ def setUser(user: String): Builder = {
+ this.user = user
+ this
+ }
+
+ def setName(name: String): Builder = {
+ this.name = name
+ this
+ }
+
+ def setOrgName(orgName: String) : Builder = {
+ this.orgName = orgName
+ this
+ }
+
+ def build(): UpdateLabelAction = {
+ val action = new UpdateLabelAction
+ if (name == null) throw new DataAssetsClientBuilderException("name is needed!")
+ if (orgName == null) throw new DataAssetsClientBuilderException("orgName is needed!")
+ action.setUser(user)
+ action.addRequestPayload("name", this.name)
+ action.addRequestPayload("orgName", this.orgName)
+ action
+
+ }
+ }
+}
+
+
+
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/UpdateModelTypeAction.scala b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/UpdateModelTypeAction.scala
new file mode 100644
index 0000000000..66819ad6d7
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/request/UpdateModelTypeAction.scala
@@ -0,0 +1,72 @@
+package com.webank.wedatasphere.dss.data.governance.request
+
+import com.webank.wedatasphere.dss.data.governance.entity.ClassificationConstant
+import com.webank.wedatasphere.dss.data.governance.exception.DataAssetsClientBuilderException
+import org.apache.linkis.httpclient.dws.DWSHttpClient
+import org.apache.linkis.httpclient.request.POSTAction
+
+class UpdateModelTypeAction extends POSTAction with DataAssetsAction{
+
+
+ private var name:String= _
+
+ private var `type`:String= _
+
+ private var user:String = _
+
+ private var orgName:String = _
+
+ override def getRequestPayload: String = DWSHttpClient.jacksonJson.writeValueAsString(getRequestPayloads)
+
+ override def setUser(user: String): Unit = this.user = user
+
+ override def getUser: String = user
+
+ override def suffixURLs: Array[String] = Array("data-assets", "asset", "model","type","modify")
+}
+
+object UpdateModelTypeAction{
+ def builder(): Builder = new Builder
+
+ class Builder private[UpdateModelTypeAction]() {
+ private var user: String = _
+ private var name:String= _
+ private var `type`:ClassificationConstant= _
+ private var orgName:String = _
+ def setUser(user: String): Builder ={
+ this.user = user
+ this
+ }
+
+ def setName(name:String):Builder = {
+ this.name = name
+ this
+ }
+
+ def setOrgName(orgName:String):Builder = {
+ this.orgName = orgName
+ this
+ }
+
+ def setType(`type`:ClassificationConstant):Builder = {
+ this.`type` = `type`;
+ this;
+ }
+
+ def build(): UpdateModelTypeAction = {
+ val action = new UpdateModelTypeAction
+ if(`type` == null) throw new DataAssetsClientBuilderException("type is needed!")
+ if (name == null) throw new DataAssetsClientBuilderException("name is needed!")
+ if (orgName == null) throw new DataAssetsClientBuilderException("orgName is needed!")
+ action.name = name
+ action.`type` = `type`.getTypeCode
+ action.orgName = orgName
+ action.setUser(user)
+ action.addRequestPayload("name",action.name)
+ action.addRequestPayload("type",action.`type`)
+ action.addRequestPayload("orgName",action.orgName)
+ action
+ }
+ }
+
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/BindLabelResult.scala b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/BindLabelResult.scala
new file mode 100644
index 0000000000..750148ceb3
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/BindLabelResult.scala
@@ -0,0 +1,11 @@
+package com.webank.wedatasphere.dss.data.governance.response
+
+import org.apache.linkis.httpclient.dws.annotation.DWSHttpMessageResult
+import org.apache.linkis.httpclient.dws.response.DWSResult
+
+import scala.beans.BeanProperty
+
+@DWSHttpMessageResult("/api/rest_j/v\\d+/data-assets/asset/labels/bind")
+class BindLabelResult extends DWSResult{
+ @BeanProperty var result: Object = _
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/BindModelTypeResult.scala b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/BindModelTypeResult.scala
new file mode 100644
index 0000000000..c933afaf16
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/BindModelTypeResult.scala
@@ -0,0 +1,11 @@
+package com.webank.wedatasphere.dss.data.governance.response
+
+import org.apache.linkis.httpclient.dws.annotation.DWSHttpMessageResult
+import org.apache.linkis.httpclient.dws.response.DWSResult
+
+import scala.beans.BeanProperty
+
+@DWSHttpMessageResult("/api/rest_j/v\\d+/data-assets/asset/model/bind")
+class BindModelTypeResult extends DWSResult{
+ @BeanProperty var result: Object = _
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/CreateLabelResult.scala b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/CreateLabelResult.scala
new file mode 100644
index 0000000000..0184edda51
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/CreateLabelResult.scala
@@ -0,0 +1,20 @@
+package com.webank.wedatasphere.dss.data.governance.response
+
+import com.webank.wedatasphere.dss.data.governance.entity.CreateLabelInfo
+import org.apache.linkis.httpclient.dws.DWSHttpClient
+import org.apache.linkis.httpclient.dws.annotation.DWSHttpMessageResult
+import org.apache.linkis.httpclient.dws.response.DWSResult
+
+import scala.beans.BeanProperty
+
+
+@DWSHttpMessageResult("/api/rest_j/v\\d+/data-assets/asset/labels")
+class CreateLabelResult extends DWSResult{
+ @BeanProperty var result: java.util.Map[String, Any] = _
+
+
+ def getInfo : CreateLabelInfo ={
+ val str = DWSHttpClient.jacksonJson.writeValueAsString(result)
+ DWSHttpClient.jacksonJson.readValue(str, classOf[CreateLabelInfo])
+ }
+}
\ No newline at end of file
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/CreateModelTypeResult.scala b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/CreateModelTypeResult.scala
new file mode 100644
index 0000000000..b7de74ce42
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/CreateModelTypeResult.scala
@@ -0,0 +1,19 @@
+package com.webank.wedatasphere.dss.data.governance.response
+
+import com.webank.wedatasphere.dss.data.governance.entity.{CreateModelTypeInfo, HiveSimpleInfo}
+import org.apache.linkis.httpclient.dws.DWSHttpClient
+import org.apache.linkis.httpclient.dws.annotation.DWSHttpMessageResult
+import org.apache.linkis.httpclient.dws.response.DWSResult
+
+import scala.beans.BeanProperty
+
+@DWSHttpMessageResult("/api/rest_j/v\\d+/data-assets/asset/model/type")
+class CreateModelTypeResult extends DWSResult{
+ @BeanProperty var result: java.util.Map[String, Any] = _
+
+
+ def getInfo : CreateModelTypeInfo ={
+ val str = DWSHttpClient.jacksonJson.writeValueAsString(result)
+ DWSHttpClient.jacksonJson.readValue(str, classOf[CreateModelTypeInfo])
+ }
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/DeleteLabelResult.scala b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/DeleteLabelResult.scala
new file mode 100644
index 0000000000..6190890933
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/DeleteLabelResult.scala
@@ -0,0 +1,11 @@
+package com.webank.wedatasphere.dss.data.governance.response
+
+import org.apache.linkis.httpclient.dws.annotation.DWSHttpMessageResult
+import org.apache.linkis.httpclient.dws.response.DWSResult
+
+import scala.beans.BeanProperty
+
+@DWSHttpMessageResult("/api/rest_j/v\\d+/data-assets/asset/labels/delete")
+class DeleteLabelResult extends DWSResult{
+ @BeanProperty var result:Object = _
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/DeleteModelTypeResult.scala b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/DeleteModelTypeResult.scala
new file mode 100644
index 0000000000..381538aa17
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/DeleteModelTypeResult.scala
@@ -0,0 +1,11 @@
+package com.webank.wedatasphere.dss.data.governance.response
+
+import org.apache.linkis.httpclient.dws.annotation.DWSHttpMessageResult
+import org.apache.linkis.httpclient.dws.response.DWSResult
+
+import scala.beans.BeanProperty
+
+@DWSHttpMessageResult("/api/rest_j/v\\d+/data-assets/asset/model/type/delete")
+class DeleteModelTypeResult extends DWSResult{
+ @BeanProperty var result:Object = _
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/GetHiveTblBasicResult.scala b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/GetHiveTblBasicResult.scala
new file mode 100644
index 0000000000..7eb1dc6d94
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/GetHiveTblBasicResult.scala
@@ -0,0 +1,11 @@
+package com.webank.wedatasphere.dss.data.governance.response
+
+import org.apache.linkis.httpclient.dws.annotation.DWSHttpMessageResult
+import org.apache.linkis.httpclient.dws.response.DWSResult
+
+
+import scala.beans.BeanProperty
+@DWSHttpMessageResult("/api/rest_j/v\\d+/data-assets/asset/hiveTbl/(\\S+)/basic")
+class GetHiveTblBasicResult extends DWSResult{
+ @BeanProperty var result:Object = _
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/GetHiveTblCreateResult.scala b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/GetHiveTblCreateResult.scala
new file mode 100644
index 0000000000..4089d43511
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/GetHiveTblCreateResult.scala
@@ -0,0 +1,10 @@
+package com.webank.wedatasphere.dss.data.governance.response
+
+import org.apache.linkis.httpclient.dws.annotation.DWSHttpMessageResult
+import org.apache.linkis.httpclient.dws.response.DWSResult
+
+import scala.beans.BeanProperty
+@DWSHttpMessageResult("/api/rest_j/v\\d+/data-assets/asset/hiveTbl/(\\S+)/create")
+class GetHiveTblCreateResult extends DWSResult{
+ @BeanProperty var result:String = _
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/GetHiveTblPartInfoByNameResult.scala b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/GetHiveTblPartInfoByNameResult.scala
new file mode 100644
index 0000000000..7f5db0c3f0
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/GetHiveTblPartInfoByNameResult.scala
@@ -0,0 +1,22 @@
+package com.webank.wedatasphere.dss.data.governance.response
+
+import com.webank.wedatasphere.dss.data.governance.entity.{HiveSimpleInfo, PartInfo}
+import org.apache.linkis.httpclient.dws.DWSHttpClient
+import org.apache.linkis.httpclient.dws.annotation.DWSHttpMessageResult
+import org.apache.linkis.httpclient.dws.response.DWSResult
+
+import java.util
+import scala.beans.BeanProperty
+
+@DWSHttpMessageResult("/api/rest_j/v\\d+/data-assets/asset/hiveTbl/partition/name")
+class GetHiveTblPartInfoByNameResult extends DWSResult{
+ @BeanProperty var result:util.List[java.util.Map[String, Any]] = _
+
+ def getInfo: util.List[PartInfo] ={
+ import scala.collection.JavaConverters._
+ result.asScala.map(x=>{
+ val str = DWSHttpClient.jacksonJson.writeValueAsString(x)
+ DWSHttpClient.jacksonJson.readValue(str, classOf[PartInfo])
+ }).asJava
+ }
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/GetHiveTblPartitionResult.scala b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/GetHiveTblPartitionResult.scala
new file mode 100644
index 0000000000..ec7280f139
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/GetHiveTblPartitionResult.scala
@@ -0,0 +1,11 @@
+package com.webank.wedatasphere.dss.data.governance.response
+
+import org.apache.linkis.httpclient.dws.annotation.DWSHttpMessageResult
+import org.apache.linkis.httpclient.dws.response.DWSResult
+
+import java.util
+import scala.beans.BeanProperty
+@DWSHttpMessageResult("/api/rest_j/v\\d+/data-assets/asset/hiveTbl/(\\S+)/partition")
+class GetHiveTblPartitionResult extends DWSResult{
+ @BeanProperty var result:util.List[java.util.Map[String, Any]] = _
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/HiveTblSizeResult.scala b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/HiveTblSizeResult.scala
new file mode 100644
index 0000000000..fcd7a0edc1
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/HiveTblSizeResult.scala
@@ -0,0 +1,12 @@
+package com.webank.wedatasphere.dss.data.governance.response
+
+import org.apache.linkis.httpclient.dws.annotation.DWSHttpMessageResult
+import org.apache.linkis.httpclient.dws.response.DWSResult
+
+import java.util
+import scala.beans.BeanProperty
+
+@DWSHttpMessageResult("/api/rest_j/v\\d+/data-assets/asset/hiveTbl/size")
+class HiveTblSizeResult extends DWSResult{
+ @BeanProperty var result: Long = _
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/HiveTblStatsResult.scala b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/HiveTblStatsResult.scala
new file mode 100644
index 0000000000..07ec55fcfa
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/HiveTblStatsResult.scala
@@ -0,0 +1,19 @@
+package com.webank.wedatasphere.dss.data.governance.response
+
+import com.webank.wedatasphere.dss.data.governance.entity.{CreateModelTypeInfo, HiveTblStatsDTO}
+import org.apache.linkis.httpclient.dws.DWSHttpClient
+import org.apache.linkis.httpclient.dws.annotation.DWSHttpMessageResult
+import org.apache.linkis.httpclient.dws.response.DWSResult
+
+import scala.beans.BeanProperty
+
+@DWSHttpMessageResult("/api/rest_j/v\\d+/data-assets/asset/hiveTbl/stats")
+class HiveTblStatsResult extends DWSResult{
+ @BeanProperty var result: java.util.Map[String, Any] = _
+
+
+ def getInfo : HiveTblStatsDTO ={
+ val str = DWSHttpClient.jacksonJson.writeValueAsString(result)
+ DWSHttpClient.jacksonJson.readValue(str, classOf[HiveTblStatsDTO])
+ }
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/SearchHiveDbResult.scala b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/SearchHiveDbResult.scala
new file mode 100644
index 0000000000..b3760fc36c
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/SearchHiveDbResult.scala
@@ -0,0 +1,22 @@
+package com.webank.wedatasphere.dss.data.governance.response
+
+import com.webank.wedatasphere.dss.data.governance.entity.HiveSimpleInfo
+import org.apache.linkis.httpclient.dws.DWSHttpClient
+import org.apache.linkis.httpclient.dws.annotation.DWSHttpMessageResult
+import org.apache.linkis.httpclient.dws.response.DWSResult
+
+import java.util
+import scala.beans.BeanProperty
+
+@DWSHttpMessageResult("/api/rest_j/v\\d+/data-assets/asset/hiveDb/search")
+class SearchHiveDbResult extends DWSResult{
+ @BeanProperty var result:util.List[java.util.Map[String, Any]] = _
+
+ def getHiveList: util.List[HiveSimpleInfo] ={
+ import scala.collection.JavaConverters._
+ result.asScala.map(x=>{
+ val str = DWSHttpClient.jacksonJson.writeValueAsString(x)
+ DWSHttpClient.jacksonJson.readValue(str, classOf[HiveSimpleInfo])
+ }).asJava
+ }
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/SearchHiveTblResult.scala b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/SearchHiveTblResult.scala
new file mode 100644
index 0000000000..d79db99515
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/SearchHiveTblResult.scala
@@ -0,0 +1,22 @@
+package com.webank.wedatasphere.dss.data.governance.response
+
+import com.webank.wedatasphere.dss.data.governance.entity.HiveSimpleInfo
+import org.apache.linkis.httpclient.dws.DWSHttpClient
+import org.apache.linkis.httpclient.dws.annotation.DWSHttpMessageResult
+import org.apache.linkis.httpclient.dws.response.DWSResult
+
+import java.util
+import scala.beans.BeanProperty
+
+@DWSHttpMessageResult("/api/rest_j/v\\d+/data-assets/asset/hiveTbl/search")
+class SearchHiveTblResult extends DWSResult{
+ @BeanProperty var result:util.List[java.util.Map[String, Any]] = _
+
+ def getHiveList: util.List[HiveSimpleInfo] ={
+ import scala.collection.JavaConverters._
+ result.asScala.map(x=>{
+ val str = DWSHttpClient.jacksonJson.writeValueAsString(x)
+ DWSHttpClient.jacksonJson.readValue(str, classOf[HiveSimpleInfo])
+ }).asJava
+ }
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/SearchLabelResult.scala b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/SearchLabelResult.scala
new file mode 100644
index 0000000000..51f17913c1
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/SearchLabelResult.scala
@@ -0,0 +1,22 @@
+package com.webank.wedatasphere.dss.data.governance.response
+
+import com.webank.wedatasphere.dss.data.governance.entity.{HiveSimpleInfo, SearchLabelInfo}
+import org.apache.linkis.httpclient.dws.DWSHttpClient
+import org.apache.linkis.httpclient.dws.annotation.DWSHttpMessageResult
+import org.apache.linkis.httpclient.dws.response.DWSResult
+
+import java.util
+import scala.beans.BeanProperty
+
+@DWSHttpMessageResult("/api/rest_j/v\\d+/data-assets/asset/labels/search")
+class SearchLabelResult extends DWSResult{
+ @BeanProperty var result:util.List[java.util.Map[String, Any]] = _
+
+ def getLabelList: util.List[SearchLabelInfo] ={
+ import scala.collection.JavaConverters._
+ result.asScala.map(x=>{
+ val str = DWSHttpClient.jacksonJson.writeValueAsString(x)
+ DWSHttpClient.jacksonJson.readValue(str, classOf[SearchLabelInfo])
+ }).asJava
+ }
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/UnBindLabelResult.scala b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/UnBindLabelResult.scala
new file mode 100644
index 0000000000..a0b1fb7121
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/UnBindLabelResult.scala
@@ -0,0 +1,11 @@
+package com.webank.wedatasphere.dss.data.governance.response
+
+import org.apache.linkis.httpclient.dws.annotation.DWSHttpMessageResult
+import org.apache.linkis.httpclient.dws.response.DWSResult
+
+import scala.beans.BeanProperty
+
+@DWSHttpMessageResult("/api/rest_j/v\\d+/data-assets/asset/labels/unbind")
+class UnBindLabelResult extends DWSResult{
+ @BeanProperty var result: Object = _
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/UnBindModelTypeResult.scala b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/UnBindModelTypeResult.scala
new file mode 100644
index 0000000000..a0be9615c2
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/UnBindModelTypeResult.scala
@@ -0,0 +1,11 @@
+package com.webank.wedatasphere.dss.data.governance.response
+
+import org.apache.linkis.httpclient.dws.annotation.DWSHttpMessageResult
+import org.apache.linkis.httpclient.dws.response.DWSResult
+
+import scala.beans.BeanProperty
+
+@DWSHttpMessageResult("/api/rest_j/v\\d+/data-assets/asset/model/unbind")
+class UnBindModelTypeResult extends DWSResult{
+ @BeanProperty var result: Object = _
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/UpdateLabelResult.scala b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/UpdateLabelResult.scala
new file mode 100644
index 0000000000..913ee3adb3
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/UpdateLabelResult.scala
@@ -0,0 +1,20 @@
+package com.webank.wedatasphere.dss.data.governance.response
+
+import com.webank.wedatasphere.dss.data.governance.entity.UpdateLabelInfo
+import org.apache.linkis.httpclient.dws.DWSHttpClient
+import org.apache.linkis.httpclient.dws.annotation.DWSHttpMessageResult
+import org.apache.linkis.httpclient.dws.response.DWSResult
+
+import scala.beans.BeanProperty
+
+
+@DWSHttpMessageResult("/api/rest_j/v\\d+/data-assets/asset/labels/modify")
+class UpdateLabelResult extends DWSResult{
+ @BeanProperty var result: java.util.Map[String, Any] = _
+
+
+ def getInfo : UpdateLabelInfo ={
+ val str = DWSHttpClient.jacksonJson.writeValueAsString(result)
+ DWSHttpClient.jacksonJson.readValue(str, classOf[UpdateLabelInfo])
+ }
+}
\ No newline at end of file
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/UpdateModelTypeResult.scala b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/UpdateModelTypeResult.scala
new file mode 100644
index 0000000000..2d9359e5c8
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/main/scala/com/webank/wedatasphere/dss/data/governance/response/UpdateModelTypeResult.scala
@@ -0,0 +1,19 @@
+package com.webank.wedatasphere.dss.data.governance.response
+
+import com.webank.wedatasphere.dss.data.governance.entity.{CreateModelTypeInfo, UpdateModelTypeInfo}
+import org.apache.linkis.httpclient.dws.DWSHttpClient
+import org.apache.linkis.httpclient.dws.annotation.DWSHttpMessageResult
+import org.apache.linkis.httpclient.dws.response.DWSResult
+
+import scala.beans.BeanProperty
+
+@DWSHttpMessageResult("/api/rest_j/v\\d+/data-assets/asset/model/type/modify")
+class UpdateModelTypeResult extends DWSResult{
+ @BeanProperty var result: java.util.Map[String, Any] = _
+
+
+ def getInfo : UpdateModelTypeInfo ={
+ val str = DWSHttpClient.jacksonJson.writeValueAsString(result)
+ DWSHttpClient.jacksonJson.readValue(str, classOf[UpdateModelTypeInfo])
+ }
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-client/src/test/scala/com/webank/wedatasphere/dss/data/governance/TestDataAssetsRemoteClient.scala b/dss-apps/dss-dataasset-management/data-assets-client/src/test/scala/com/webank/wedatasphere/dss/data/governance/TestDataAssetsRemoteClient.scala
new file mode 100644
index 0000000000..67a61673f4
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-client/src/test/scala/com/webank/wedatasphere/dss/data/governance/TestDataAssetsRemoteClient.scala
@@ -0,0 +1,108 @@
+package com.webank.wedatasphere.dss.data.governance
+
+import com.webank.wedatasphere.dss.data.governance.impl.LinkisDataAssetsRemoteClient
+import com.webank.wedatasphere.dss.data.governance.request.{GetHiveTblPartitionAction, GetTblPartInfoByNameAction}
+import org.apache.linkis.httpclient.dws.config.DWSClientConfigBuilder
+
+import java.util.concurrent.TimeUnit
+import scala.Console.println
+
+
+object TestDataAssetsRemoteClient {
+ def main(args: Array[String]): Unit = {
+ val clientConfig = DWSClientConfigBuilder.newBuilder()
+ .addServerUrl("http://localhost:20082")
+ .connectionTimeout(30000)
+ .discoveryEnabled(false)
+ .discoveryFrequency(1,TimeUnit.MINUTES)
+ .loadbalancerEnabled(true)
+ .maxConnectionSize(5)
+ .retryEnabled(false)
+ .readTimeout(30000)
+ .setAuthenticationStrategy(null)
+ .setAuthTokenKey("hdfs")
+ .setAuthTokenValue("hdfs")
+ .setDWSVersion("v1")
+ .build()
+
+ val dataAssetsClient = new LinkisDataAssetsRemoteClient(clientConfig)
+//
+// val searchHiveTblResult = dataAssetsClient.searchHiveTbl(SearchHiveTblAction.builder().setUser("hdfs").setQuery("").setLimit(10).setOffset(0).setOwner("undefined").build()).getHiveList
+// println(searchHiveTblResult)
+//
+// val searchHiveDbResult = dataAssetsClient.searchHiveDb(SearchHiveDbAction.builder().setUser("hdfs").setQuery("").setLimit(10).setOffset(0).setOwner("undefined").build()).getHiveList
+// println(searchHiveDbResult)
+//
+// val hiveTblBasicResult = dataAssetsClient
+// .getHiveTblBasic(GetHiveTblBasicAction.builder().setUser("hdfs").setGuid("27920dc8-1eef-4d7d-9423-b5967d9e2d33").build())
+// .result
+// println(hiveTblBasicResult)
+//
+ val hiveTblPartitionResult = dataAssetsClient.getHiveTblPartition(GetHiveTblPartitionAction.builder().setUser("hdfs").setGuid("a3be4a97-6465-4c3d-adee-76dfa662e531").build()).result
+ println(hiveTblPartitionResult)
+//
+// val hiveTblCreateResult = dataAssetsClient.getHiveTblCreate(GetHiveTblCreateAction.builder().setUser("hdfs").setGuid("a3be4a97-6465-4c3d-adee-76dfa662e531").build()).result
+// println(hiveTblCreateResult)
+//
+// val deleteModelTypeResult = dataAssetsClient.deleteModelType(DeleteModelTypeAction.builder().setUser("hdfs").setType(ClassificationConstant.INDICATOR).setName("test004").build())
+// println(deleteModelTypeResult.getResult)
+//
+// val createModelTypeResult = dataAssetsClient.createModelType(CreateModelTypeAction.builder().setUser("hdfs").setType(ClassificationConstant.INDICATOR).setName("test004").build()).getInfo
+// println(createModelTypeResult)
+//
+// val updateModelTypeResult =dataAssetsClient.updateModelType(UpdateModelTypeAction.builder().setUser("hdfs").setType(ClassificationConstant.INDICATOR).setName("test000NEW").setOrgName("test000").build())
+// println(updateModelTypeResult.getInfo.getGuid)
+// println(updateModelTypeResult.getInfo.getName)
+//
+// val bindResult = dataAssetsClient.bindModelType(BindModelTypeAction.builder()
+// .setUser("hdfs")
+// .setTableName("default.test02")
+// .setModelName("test001")
+// .setModelType(ClassificationConstant.INDICATOR).build())
+// println(bindResult.getResult)
+
+// val unBindResult = dataAssetsClient.unBindModelType(UnBindModelTypeAction.builder()
+// .setUser("hdfs")
+// .setTableName("default.test02")
+// .setModelName("test001")
+// .setModelType(ClassificationConstant.INDICATOR).build())
+// println(unBindResult.getResult)
+
+// val hiveTableSizeResult = dataAssetsClient.searchHiveTblSize(HiveTblSizeAction.builder()
+// .setUser("hdfs")
+// .setTableName("test04")
+// .setDbName("default").build())
+// println(hiveTableSizeResult.getResult)
+// val hiveTableStatsResult = dataAssetsClient.searchHiveTblStats(HiveTblStatsAction.builder()
+// .setUser("hdfs")
+// .setTableName("test04")
+// .setDbName("default").build())
+// println(hiveTableStatsResult.getResult)
+
+// val searchLabelResult = dataAssetsClient.searchLabel(SearchLabelAction.builder().setUser("hdfs").setQuery("t").build());
+// println(searchLabelResult.getLabelList)
+//
+// val createLabelResult = dataAssetsClient.createLabel(CreateLabelAction.builder().setUser("hdfs").setName("label007").build())
+// println(createLabelResult.getInfo)
+//
+// TimeUnit.SECONDS.sleep(5)
+//
+// val bindLabelResult = dataAssetsClient.bindLabel(BindLabelAction.builder().setUser("hdfs").setLabel("term1").setTableName("linkis_db.linkis_test01").build())
+// println(bindLabelResult.getResult)
+////
+// val unbindLabelResult = dataAssetsClient.unBindLabel(UnBindLabelAction.builder().setUser("hdfs").setLabel("term1").setTableName("linkis_db.linkis_test01").build())
+// println(unbindLabelResult.getResult)
+//
+// val updateLabelResult = dataAssetsClient.updateLabel(UpdateLabelAction.builder().setUser("hdfs").setName("label008").setOrgName("label007").build())
+// println(updateLabelResult.getInfo)
+//
+// val deleteLabelResult = dataAssetsClient.deleteLabel(DeleteLabelAction.builder().setUser("hdfs").setName("label008").build())
+// println(deleteLabelResult.getResult)
+
+//
+// println(hiveTableStatsResult.getResult)
+
+ val partInfo = dataAssetsClient.getHiveTblPartInfoByNameResult(GetTblPartInfoByNameAction.builder().setUser("hdfs").setDbName("linkis_db").setTableName("linkis_partitions").build())
+ println(partInfo.getInfo)
+ }
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-server/bin/start-assets.sh b/dss-apps/dss-dataasset-management/data-assets-server/bin/start-assets.sh
new file mode 100755
index 0000000000..b5390ff9c1
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-server/bin/start-assets.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+cd `dirname $0`
+cd ..
+HOME=`pwd`
+
+export SERVER_PID=$HOME/bin/linkis.pid
+export SERVER_LOG_PATH=$HOME/logs
+export SERVER_CLASS=com.webank.wedatasphere.dss.data.governance.DataAssetsApplication
+
+if test -z "$SERVER_HEAP_SIZE"
+then
+ export SERVER_HEAP_SIZE="512M"
+fi
+
+if test -z "$SERVER_JAVA_OPTS"
+then
+ export SERVER_JAVA_OPTS=" -Xmx$SERVER_HEAP_SIZE -XX:+UseG1GC -Xloggc:$HOME/logs/linkis-gc.log"
+fi
+
+if [[ -f "${SERVER_PID}" ]]; then
+ pid=$(cat ${SERVER_PID})
+ if kill -0 ${pid} >/dev/null 2>&1; then
+ echo "Server is already running."
+ exit 1
+ fi
+fi
+
+nohup java $SERVER_JAVA_OPTS -cp $HOME/conf:$HOME/lib/* $SERVER_CLASS 2>&1 > $SERVER_LOG_PATH/linkis.out &
+pid=$!
+if [[ -z "${pid}" ]]; then
+ echo "server $SERVER_NAME start failed!"
+ exit 1
+else
+ echo "server $SERVER_NAME start succeeded!"
+ echo $pid > $SERVER_PID
+ sleep 1
+fi
\ No newline at end of file
diff --git a/dss-apps/dss-dataasset-management/data-assets-server/bin/stop-assets.sh b/dss-apps/dss-dataasset-management/data-assets-server/bin/stop-assets.sh
new file mode 100755
index 0000000000..f032887111
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-server/bin/stop-assets.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+
+cd `dirname $0`
+cd ..
+HOME=`pwd`
+
+export SERVER_PID=$HOME/bin/linkis.pid
+
+function wait_for_server_to_die() {
+ local pid
+ local count
+ pid=$1
+ timeout=$2
+ count=0
+ timeoutTime=$(date "+%s")
+ let "timeoutTime+=$timeout"
+ currentTime=$(date "+%s")
+ forceKill=1
+
+ while [[ $currentTime -lt $timeoutTime ]]; do
+ $(kill ${pid} > /dev/null 2> /dev/null)
+ if kill -0 ${pid} > /dev/null 2>&1; then
+ sleep 3
+ else
+ forceKill=0
+ break
+ fi
+ currentTime=$(date "+%s")
+ done
+
+ if [[ forceKill -ne 0 ]]; then
+ $(kill -9 ${pid} > /dev/null 2> /dev/null)
+ fi
+}
+
+if [[ ! -f "${SERVER_PID}" ]]; then
+ echo "server $SERVER_NAME is not running"
+else
+ pid=$(cat ${SERVER_PID})
+ if [[ -z "${pid}" ]]; then
+ echo "server $SERVER_NAME is not running"
+ else
+ wait_for_server_to_die $pid 40
+ $(rm -f ${SERVER_PID})
+ echo "server $SERVER_NAME is stopped."
+ fi
+fi
\ No newline at end of file
diff --git a/dss-apps/dss-dataasset-management/data-assets-server/pom.xml b/dss-apps/dss-dataasset-management/data-assets-server/pom.xml
new file mode 100644
index 0000000000..1bd85be8ee
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-server/pom.xml
@@ -0,0 +1,153 @@
+
+
+
+ dss-dataasset-management
+ com.webank.wedatasphere.dss
+ 1.0.1
+
+ 4.0.0
+
+ data-assets-server
+
+
+ 2.2.0
+ 8
+ 8
+
+
+
+
+ org.apache.linkis
+ linkis-module
+ ${linkis.version}
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+
+
+ com.fasterxml.jackson.core
+ jackson-core
+
+
+
+
+ org.apache.commons
+ commons-math3
+
+
+ xstream
+ com.thoughtworks.xstream
+
+
+
+ org.apache.linkis
+ linkis-mybatis
+ ${linkis.version}
+
+
+
+ org.apache.atlas
+ atlas-client-v2
+ ${atlas.version}
+
+
+ com.google.guava
+ guava
+
+
+
+
+ org.projectlombok
+ lombok
+ 1.18.16
+ compile
+
+
+
+ com.alibaba
+ druid
+ 1.1.9
+
+
+
+ com.webank.wedatasphere.dss
+ dss-framework-workspace-client
+ 1.0.1
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-deploy-plugin
+
+
+
+ net.alchim31.maven
+ scala-maven-plugin
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+
+
+ org.apache.maven.plugins
+ maven-assembly-plugin
+ 2.3
+ false
+
+
+ make-assembly
+ package
+
+ single
+
+
+
+ src/main/assembly/distribution.xml
+
+
+
+
+
+ false
+ data-assets-server
+ false
+ false
+
+ src/main/assembly/distribution.xml
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+ 8
+
+
+
+
+
+ src/main/java
+
+ **/*.xml
+
+
+
+ src/main/resources
+
+ **/*.xml
+ **/*.properties
+ **/*.yml
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dss-apps/dss-dataasset-management/data-assets-server/src/main/assembly/distribution.xml b/dss-apps/dss-dataasset-management/data-assets-server/src/main/assembly/distribution.xml
new file mode 100644
index 0000000000..eed259d1b4
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-server/src/main/assembly/distribution.xml
@@ -0,0 +1,72 @@
+
+
+
+ data-assets-server
+
+ zip
+
+ true
+ data-assets-server
+
+
+
+
+
+ lib
+ true
+ true
+ false
+ false
+ true
+
+
+
+
+
+ ${basedir}/src/main/resources
+
+ *
+
+ 0777
+ conf
+ unix
+
+
+ ${basedir}/bin
+
+ *
+
+ 0777
+ bin
+ unix
+
+
+ .
+
+ */**
+
+ logs
+
+
+
+
+
diff --git a/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/atlas/AtlasClient.java b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/atlas/AtlasClient.java
new file mode 100644
index 0000000000..fbcda8ddc4
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/atlas/AtlasClient.java
@@ -0,0 +1,276 @@
+package com.webank.wedatasphere.dss.data.governance.atlas;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+import com.google.gson.Gson;
+import com.sun.jersey.core.util.MultivaluedMapImpl;
+import com.webank.wedatasphere.dss.data.governance.entity.GlossaryConstant;
+import org.apache.atlas.AtlasClientV2;
+import org.apache.atlas.AtlasServiceException;
+import org.apache.atlas.model.discovery.SearchParameters;
+import org.apache.atlas.model.glossary.AtlasGlossaryTerm;
+import org.apache.atlas.model.glossary.relations.AtlasGlossaryHeader;
+import org.apache.atlas.model.instance.AtlasRelatedObjectId;
+import org.apache.atlas.model.lineage.AtlasLineageInfo;
+import org.apache.atlas.model.typedef.AtlasClassificationDef;
+import org.apache.atlas.model.typedef.AtlasTypesDef;
+import org.apache.commons.configuration.Configuration;
+
+import javax.ws.rs.HttpMethod;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Response;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+
+public class AtlasClient extends AtlasClientV2 {
+ // Entities APIs
+ public static final String ENTITIES_API = BASE_URI + "entities/";
+ public static final String UPDATE_ENTITY_ATTR_API = ENTITY_API + "guid/";
+ public static final String SET_ENTITY_LABELS_BY_GUID_TEMPLATE = ENTITY_API + "/guid/%s/labels";
+ public static final String GET_ENTITY_HEADER_BY_GUID_TEMPLATE = ENTITY_API + "/guid/{guid}/header";
+ private final Gson gson = new Gson();
+
+ public AtlasClient(Configuration configuration,String[] baseUrl, String[] basicAuthUserNamePassword) {
+ super(configuration,baseUrl, basicAuthUserNamePassword);
+ }
+
+ /**
+ * 获取所有的hive db实体
+ */
+ public String getHiveDbs() throws AtlasServiceException {
+ MultivaluedMap queryParams = new MultivaluedMapImpl();
+ queryParams.add("type", "hive_db");
+ return callAPI(API_V3.GET_ENTITIES, String.class, queryParams);
+ }
+
+ /**
+ * 获取所有的hive table实体
+ */
+ public String getHiveTables() throws AtlasServiceException {
+ MultivaluedMap queryParams = new MultivaluedMapImpl();
+ queryParams.add("type", "hive_table");
+ return callAPI(API_V3.GET_ENTITIES, String.class, queryParams);
+ }
+
+ /**
+ * 获取表实体的血缘信息
+ */
+ public String getLineageInfoForString(final String guid, final AtlasLineageInfo.LineageDirection direction, final int depth) throws AtlasServiceException {
+ MultivaluedMap queryParams = new MultivaluedMapImpl();
+ queryParams.add("direction", direction.toString());
+ queryParams.add("depth", String.valueOf(depth));
+
+ return callAPI(API_V2.LINEAGE_INFO, String.class, queryParams, guid);
+ }
+
+ /**
+ * 获取实体信息
+ */
+ public String getEntityByGuidForString(String guid) throws AtlasServiceException {
+ return getEntityByGuidForString(guid, false, false);
+ }
+
+ /**
+ * 获取实体信息
+ */
+ public String getEntityByGuidForString(String guid, boolean minExtInfo, boolean ignoreRelationships) throws AtlasServiceException {
+ MultivaluedMap queryParams = new MultivaluedMapImpl();
+
+ queryParams.add("minExtInfo", String.valueOf(minExtInfo));
+ queryParams.add("ignoreRelationships", String.valueOf(ignoreRelationships));
+
+ return callAPI(API_V2.GET_ENTITY_BY_GUID, String.class, queryParams, guid);
+ }
+
+ public String getEntitiesByGuidsForString(List guids) throws AtlasServiceException {
+ return getEntitiesByGuidsForString(guids, false, false);
+ }
+
+ public String getEntitiesByGuidsForString(List guids, boolean minExtInfo, boolean ignoreRelationships) throws AtlasServiceException {
+ MultivaluedMap queryParams = new MultivaluedMapImpl();
+
+ queryParams.put("guid", guids);
+ queryParams.add("minExtInfo", String.valueOf(minExtInfo));
+ queryParams.add("ignoreRelationships", String.valueOf(ignoreRelationships));
+
+ return callAPI(API_V2.GET_ENTITIES_BY_GUIDS, String.class, queryParams);
+ }
+
+ /**
+ * 获取实体基本信息
+ */
+ public String getHeaderByIdForString(String guid) throws AtlasServiceException {
+ API api = new API(String.format(GET_ENTITY_HEADER_BY_GUID_TEMPLATE, guid), HttpMethod.GET, Response.Status.OK);
+ return callAPI(api, String.class,null);
+ }
+
+ /**
+ * 根据关键字检索实体
+ */
+ public String basicSearchForString(final String typeName, final String classification, final String query,
+ final boolean excludeDeletedEntities, final int limit, final int offset) throws AtlasServiceException {
+ MultivaluedMap queryParams = new MultivaluedMapImpl();
+ queryParams.add("typeName", typeName);
+ queryParams.add("classification", classification);
+ queryParams.add(QUERY, query);
+ queryParams.add("excludeDeletedEntities", String.valueOf(excludeDeletedEntities));
+ queryParams.add(LIMIT, String.valueOf(limit));
+ queryParams.add(OFFSET, String.valueOf(offset));
+
+ return callAPI(API_V2.BASIC_SEARCH, String.class, queryParams);
+ }
+
+
+ /**
+ * 创建子类型
+ * @param name
+ * @param superType
+ * @return
+ * @throws AtlasServiceException
+ */
+ public String createSubClassification(String name, String superType) throws AtlasServiceException {
+ AtlasClassificationDef atlasClassificationDef = new AtlasClassificationDef();
+ atlasClassificationDef.setName(name);
+ atlasClassificationDef.setSuperTypes(Sets.newHashSet(superType));
+ AtlasTypesDef atlasTypesDef = new AtlasTypesDef();
+ atlasTypesDef.setClassificationDefs(Lists.newArrayList(atlasClassificationDef));
+ MultivaluedMap params = new MultivaluedMapImpl();
+ params.add("type","classification");
+ return callAPI(AtlasClientV2.API_V2.CREATE_TYPE_DEFS, String.class, gson.toJson(atlasTypesDef),params);
+ }
+
+ // Glossary APIs
+ public String getAllGlossaries() throws AtlasServiceException {
+ MultivaluedMap queryParams = new MultivaluedMapImpl();
+
+ queryParams.add(LIMIT, "99999");
+ queryParams.add(OFFSET, "0");
+
+ return callAPI(API_V2.GET_ALL_GLOSSARIES, String.class, queryParams);
+ }
+
+ /**
+ * 新建分词
+ * @param name
+ * @param rootGuid
+ * @return
+ * @throws AtlasServiceException
+ */
+ public String createGlossaryTerm(String name,String rootGuid) throws AtlasServiceException {
+ AtlasGlossaryTerm glossaryTerm = new AtlasGlossaryTerm();
+ glossaryTerm.setName(name);
+ AtlasGlossaryHeader anchor = new AtlasGlossaryHeader();
+ anchor.setGlossaryGuid(rootGuid);
+ glossaryTerm.setAnchor(anchor);
+ return callAPI(API_V2.CREATE_GLOSSARY_TERM, String.class, gson.toJson(glossaryTerm));
+ }
+
+ /**
+ * 根据名称 查询分词详情
+ * @param glossaryConstant
+ * @param name
+ * @return
+ * @throws AtlasServiceException
+ */
+ public String attributeSearchByName(GlossaryConstant glossaryConstant, String name) throws AtlasServiceException {
+ return attributeSearch0(glossaryConstant.getAtlasType(),glossaryConstant.formatQuery(name), GlossaryConstant.ARR,1,0);
+ }
+
+ public String attributeSearch0(String typeName, String name, String attrName, Integer limit, Integer offset) throws AtlasServiceException {
+ MultivaluedMap queryParams = new MultivaluedMapImpl();
+
+ queryParams.add("attrName", attrName);
+ queryParams.add("attrValuePrefix",name);
+ queryParams.add("typeName", typeName);
+ queryParams.add(LIMIT, limit+"");
+ queryParams.add(OFFSET, offset+"");
+
+ return callAPI(API_V2.ATTRIBUTE_SEARCH, String.class, queryParams);
+ }
+
+
+ /**
+ * 实体绑定分词
+ * @param termGuid
+ * @param entityGuids
+ * @throws AtlasServiceException
+ */
+ public void assignTermToEntities0(String termGuid, List entityGuids) throws AtlasServiceException {
+ List relatedObjectIds = entityGuids.stream().map(entityGuid->{AtlasRelatedObjectId atlasRelatedObjectId = new AtlasRelatedObjectId();
+ atlasRelatedObjectId.setGuid(entityGuid);
+ return atlasRelatedObjectId;
+ }).collect(Collectors.toList());
+ callAPI(formatPathParameters(API_V2.ASSIGN_TERM_TO_ENTITIES, termGuid), (Class>) null, gson.toJson(relatedObjectIds));
+ }
+
+ /**
+ * 解绑实体
+ * @param termGuid
+ * @param
+ * @throws AtlasServiceException
+ */
+ public void disassociateTermFromEntities0(String termGuid, List relatedObjectIds) throws AtlasServiceException {
+ callAPI(formatPathParameters(API_V2.DISASSOCIATE_TERM_FROM_ENTITIES, termGuid), (Class>) null, gson.toJson(relatedObjectIds));
+ }
+
+ /**
+ * 根据关键字检索实体
+ */
+ public String basicSearchPostForString(final String typeName, final String classification, final String query,final String termName,
+ final boolean excludeDeletedEntities, final int limit, final int offset) throws AtlasServiceException {
+ SearchParameters searchParameters = new SearchParameters();
+ Set returnColumnsParams = Sets.newHashSet("aliases", "parameters", "lastAccessTime","comment");
+ searchParameters.setTypeName(typeName);
+ searchParameters.setClassification(classification);
+ searchParameters.setQuery(query);
+ searchParameters.setLimit(limit);
+ searchParameters.setTermName(termName);
+ searchParameters.setOffset(offset);
+ searchParameters.setIncludeSubClassifications(true);
+ searchParameters.setIncludeSubTypes(true);
+ searchParameters.setIncludeClassificationAttributes(true);
+ searchParameters.setExcludeDeletedEntities(excludeDeletedEntities);
+ searchParameters.setAttributes(returnColumnsParams);
+ return callAPI(AtlasClientV2.API_V2.FACETED_SEARCH, String.class, gson.toJson(searchParameters),new MultivaluedMapImpl());
+ }
+
+ /**
+ * 修改实体的注释
+ */
+ public String modifyComment(String guid,String commentStr) throws AtlasServiceException {
+ MultivaluedMap queryParams = new MultivaluedMapImpl();
+ queryParams.add("name", "comment");
+
+ return callAPI(API_V3.UPDATE_ENTITY_ATTR,String.class,commentStr,queryParams,guid);
+ }
+
+ /**
+ * 获取分词详情
+ * @param termGuid
+ * @return
+ * @throws AtlasServiceException
+ */
+ public String getGlossaryTerm0(String termGuid) throws AtlasServiceException {
+
+ return callAPI(API_V2.GET_GLOSSARY_TERM, String.class, null, termGuid);
+ }
+
+ /**
+ * 设置实体的标签
+ */
+ public void setLabels(String guid, Set labels) throws AtlasServiceException {
+ API api = new API(String.format(SET_ENTITY_LABELS_BY_GUID_TEMPLATE, guid), HttpMethod.POST, Response.Status.NO_CONTENT);
+ callAPI(api, (Class>)null, labels);
+ }
+
+ public static class API_V3 extends API {
+ public static final API_V3 GET_ENTITIES = new API_V3(ENTITIES_API, HttpMethod.GET, Response.Status.OK);
+ public static final API_V3 UPDATE_ENTITY_ATTR = new API_V3(UPDATE_ENTITY_ATTR_API,HttpMethod.PUT,Response.Status.OK);
+
+ private API_V3(String path, String method, Response.Status status) {
+ super(path, method, status);
+ }
+ }
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/atlas/AtlasService.java b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/atlas/AtlasService.java
new file mode 100644
index 0000000000..3a5046ee5f
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/atlas/AtlasService.java
@@ -0,0 +1,358 @@
+package com.webank.wedatasphere.dss.data.governance.atlas;
+
+import com.google.common.collect.Lists;
+import com.google.gson.*;
+import com.google.gson.reflect.TypeToken;
+import com.sun.jersey.core.util.MultivaluedMapImpl;
+import com.webank.wedatasphere.dss.data.governance.conf.GovernanceConf;
+import com.webank.wedatasphere.dss.data.governance.entity.GlossaryConstant;
+import com.webank.wedatasphere.dss.data.governance.entity.RelatedObjectId;
+import com.webank.wedatasphere.dss.data.governance.exception.DataGovernanceException;
+import org.apache.atlas.ApplicationProperties;
+import org.apache.atlas.AtlasClientV2;
+import org.apache.atlas.AtlasException;
+import org.apache.atlas.AtlasServiceException;
+import org.apache.atlas.model.AtlasBaseModelObject;
+import org.apache.atlas.model.discovery.AtlasSearchResult;
+import org.apache.atlas.model.glossary.AtlasGlossary;
+import org.apache.atlas.model.glossary.AtlasGlossaryTerm;
+import org.apache.atlas.model.instance.*;
+import org.apache.atlas.model.lineage.AtlasLineageInfo;
+import org.apache.atlas.model.typedef.AtlasClassificationDef;
+import org.apache.atlas.model.typedef.AtlasTypesDef;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
+import java.lang.reflect.Type;
+import java.util.*;
+import java.util.stream.Collectors;
+
+
+@Service("atlasService")
+public class AtlasService {
+ private final AtlasClient atlasClient;
+ private final Gson gson;
+
+ public AtlasService() throws AtlasException {
+ Configuration configuration = ApplicationProperties.get("linkis.properties");
+ String[] urls = new String[]{GovernanceConf.ATLAS_REST_ADDRESS.getValue()};
+ String[] basicAuthUsernamePassword = new String[]{GovernanceConf.ATLAS_USERNAME.getValue(), GovernanceConf.ATLAS_PASSWORD.getValue()};
+
+ atlasClient = new AtlasClient(configuration, urls, basicAuthUsernamePassword);
+
+
+ GsonBuilder builder = new GsonBuilder();
+ // Register an adapter to manage the date types as long values
+ builder.registerTypeAdapter(Date.class, new JsonDeserializer() {
+ @Override
+ public Date deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
+ return new Date(json.getAsJsonPrimitive().getAsLong());
+ }
+ });
+
+ gson = builder.create();
+ }
+
+ /**
+ * hive db数量
+ */
+ public Long getHiveDbCnt() throws AtlasServiceException {
+ String jsonStr = atlasClient.getHiveDbs();
+ if (jsonStr != null && jsonStr.trim() != "") {
+ JsonObject jsonObject = gson.fromJson(jsonStr, JsonObject.class);
+ if (jsonObject != null) {
+ return jsonObject.get("count").getAsLong();
+ } else {
+ return 0l;
+ }
+ } else {
+ return 0l;
+ }
+ }
+
+ /**
+ * hive table数量
+ */
+ public long getHiveTableCnt() throws AtlasServiceException {
+ String jsonStr = atlasClient.getHiveTables();
+ if (jsonStr != null && jsonStr.trim() != "") {
+ JsonObject jsonObject = gson.fromJson(jsonStr, JsonObject.class);
+ if (jsonObject != null) {
+ return jsonObject.get("count").getAsLong();
+ } else {
+ return 0l;
+ }
+ } else {
+ return 0l;
+ }
+ }
+
+
+ /**
+ * 根据关键字搜索hive table
+ */
+ public List searchHiveTable(String classification, String query,
+ boolean excludeDeletedEntities, int limit, int offset) throws AtlasServiceException {
+ String jsonStr = atlasClient.basicSearchForString("hive_table", classification, query, excludeDeletedEntities, limit, offset);
+ AtlasSearchResult atlasSearchResult = gson.fromJson(jsonStr, AtlasSearchResult.class);
+
+ return atlasSearchResult.getEntities();
+ }
+
+ /**
+ * 根据关键字搜索hive table
+ */
+ public List searchHiveTable0(String classification, String query, String termName,
+ boolean excludeDeletedEntities, int limit, int offset) throws AtlasServiceException {
+
+ String jsonStr = atlasClient.basicSearchPostForString("hive_table", classification, query, termName , excludeDeletedEntities, limit, offset);
+ AtlasSearchResult atlasSearchResult = gson.fromJson(jsonStr, AtlasSearchResult.class);//atlasClient.facetedSearch(searchParameters);
+
+ //实体绑定类型
+ //atlasClient.addClassification();
+ //创建子类型
+ //atlasClient.createAtlasTypeDefs()
+ return atlasSearchResult.getEntities();
+ }
+
+ /**
+ * 创建子类型
+ *
+ * @param name
+ * @param superType
+ * @return
+ * @throws AtlasServiceException
+ */
+ public AtlasClassificationDef createSubClassification(String name, String superType) throws AtlasServiceException {
+ String jsonStr = atlasClient.createSubClassification(name, superType);
+ AtlasTypesDef atlasTypesDef = gson.fromJson(jsonStr, AtlasTypesDef.class);
+ return atlasTypesDef.getClassificationDefs().get(0);
+ }
+
+ /**
+ * 删除指定模型类型
+ *
+ * @param name
+ * @throws AtlasServiceException
+ */
+ public void deleteClassification(String name) throws AtlasServiceException {
+ atlasClient.deleteTypeByName(name);
+ }
+
+
+ /**
+ * 绑定类型
+ *
+ * @param typeName
+ * @param guid
+ * @throws AtlasServiceException
+ */
+ public void addClassification(String typeName, String guid, boolean propagate) throws AtlasServiceException {
+ AtlasClassification atlasClassification = new AtlasClassification();
+ atlasClassification.setTypeName(typeName);
+ atlasClassification.setPropagate(propagate);
+ atlasClassification.setRemovePropagationsOnEntityDelete(false);
+
+ ClassificationAssociateRequest request = new ClassificationAssociateRequest(Lists.newArrayList(guid), atlasClassification);
+ atlasClient.callAPI(AtlasClientV2.API_V2.ADD_CLASSIFICATION, (Class>) null, gson.toJson(request), new MultivaluedMapImpl());
+ }
+
+ /**
+ * 解绑类型
+ *
+ * @param guid
+ * @param typeName
+ * @throws AtlasServiceException
+ */
+ public void deleteClassification(String guid, String typeName) throws AtlasServiceException {
+ atlasClient.deleteClassification(guid, typeName);
+ }
+
+ /**
+ * 获取hive table对象
+ */
+ public AtlasEntity getHiveTbl(String guid) throws AtlasServiceException {
+ String jsonStr = atlasClient.getEntityByGuidForString(guid, false, false);
+
+ AtlasEntity.AtlasEntityWithExtInfo atlasEntityWithExtInfo = gson.fromJson(jsonStr, AtlasEntity.AtlasEntityWithExtInfo.class);
+
+ return atlasEntityWithExtInfo.getEntity();
+ }
+
+ /**
+ * 获取hive column对象
+ */
+ public AtlasEntity getHiveColumn(String guid) throws AtlasServiceException {
+ String jsonStr = atlasClient.getEntityByGuidForString(guid, true, true);
+
+ AtlasEntity.AtlasEntityWithExtInfo atlasEntityWithExtInfo = gson.fromJson(jsonStr, AtlasEntity.AtlasEntityWithExtInfo.class);
+
+ return atlasEntityWithExtInfo.getEntity();
+ }
+
+ /**
+ * 获取多个hive column对象
+ */
+ public List getHiveColumnsByGuids(List guids) throws AtlasServiceException {
+ String jsonStr = atlasClient.getEntitiesByGuidsForString(guids, true, true);
+ AtlasEntity.AtlasEntitiesWithExtInfo atlasEntitiesWithExtInfo = gson.fromJson(jsonStr, AtlasEntity.AtlasEntitiesWithExtInfo.class);
+
+ return atlasEntitiesWithExtInfo.getEntities();
+ }
+
+
+ /**
+ * 修改实体的注释
+ */
+ public void modifyComment(String guid, String commentStr) throws AtlasServiceException {
+ atlasClient.modifyComment(guid, commentStr);
+ }
+
+ /**
+ * 设置实体的标签
+ */
+ public void setLabels(String guid, Set labels) throws AtlasServiceException {
+ atlasClient.setLabels(guid, labels);
+ }
+
+ /**
+ * 获取根glossary guid
+ *
+ * @return
+ * @throws AtlasServiceException
+ */
+ public Optional getRootGlossaryGuid(GlossaryConstant glossaryConstant) throws AtlasServiceException {
+ String result = atlasClient.getAllGlossaries();
+ List glossaries = gson.fromJson(result, new TypeToken>() {
+ }.getType());
+ Optional root = glossaries.stream().filter(atlasGlossary -> StringUtils.equals(atlasGlossary.getName(), glossaryConstant.getRoot())).findFirst();
+ return root.map(AtlasBaseModelObject::getGuid);
+ }
+
+ /**
+ * 新建标签
+ *
+ * @param labelName
+ * @return
+ * @throws AtlasServiceException
+ */
+ public AtlasGlossaryTerm createLabel(String labelName) throws AtlasServiceException {
+ String result = atlasClient.createGlossaryTerm(labelName, getRootGlossaryGuid(GlossaryConstant.LABEL).get());
+ return gson.fromJson(result, AtlasGlossaryTerm.class);
+ }
+
+ /**
+ * 绑定标签
+ * @param termGuid
+ * @param entityGuids
+ * @throws AtlasServiceException
+ */
+ public void assignTermToEntities(String termGuid,List entityGuids) throws AtlasServiceException{
+ atlasClient.assignTermToEntities0(termGuid,entityGuids);
+ }
+
+ /**
+ * 解绑实体
+ * @param termGuid
+ * @param
+ * @throws AtlasServiceException
+ */
+ public void disassociateTermFromEntities(String termGuid, List relatedObjectIds) throws AtlasServiceException {
+ atlasClient.disassociateTermFromEntities0(termGuid,relatedObjectIds.stream().map(
+ relatedObjectId -> {
+ AtlasRelatedObjectId atlasRelatedObjectId = new AtlasRelatedObjectId();
+ atlasRelatedObjectId.setGuid(relatedObjectId.getGuid());
+ atlasRelatedObjectId.setRelationshipGuid(relatedObjectId.getRelationshipGuid());
+ return atlasRelatedObjectId;
+ }
+ ).collect(Collectors.toList()));
+ }
+
+
+
+ /**
+ * 删除标签
+ * @param labelName
+ * @throws AtlasServiceException
+ */
+ public void deleteLabel(String labelName) throws Exception{
+ Optional optional = getTermGuid(GlossaryConstant.LABEL,labelName);
+ if (!optional.isPresent()){
+ throw new DataGovernanceException(23000, labelName + "标签不存在");
+ }
+ atlasClient.deleteGlossaryTermByGuid(optional.get());
+ }
+
+ /**
+ * 获取分词guid
+ * @param glossaryConstant
+ * @param name
+ * @return
+ * @throws AtlasServiceException
+ */
+ public Optional getTermGuid(GlossaryConstant glossaryConstant, String name) throws AtlasServiceException {
+ String result = atlasClient.attributeSearchByName(glossaryConstant, name);
+ AtlasSearchResult atlasSearchResult = gson.fromJson(result, AtlasSearchResult.class);
+ return !CollectionUtils.isEmpty(atlasSearchResult.getEntities()) ?
+ Optional.ofNullable(atlasSearchResult.getEntities().get(0).getGuid()) : Optional.empty();
+ }
+
+ public List listLabels(String query,Integer limit,Integer offset) throws AtlasServiceException{
+ String result = atlasClient.attributeSearch0(GlossaryConstant.LABEL.getAtlasType(),query,GlossaryConstant.ARR,limit,offset);
+ AtlasSearchResult atlasSearchResult = gson.fromJson(result, AtlasSearchResult.class);
+ return !CollectionUtils.isEmpty(atlasSearchResult.getEntities())?atlasSearchResult.getEntities():Lists.newArrayList();
+ }
+
+
+ /**
+ * 血缘信息
+ */
+ public AtlasLineageInfo getLineageInfo(final String guid, final AtlasLineageInfo.LineageDirection direction, final int depth) throws AtlasServiceException {
+ String jsonStr = atlasClient.getLineageInfoForString(guid, direction, depth);
+ AtlasLineageInfo atlasLineageInfo = gson.fromJson(jsonStr, AtlasLineageInfo.class);
+ return atlasLineageInfo;
+ }
+
+ /**
+ * 根据guid来获取hive tbl名称: db.table
+ */
+ public String getHiveTblNameById(String guid) throws AtlasServiceException {
+ String jsonStr = atlasClient.getHeaderByIdForString(guid);
+ AtlasEntityHeader atlasEntityHeader = gson.fromJson(jsonStr, AtlasEntityHeader.class);
+
+ return atlasEntityHeader.getAttribute("qualifiedName").toString().split("@")[0];
+ }
+
+ /**
+ * 根据guid来获取hive tbl名称 和 是否分区表
+ */
+ public Map getHiveTblNameAndIsPartById(String guid) throws AtlasServiceException {
+ Map result = new HashMap<>(2);
+
+ String jsonStr = atlasClient.getEntityByGuidForString(guid, true, false);
+ AtlasEntity.AtlasEntityWithExtInfo atlasEntityWithExtInfo = gson.fromJson(jsonStr, AtlasEntity.AtlasEntityWithExtInfo.class);
+
+ result.put("tblName", atlasEntityWithExtInfo.getEntity().getAttribute("qualifiedName").toString().split("@")[0]);
+ result.put("isPartition", ((List) atlasEntityWithExtInfo.getEntity().getAttribute("partitionKeys")).size() > 0);
+
+ return result;
+ }
+
+ /**
+ * 获取hive db对象
+ */
+ public List searchHiveDb(String classification, String query,
+ boolean excludeDeletedEntities, int limit, int offset) throws AtlasServiceException {
+ String jsonStr = atlasClient.basicSearchPostForString("hive_db", classification, query,null, excludeDeletedEntities, limit, offset);
+ AtlasSearchResult atlasSearchResult = gson.fromJson(jsonStr, AtlasSearchResult.class);
+
+ return atlasSearchResult.getEntities();
+ }
+
+ public AtlasGlossaryTerm getGlossaryTermDetail(String termGuid) throws AtlasServiceException {
+ String detail = atlasClient.getGlossaryTerm0(termGuid);
+ return gson.fromJson(detail,AtlasGlossaryTerm.class);
+ }
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/conf/ClientCommonConfig.java b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/conf/ClientCommonConfig.java
new file mode 100644
index 0000000000..2a91c38828
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/conf/ClientCommonConfig.java
@@ -0,0 +1,34 @@
+package com.webank.wedatasphere.dss.data.governance.conf;
+
+import com.webank.wedatasphere.dss.framework.workspace.client.impl.LinkisWorkSpaceRemoteClient;
+import org.apache.linkis.httpclient.authentication.AuthenticationStrategy;
+import org.apache.linkis.httpclient.dws.config.DWSClientConfig;
+import org.apache.linkis.httpclient.dws.config.DWSClientConfigBuilder;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import java.util.concurrent.TimeUnit;
+
+@Configuration
+public class ClientCommonConfig {
+
+ @Bean
+ public LinkisWorkSpaceRemoteClient linkisWorkSpaceRemoteClient() throws Exception {
+ AuthenticationStrategy authenticationStrategy = (AuthenticationStrategy) Class.forName(DataWorkspaceRemoteConfig.AUTHENTICATION_STRATEGY.getValue()).newInstance();
+ DWSClientConfig clientConfig = ((DWSClientConfigBuilder) DWSClientConfigBuilder.newBuilder()
+ .addServerUrl(DataWorkspaceRemoteConfig.SERVER_URL.getValue())
+ .connectionTimeout(DataWorkspaceRemoteConfig.CONNECTION_TIMEOUT.getValue())
+ .discoveryEnabled(DataWorkspaceRemoteConfig.DISCOVERY_ENABLED.getValue())
+ .discoveryFrequency(DataWorkspaceRemoteConfig.DISCOVERY_FREQUENCY_PERIOD.getValue(), TimeUnit.MINUTES)
+ .loadbalancerEnabled(DataWorkspaceRemoteConfig.LOAD_BALANCER_ENABLED.getValue())
+ .maxConnectionSize(DataWorkspaceRemoteConfig.MAX_CONNECTION_SIZE.getValue())
+ .retryEnabled(DataWorkspaceRemoteConfig.RETRY_ENABLED.getValue())
+ .readTimeout(DataWorkspaceRemoteConfig.READ_TIMEOUT.getValue())
+ .setAuthenticationStrategy(authenticationStrategy)
+ .setAuthTokenKey(DataWorkspaceRemoteConfig.AUTHTOKEN_KEY.getValue())
+ .setAuthTokenValue(DataWorkspaceRemoteConfig.AUTHTOKEN_VALUE.getValue())
+ ).setDWSVersion(DataWorkspaceRemoteConfig.DWS_VERSION.getValue())
+ .build();
+ return new LinkisWorkSpaceRemoteClient(clientConfig);
+ }
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/conf/ClientStrategy.java b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/conf/ClientStrategy.java
new file mode 100644
index 0000000000..6f1ab65d61
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/conf/ClientStrategy.java
@@ -0,0 +1,17 @@
+package com.webank.wedatasphere.dss.data.governance.conf;
+
+
+public enum ClientStrategy {
+ TOKEN("token"),
+ STATIC("static");
+
+ private final String code;
+
+ ClientStrategy(String code) {
+ this.code = code;
+ }
+
+ public String getCode() {
+ return code;
+ }
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/conf/DataWorkspaceRemoteConfig.java b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/conf/DataWorkspaceRemoteConfig.java
new file mode 100644
index 0000000000..9eba05e76e
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/conf/DataWorkspaceRemoteConfig.java
@@ -0,0 +1,21 @@
+package com.webank.wedatasphere.dss.data.governance.conf;
+
+
+import org.apache.linkis.common.conf.CommonVars;
+
+public class DataWorkspaceRemoteConfig {
+ public static final CommonVars SERVER_URL = CommonVars.apply("wds.workspace.client.serverurl", "");
+ public static final CommonVars CONNECTION_TIMEOUT = CommonVars.apply("wds.workspace.client.connection.timeout", 30000L);
+ public static final CommonVars DISCOVERY_ENABLED = CommonVars.apply("wds.workspace.client.discovery.enabled", false);
+ public static final CommonVars DISCOVERY_FREQUENCY_PERIOD = CommonVars.apply("wds.workspace.client.discoveryfrequency.period", 1L);
+ public static final CommonVars LOAD_BALANCER_ENABLED = CommonVars.apply("wds.workspace.client.loadbalancer.enabled", true);
+ public static final CommonVars MAX_CONNECTION_SIZE = CommonVars.apply("wds.workspace.client.maxconnection.size", 5);
+ public static final CommonVars RETRY_ENABLED = CommonVars.apply("wds.workspace.client.retryenabled", false);
+ public static final CommonVars READ_TIMEOUT = CommonVars.apply("wds.workspace.client.readtimeout", 30000L);
+ public static final CommonVars AUTHENTICATION_STRATEGY = CommonVars.apply("wds.workspace.client.authenticationStrategy", "");
+
+ public static final CommonVars AUTHTOKEN_KEY = CommonVars.apply("wds.workspace.client.authtoken.key", "");
+ public static final CommonVars AUTHTOKEN_VALUE = CommonVars.apply("wds.workspace.client.authtoken.value", "");
+ public static final CommonVars DWS_VERSION = CommonVars.apply("wds.workspace.client.dws.version", "");
+
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/conf/GovernanceConf.java b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/conf/GovernanceConf.java
new file mode 100644
index 0000000000..9769d05482
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/conf/GovernanceConf.java
@@ -0,0 +1,44 @@
+/*
+ *
+ * * Copyright 2019 WeBank
+ * *
+ * * Licensed under the Apache License, Version 2.0 (the "License");
+ * * you may not use this file except in compliance with the License.
+ * * You may obtain a copy of the License at
+ * *
+ * * http://www.apache.org/licenses/LICENSE-2.0
+ * *
+ * * Unless required by applicable law or agreed to in writing, software
+ * * distributed under the License is distributed on an "AS IS" BASIS,
+ * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * * See the License for the specific language governing permissions and
+ * * limitations under the License.
+ *
+ */
+
+package com.webank.wedatasphere.dss.data.governance.conf;
+
+import org.apache.linkis.common.conf.CommonVars;
+
+
+public interface GovernanceConf {
+ CommonVars ATLAS_REST_ADDRESS = CommonVars.apply("atlas.rest.address");
+ CommonVars ATLAS_USERNAME = CommonVars.apply("atlas.username");
+ CommonVars ATLAS_PASSWORD = CommonVars.apply("atlas.password");
+ //CommonVars METASTORE_DATASOURCE_PASSWORD = CommonVars.apply("atlas.client.readTimeoutMSecs");
+ //CommonVars METASTORE_DATASOURCE_PASSWORD = CommonVars.apply("atlas.client.connectTimeoutMSecs");
+ CommonVarsATLAS_ROOT_INDICATOR = CommonVars.apply("atlas.root.indicator");
+ CommonVarsATLAS_ROOT_MEASURE = CommonVars.apply("atlas.root.measure");
+ CommonVarsATLAS_ROOT_DIMENSION = CommonVars.apply("atlas.root.dimension");
+ CommonVarsATLAS_ROOT_LAYER = CommonVars.apply("atlas.root.layer");
+ CommonVarsATLAS_ROOT_THEME = CommonVars.apply("atlas.root.theme");
+
+ CommonVarsATLAS_ROOT_LABEL = CommonVars.apply("atlas.root.label");
+ CommonVarsATLAS_ROOT_COLLECTION = CommonVars.apply("atlas.root.collection");
+
+
+ CommonVars METASTORE_DATASOURCE_DRIVER = CommonVars.apply("metastore.datasource.driver", "com.mysql.jdbc.Driver");
+ CommonVars METASTORE_DATASOURCE_URL = CommonVars.apply("metastore.datasource.url");
+ CommonVars METASTORE_DATASOURCE_USERNAME = CommonVars.apply("metastore.datasource.username");
+ CommonVars METASTORE_DATASOURCE_PASSWORD = CommonVars.apply("metastore.datasource.password");
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/dao/MetaInfoMapper.java b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/dao/MetaInfoMapper.java
new file mode 100644
index 0000000000..9641cef8eb
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/dao/MetaInfoMapper.java
@@ -0,0 +1,19 @@
+package com.webank.wedatasphere.dss.data.governance.dao;
+
+import com.webank.wedatasphere.dss.data.governance.entity.PartInfo;
+import com.webank.wedatasphere.dss.data.governance.entity.TableInfo;
+import com.webank.wedatasphere.dss.data.governance.exception.DAOException;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.sql.SQLException;
+import java.util.List;
+
+
+@Mapper
+public interface MetaInfoMapper {
+ Long getTableStorage() throws DAOException;
+ List getTop10Table() throws DAOException;
+ int getTableInfo(@Param("dbName") String dbName,@Param("tableName") String tableName,@Param("isPartTable") Boolean isPartTable) throws DAOException;
+ List getPartInfo(@Param("dbName") String dbName, @Param("tableName") String tableName) throws DAOException;
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/dao/TableColumnCountQueryMapper.java b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/dao/TableColumnCountQueryMapper.java
new file mode 100644
index 0000000000..c96bad9a6a
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/dao/TableColumnCountQueryMapper.java
@@ -0,0 +1,28 @@
+package com.webank.wedatasphere.dss.data.governance.dao;
+
+
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.toolkit.Constants;
+import com.webank.wedatasphere.dss.data.governance.entity.TableColumnCount;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.List;
+
+public interface TableColumnCountQueryMapper extends BaseMapper {
+
+ String querySql = "select tbl_db.db_name as db_name,tbl_db.tbl_name as tbl_name,tbl_db.tbl_id as tbl_id , count(*) as column_count \n" +
+ "from COLUMNS_V2 as col\n" +
+ " left join CDS C on C.CD_ID = col.CD_ID\n" +
+ " right join (select t.TBL_NAME as tbl_name,t.TBL_ID as tbl_id, s.CD_ID as cd_id ,d.DB_ID as db_id ,d.NAME as db_name from TBLS as t left join SDS as s on t.SD_ID = s.SD_ID left join DBS d on t.DB_ID = d.DB_ID) as tbl_db\n" +
+ " on tbl_db.cd_id = col.CD_ID\n" +
+ " ${ew.customSqlSegment} " +
+ " group by tbl_db.tbl_id ";
+
+ String wrapperSql = "SELECT * from ( " + querySql + " ) AS q ${ew.customSqlSegment}";
+
+
+ @Select(querySql)
+ List query(@Param(Constants.WRAPPER) Wrapper queryWrapper);
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/dao/TableSizeInfoMapper.java b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/dao/TableSizeInfoMapper.java
new file mode 100644
index 0000000000..2d0d526059
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/dao/TableSizeInfoMapper.java
@@ -0,0 +1,22 @@
+package com.webank.wedatasphere.dss.data.governance.dao;
+
+
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.toolkit.Constants;
+import com.webank.wedatasphere.dss.data.governance.entity.TableSizeInfo;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.List;
+
+public interface TableSizeInfoMapper extends BaseMapper {
+ String querySql = "select tbls.TBL_ID as id,d.NAME as db_name,tbls.TBL_NAME as tbl_name, tp.PARAM_KEY as param_key, tp.PARAM_VALUE as param_value\n" +
+ "from TBLS as tbls left join TABLE_PARAMS as tp on tbls.TBL_ID = tp.TBL_ID left join DBS d on tbls.DB_ID = d.DB_ID \n";;
+
+ String wrapperSql = "SELECT * from ( " + querySql + " ) AS q ${ew.customSqlSegment}";
+
+
+ @Select(wrapperSql)
+ List query(@Param(Constants.WRAPPER) Wrapper queryWrapper);
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/dao/TableSizePartitionInfoMapper.java b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/dao/TableSizePartitionInfoMapper.java
new file mode 100644
index 0000000000..8c00d70765
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/dao/TableSizePartitionInfoMapper.java
@@ -0,0 +1,24 @@
+package com.webank.wedatasphere.dss.data.governance.dao;
+
+
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.toolkit.Constants;
+import com.webank.wedatasphere.dss.data.governance.entity.TablePartitionSizeInfo;
+import com.webank.wedatasphere.dss.data.governance.entity.TableSizeInfo;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.List;
+
+public interface TableSizePartitionInfoMapper extends BaseMapper {
+
+ String querySql = "select tbl_db.TBL_ID as id, tbl_db.tbl_name as tbl_name, tbl_db.db_name as db_name, p.PART_ID as part_id,p.LAST_ACCESS_TIME as last_access_time,p.SD_ID as sd_id,pp.PARAM_KEY as param_key,pp.PARAM_VALUE as param_value from PARTITIONS AS p left join PARTITION_PARAMS pp on pp.PART_ID = p.PART_ID left join\n" +
+ "(select tbls.TBL_ID as tbl_id, tbls.TBL_NAME as tbl_name, db.NAME as db_name from TBLS as tbls, DBS as db where tbls.DB_ID = db.DB_ID ) as tbl_db on tbl_db.tbl_id = p.TBL_ID\n";
+
+ String wrapperSql = "SELECT * from ( " + querySql + " ) AS q ${ew.customSqlSegment}";
+
+
+ @Select(wrapperSql)
+ List query(@Param(Constants.WRAPPER) Wrapper queryWrapper);
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/dao/WorkspaceInfoMapper.java b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/dao/WorkspaceInfoMapper.java
new file mode 100644
index 0000000000..33c9c97ff5
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/dao/WorkspaceInfoMapper.java
@@ -0,0 +1,18 @@
+package com.webank.wedatasphere.dss.data.governance.dao;
+
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.List;
+
+
+@Mapper
+public interface WorkspaceInfoMapper {
+
+ @Select("select username from dss_workspace_user where workspace_id= #{workspaceId} and username like #{search} ")
+ List getWorkspaceUsersName (@Param("workspaceId") int workspaceId,@Param("search") String search);
+
+
+
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/dao/impl/MetaInfoMapperImpl.java b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/dao/impl/MetaInfoMapperImpl.java
new file mode 100644
index 0000000000..6ec20f2b07
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/dao/impl/MetaInfoMapperImpl.java
@@ -0,0 +1,140 @@
+package com.webank.wedatasphere.dss.data.governance.dao.impl;
+
+import com.webank.wedatasphere.dss.data.governance.dao.MetaInfoMapper;
+import com.webank.wedatasphere.dss.data.governance.entity.PartInfo;
+import com.webank.wedatasphere.dss.data.governance.entity.TableInfo;
+import com.webank.wedatasphere.dss.data.governance.exception.DAOException;
+import com.webank.wedatasphere.dss.data.governance.utils.DataSourceUtil;
+import com.webank.wedatasphere.dss.data.governance.utils.DateUtil;
+
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.stream.Collectors;
+
+
+public class MetaInfoMapperImpl implements MetaInfoMapper {
+ @Override
+ public Long getTableStorage() throws DAOException {
+ DataSource dataSource = DataSourceUtil.getDataSource();
+
+ long num = 0;
+ PreparedStatement ps = null;
+ ResultSet rs = null;
+ try (Connection con = dataSource.getConnection()) {
+ String sql = "select SUM(PARAM_VALUE) from TABLE_PARAMS WHERE PARAM_KEY='totalSize'";
+ ps = con.prepareStatement(sql);
+ rs = ps.executeQuery();
+ while (rs.next()) {
+ num = rs.getLong(1);
+ }
+ String sql2 = "select SUM(PARAM_VALUE) from PARTITION_PARAMS WHERE PARAM_KEY='totalSize'";
+ ps = con.prepareStatement(sql2);
+ rs = ps.executeQuery();
+ while (rs.next()) {
+ num = num + rs.getLong(1);
+ }
+ } catch (SQLException e) {
+ throw new DAOException(23001, e.getMessage());
+ }
+ return num;
+ }
+
+ @Override
+ public List getTop10Table() throws DAOException {
+ DataSource dataSource = DataSourceUtil.getDataSource();
+
+ PreparedStatement ps = null;
+ ResultSet rs = null;
+ List tableInfos = new ArrayList<>();
+ try (Connection con = dataSource.getConnection();) {
+ String sql = "select DBS.NAME ,TBLS.TBL_NAME,TABLE_PARAMS.PARAM_VALUE as totalSize from DBS, TBLS,TABLE_PARAMS where TBLS.TBL_ID=TABLE_PARAMS.TBL_ID AND TBLS.DB_ID=DBS.DB_ID AND TABLE_PARAMS.PARAM_KEY='totalSize' order by totalSize DESC limit 10";
+ ps = con.prepareStatement(sql);
+ rs = ps.executeQuery();
+ while (rs.next()) {
+ TableInfo tableinfo = new TableInfo();
+ tableinfo.setTableName(rs.getString(1) + "." + rs.getString(2));
+ tableinfo.setStorage(rs.getString(3));
+ tableInfos.add(tableinfo);
+ }
+ String sql2 = "select DBS.NAME ,TBLS.TBL_NAME,SUM(PARTITION_PARAMS.PARAM_VALUE) as totalSize from DBS,TBLS,PARTITIONS ,PARTITION_PARAMS where DBS.DB_ID=TBLS.DB_ID AND TBLS.TBL_ID=PARTITIONS.TBL_ID AND PARTITIONS.PART_ID =PARTITION_PARAMS.PART_ID AND PARTITION_PARAMS.PARAM_KEY='totalSize' group by TBLS.TBL_NAME order by totalSize desc limit 10";
+ ps = con.prepareStatement(sql2);
+ rs = ps.executeQuery();
+ while (rs.next()) {
+ TableInfo tableinfo = new TableInfo();
+ tableinfo.setTableName(rs.getString(1) + "." + rs.getString(2));
+ tableinfo.setStorage(rs.getString(3));
+ tableInfos.add(tableinfo);
+ }
+
+ tableInfos.sort((o1, o2) -> {
+ long result = Long.parseLong(o2.getStorage()) - Long.parseLong(o1.getStorage());
+ return Long.compare(result, 0L);
+ });
+ } catch (SQLException e) {
+ throw new DAOException(23001, e.getMessage());
+ }
+
+ return tableInfos.stream().limit(10).collect(Collectors.toList());
+ }
+
+ @Override
+ public int getTableInfo(String dbName, String tableName, Boolean isPartTable) throws DAOException {
+ DataSource dataSource = DataSourceUtil.getDataSource();
+ PreparedStatement ps = null;
+ ResultSet rs = null;
+ int res = 0;
+ try (Connection con = dataSource.getConnection()) {
+ String sql = null;
+ if (isPartTable == false) {
+ sql = "select TABLE_PARAMS.PARAM_VALUE as totalSize from DBS, TBLS,TABLE_PARAMS where TBLS.TBL_ID=TABLE_PARAMS.TBL_ID AND TBLS.DB_ID=DBS.DB_ID AND TABLE_PARAMS.PARAM_KEY='totalSize' AND DBS.NAME=" + "'" + dbName + "' AND TBLS.TBL_NAME=" + "'" + tableName + "'";
+ } else {
+
+ sql = "select SUM(PARTITION_PARAMS.PARAM_VALUE) as totalSize from DBS,TBLS,PARTITIONS ,PARTITION_PARAMS where DBS.DB_ID=TBLS.DB_ID AND TBLS.TBL_ID=PARTITIONS.TBL_ID AND PARTITIONS.PART_ID =PARTITION_PARAMS.PART_ID AND PARTITION_PARAMS.PARAM_KEY='totalSize' AND DBS.NAME=" + "'" + dbName + "' AND TBLS.TBL_NAME=" + "'" + tableName + "' group by TBLS.TBL_NAME";
+ }
+ ps = con.prepareStatement(sql);
+ rs = ps.executeQuery();
+ while (rs.next()) {
+ res = rs.getInt(1);
+ }
+ } catch (SQLException e) {
+ throw new DAOException(23001, e.getMessage());
+ }
+ return res;
+ }
+
+ @Override
+ public List getPartInfo(String dbName, String tableName) throws DAOException {
+ DataSource dataSource = DataSourceUtil.getDataSource();
+
+ PreparedStatement ps = null;
+ ResultSet rs = null;
+ List PartInfos = new ArrayList<>();
+ try (Connection con = dataSource.getConnection()) {
+ String sql = "select b.PART_NAME,b.CREATE_TIME,MAX(CASE c.PARAM_KEY WHEN 'transient_lastDdlTime' THEN c.PARAM_VALUE ELSE null END) transient_lastDdlTime ,MAX(CASE c.PARAM_KEY WHEN 'numRows' THEN c.PARAM_VALUE ELSE null END) numRows,MAX(CASE c.PARAM_KEY WHEN 'totalSize' THEN c.PARAM_VALUE ELSE null END) totalSize, MAX(CASE c.PARAM_KEY WHEN 'numFiles' THEN c.PARAM_VALUE ELSE null END) numFiles from TBLS a,PARTITIONS b,PARTITION_PARAMS c,DBS d where a.TBL_NAME=" + "'" + tableName + "'" + "AND d.NAME=" + "'" + dbName + "'" + "AND a.TBL_ID=b.TBL_ID AND a.DB_ID=d.DB_ID AND b.PART_ID=c.PART_ID GROUP BY c.PART_ID";
+ ps = con.prepareStatement(sql);
+ rs = ps.executeQuery();
+ while (rs.next()) {
+ PartInfo part = new PartInfo();
+ part.setPartName(rs.getString(1));
+ part.setCreateTime(DateUtil.unixToTimeStr(Long.valueOf(rs.getInt(2)) * 1000));
+ part.setLastAccessTime(DateUtil.unixToTimeStr(Long.valueOf(rs.getInt(3)) * 1000));
+ part.setReordCnt(rs.getInt(4));
+ part.setStore(rs.getInt(5));
+ part.setFileCount(rs.getInt(6));
+ PartInfos.add(part);
+ }
+
+ } catch (SQLException e) {
+ throw new DAOException(23001, e.getMessage());
+ }
+
+ return PartInfos;
+ }
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/dto/HiveTblStatsDTO.java b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/dto/HiveTblStatsDTO.java
new file mode 100644
index 0000000000..56f4a2abe8
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/dto/HiveTblStatsDTO.java
@@ -0,0 +1,18 @@
+package com.webank.wedatasphere.dss.data.governance.dto;
+
+
+import lombok.Data;
+
+@Data
+public class HiveTblStatsDTO {
+
+ private Integer columnCount = 0;
+
+ private Long totalSize = 0L;
+
+ private Integer numFiles = 0;
+
+ private Integer partitionCount = 0;
+
+ private Integer accessCount = 0;
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/dto/SearchLabelDTO.java b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/dto/SearchLabelDTO.java
new file mode 100644
index 0000000000..e7cfdc6cf4
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/dto/SearchLabelDTO.java
@@ -0,0 +1,18 @@
+package com.webank.wedatasphere.dss.data.governance.dto;
+
+
+import lombok.Data;
+import org.apache.atlas.model.instance.AtlasEntityHeader;
+
+@Data
+public class SearchLabelDTO {
+ private String name;
+ private String guid;
+
+ public static SearchLabelDTO from(AtlasEntityHeader atlasEntityHeader){
+ SearchLabelDTO dto = new SearchLabelDTO();
+ dto.setGuid(atlasEntityHeader.getGuid());
+ dto.setName(atlasEntityHeader.getAttribute("name").toString());
+ return dto;
+ }
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/ClassificationConstant.java b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/ClassificationConstant.java
new file mode 100644
index 0000000000..9fdb2d5ff9
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/ClassificationConstant.java
@@ -0,0 +1,116 @@
+package com.webank.wedatasphere.dss.data.governance.entity;
+
+
+import com.webank.wedatasphere.dss.data.governance.conf.GovernanceConf;
+import org.apache.commons.lang.StringUtils;
+
+import java.util.Optional;
+
+public enum ClassificationConstant {
+ /**
+ * 指标
+ */
+ INDICATOR(1, "indicator_", GovernanceConf.ATLAS_ROOT_INDICATOR.getValue(),"indicator"),
+ /**
+ * 度量
+ */
+ MEASURE(2, "measure_", GovernanceConf.ATLAS_ROOT_MEASURE.getValue(),"measure"),
+ /**
+ * 维度
+ */
+ DIMENSION(0, "dimension_", GovernanceConf.ATLAS_ROOT_DIMENSION.getValue(),"dimension"),
+ /**
+ * 主题
+ */
+ THEME(3, "theme_", GovernanceConf.ATLAS_ROOT_THEME.getValue(),"theme"),
+ /**
+ * 分层
+ */
+ LAYER(4, "layer_", GovernanceConf.ATLAS_ROOT_LAYER.getValue(),"layer");
+
+ private int type;
+
+ private String prefix;
+
+ private String root;
+
+ private String typeCode;
+
+ ClassificationConstant(int type, String prefix, String root,String typeCode) {
+ this.type = type;
+ this.prefix = prefix;
+ this.root = root;
+ this.typeCode = typeCode;
+ }
+
+ public static boolean isTypeScope(int type) {
+ return type >= 0 && type < values().length;
+ }
+
+ public static boolean isTypeScope(String type) {
+ return getClassificationConstantByTypeCode(type).isPresent();
+ }
+
+ public static Optional getClassificationConstantByTypeCode(String typeCode) {
+ for (ClassificationConstant c : values()) {
+ if (StringUtils.equals(c.typeCode,typeCode)) {
+ return Optional.of(c);
+ }
+ }
+ return Optional.empty();
+ }
+
+ public static Optional getClassificationConstantByType(int type) {
+ for (ClassificationConstant c : values()) {
+ if (c.type == type) {
+ return Optional.of(c);
+ }
+ }
+ return Optional.empty();
+ }
+
+ public static Optional formatName(int type, String name){
+ return Optional.of(getPrefix(type).get() + name);
+ }
+
+ public static Optional formatName(String typeCode, String name){
+ return Optional.of(getPrefix(typeCode).get() + name);
+ }
+
+ public static Optional getRoot(int type) {
+ Optional optional = getClassificationConstantByType(type);
+ return optional.map(ClassificationConstant::getRoot);
+ }
+
+ public static Optional getRoot(String typeCode) {
+ Optional optional = getClassificationConstantByTypeCode(typeCode);
+ return optional.map(ClassificationConstant::getRoot);
+ }
+
+ public static Optional getPrefix(int type) {
+ Optional optional = getClassificationConstantByType(type);
+ return optional.map(ClassificationConstant::getPrefix);
+ }
+
+ public static Optional getPrefix(String typeCode) {
+ Optional optional = getClassificationConstantByTypeCode(typeCode);
+ return optional.map(ClassificationConstant::getPrefix);
+ }
+
+
+ public int getType() {
+ return type;
+ }
+
+ public String getPrefix() {
+ return prefix;
+ }
+
+ public String getRoot() {
+ return root;
+ }
+
+ public String getTypeCode() {
+ return typeCode;
+ }
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/CreateLabelInfo.java b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/CreateLabelInfo.java
new file mode 100644
index 0000000000..e8aaca5adc
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/CreateLabelInfo.java
@@ -0,0 +1,19 @@
+package com.webank.wedatasphere.dss.data.governance.entity;
+
+
+import lombok.Data;
+import org.apache.atlas.model.glossary.AtlasGlossaryTerm;
+
+@Data
+public class CreateLabelInfo {
+ private String name;
+
+ private String guid;
+
+ public static CreateLabelInfo from(AtlasGlossaryTerm term) {
+ CreateLabelInfo info = new CreateLabelInfo();
+ info.setName(term.getName());
+ info.setGuid(term.getGuid());
+ return info;
+ }
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/CreateModelTypeInfo.java b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/CreateModelTypeInfo.java
new file mode 100644
index 0000000000..da26e0000c
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/CreateModelTypeInfo.java
@@ -0,0 +1,12 @@
+package com.webank.wedatasphere.dss.data.governance.entity;
+
+import lombok.Data;
+import org.apache.atlas.model.glossary.AtlasGlossaryTerm;
+
+@Data
+public class CreateModelTypeInfo {
+
+ private String name;
+
+ private String guid;
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/GlossaryConstant.java b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/GlossaryConstant.java
new file mode 100644
index 0000000000..280e744fd9
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/GlossaryConstant.java
@@ -0,0 +1,55 @@
+package com.webank.wedatasphere.dss.data.governance.entity;
+
+
+import com.webank.wedatasphere.dss.data.governance.conf.GovernanceConf;
+
+public enum GlossaryConstant {
+ LABEL(0,"label","AtlasGlossaryTerm", GovernanceConf.ATLAS_ROOT_LABEL.getValue()),
+ COLLECTION(1,"collection","AtlasGlossaryTerm",GovernanceConf.ATLAS_ROOT_COLLECTION.getValue());
+
+ private int type;
+
+
+ private String typeCode;
+
+ private String atlasType;
+
+ private String root;
+
+ public static final String SEPARATOR = "@";
+
+
+
+ public static final String ARR = "qualifiedName";
+
+ GlossaryConstant(int type, String typeCode,String atlasType, String root) {
+ this.type = type;
+ this.atlasType = atlasType;
+ this.typeCode = typeCode;
+ this.root = root;
+ }
+
+ public int getType() {
+ return type;
+ }
+
+ public String getTypeCode() {
+ return typeCode;
+ }
+
+ public String getAtlasType() {
+ return atlasType;
+ }
+
+ public String getRoot() {
+ return root;
+ }
+
+ public String formatQuery(String query){
+ return query+SEPARATOR+this.getRoot();
+ }
+
+ public String endWith(){
+ return SEPARATOR+this.getRoot();
+ }
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/HiveTblDetailInfo.java b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/HiveTblDetailInfo.java
new file mode 100644
index 0000000000..97cae23c02
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/HiveTblDetailInfo.java
@@ -0,0 +1,33 @@
+package com.webank.wedatasphere.dss.data.governance.entity;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+import java.util.Set;
+
+
+@Data
+public class HiveTblDetailInfo implements Serializable {
+ private HiveTblBasicInfo basic;
+ private List columns;
+ private List partitionKeys;
+
+
+ @Data
+ public static class HiveTblBasicInfo extends HiveTblSimpleInfo {
+ private String store;
+ private String comment;
+ private Set labels;
+ private Boolean isParTbl;
+ }
+
+ @Data
+ public static class HiveColumnInfo {
+ private String name;
+ private String type;
+ private String guid;
+ private String comment;
+ }
+
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/HiveTblSimpleInfo.java b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/HiveTblSimpleInfo.java
new file mode 100644
index 0000000000..0a6d7afd62
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/HiveTblSimpleInfo.java
@@ -0,0 +1,21 @@
+package com.webank.wedatasphere.dss.data.governance.entity;
+
+import lombok.Data;
+
+import java.util.List;
+
+
+@Data
+public class HiveTblSimpleInfo {
+ private String guid;
+ private String name;
+ private String qualifiedName;
+ private String createTime;
+ private String owner;
+ private String aliases;
+ private String lastAccessTime;
+ private String comment;
+ private List classifications;
+ private String totalSize;
+ private String external;
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/PartInfo.java b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/PartInfo.java
new file mode 100644
index 0000000000..1a5d85685a
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/PartInfo.java
@@ -0,0 +1,14 @@
+package com.webank.wedatasphere.dss.data.governance.entity;
+
+import lombok.Data;
+
+
+@Data
+public class PartInfo {
+ private String partName;
+ private int reordCnt;
+ private int store;
+ private String createTime;
+ private String lastAccessTime;
+ private int fileCount;
+}
\ No newline at end of file
diff --git a/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/QueryType.java b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/QueryType.java
new file mode 100644
index 0000000000..f54a0e6cd5
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/QueryType.java
@@ -0,0 +1,18 @@
+package com.webank.wedatasphere.dss.data.governance.entity;
+
+
+public enum QueryType {
+ PRECISE(1),
+ FUZZY(0);
+ private int code;
+
+ QueryType(int code) {
+ this.code = code;
+ }
+
+ public int getCode() {
+ return code;
+ }
+
+
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/RelatedObjectId.java b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/RelatedObjectId.java
new file mode 100644
index 0000000000..53437b59d8
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/RelatedObjectId.java
@@ -0,0 +1,17 @@
+package com.webank.wedatasphere.dss.data.governance.entity;
+
+
+import lombok.Data;
+
+@Data
+public class RelatedObjectId {
+ private String guid;
+ public String relationshipGuid;
+
+ public static RelatedObjectId from(String guid,String relationshipGuid){
+ RelatedObjectId relatedObjectId = new RelatedObjectId();
+ relatedObjectId.setGuid(guid);
+ relatedObjectId.setRelationshipGuid(relationshipGuid);
+ return relatedObjectId;
+ }
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/TableColumnCount.java b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/TableColumnCount.java
new file mode 100644
index 0000000000..e5b20bf934
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/TableColumnCount.java
@@ -0,0 +1,12 @@
+package com.webank.wedatasphere.dss.data.governance.entity;
+
+
+import lombok.Data;
+
+@Data
+public class TableColumnCount {
+ private String dbName;
+ private String tblName;
+ private Long tblId;
+ private Integer columnCount;
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/TableInfo.java b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/TableInfo.java
new file mode 100644
index 0000000000..8c971dc158
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/TableInfo.java
@@ -0,0 +1,10 @@
+package com.webank.wedatasphere.dss.data.governance.entity;
+
+import lombok.Data;
+
+
+@Data
+public class TableInfo {
+ private String tableName;
+ private String storage;
+}
\ No newline at end of file
diff --git a/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/TablePartitionSizeInfo.java b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/TablePartitionSizeInfo.java
new file mode 100644
index 0000000000..fb5cb34414
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/TablePartitionSizeInfo.java
@@ -0,0 +1,15 @@
+package com.webank.wedatasphere.dss.data.governance.entity;
+
+import lombok.Data;
+
+@Data
+public class TablePartitionSizeInfo {
+ private Long id;
+ private Long parId;
+ private Long lastAccessTime;
+ private Long sdId;
+ private String dbName;
+ private String tblName;
+ private String paramKey;
+ private String paramValue;
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/TableSizeInfo.java b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/TableSizeInfo.java
new file mode 100644
index 0000000000..8355cdc54d
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/TableSizeInfo.java
@@ -0,0 +1,13 @@
+package com.webank.wedatasphere.dss.data.governance.entity;
+
+
+import lombok.Data;
+
+@Data
+public class TableSizeInfo {
+ private Long id;
+ private String dbName;
+ private String tblName;
+ private String paramKey;
+ private String paramValue;
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/UpdateLabelInfo.java b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/UpdateLabelInfo.java
new file mode 100644
index 0000000000..8c302549de
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/UpdateLabelInfo.java
@@ -0,0 +1,18 @@
+package com.webank.wedatasphere.dss.data.governance.entity;
+
+import lombok.Data;
+import org.apache.atlas.model.glossary.AtlasGlossaryTerm;
+
+@Data
+public class UpdateLabelInfo {
+ private String name;
+
+ private String guid;
+
+ public static UpdateLabelInfo from(AtlasGlossaryTerm term) {
+ UpdateLabelInfo info = new UpdateLabelInfo();
+ info.setName(term.getName());
+ info.setGuid(term.getGuid());
+ return info;
+ }
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/UpdateModelTypeInfo.java b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/UpdateModelTypeInfo.java
new file mode 100644
index 0000000000..8fc0ec1a0c
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/entity/UpdateModelTypeInfo.java
@@ -0,0 +1,12 @@
+package com.webank.wedatasphere.dss.data.governance.entity;
+
+
+import lombok.Data;
+
+@Data
+public class UpdateModelTypeInfo {
+ private String name;
+
+ private String guid;
+
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/exception/DAOException.java b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/exception/DAOException.java
new file mode 100644
index 0000000000..9a5e54fe07
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/exception/DAOException.java
@@ -0,0 +1,15 @@
+package com.webank.wedatasphere.dss.data.governance.exception;
+
+
+import org.apache.linkis.common.exception.ErrorException;
+
+public class DAOException extends ErrorException {
+
+ public DAOException(int errCode, String desc) {
+ super(errCode, desc);
+ }
+
+ public DAOException(int errCode, String desc, String ip, int port, String serviceKind) {
+ super(errCode, desc, ip, port, serviceKind);
+ }
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/exception/DataGovernanceException.java b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/exception/DataGovernanceException.java
new file mode 100644
index 0000000000..b36fddd91d
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/exception/DataGovernanceException.java
@@ -0,0 +1,16 @@
+package com.webank.wedatasphere.dss.data.governance.exception;
+
+
+import org.apache.linkis.common.exception.ErrorException;
+
+public class DataGovernanceException extends ErrorException {
+
+ public DataGovernanceException(int errCode, String desc) {
+ super(errCode, desc);
+ }
+
+ public DataGovernanceException(int errCode, String desc, String ip, int port, String serviceKind) {
+ super(errCode, desc, ip, port, serviceKind);
+ }
+
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/restful/DSSDataGovernanceAssetRestful.java b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/restful/DSSDataGovernanceAssetRestful.java
new file mode 100644
index 0000000000..18c022b646
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/restful/DSSDataGovernanceAssetRestful.java
@@ -0,0 +1,496 @@
+package com.webank.wedatasphere.dss.data.governance.restful;
+
+import com.webank.wedatasphere.dss.data.governance.entity.*;
+import com.webank.wedatasphere.dss.data.governance.service.AssetService;
+import com.webank.wedatasphere.dss.data.governance.service.AuthenticationClientStrategy;
+import com.webank.wedatasphere.dss.data.governance.service.WorkspaceInfoService;
+import com.webank.wedatasphere.dss.data.governance.vo.*;
+import com.webank.wedatasphere.dss.framework.workspace.client.impl.LinkisWorkSpaceRemoteClient;
+import com.webank.wedatasphere.dss.framework.workspace.client.request.GetWorkspaceUsersAction;
+import com.webank.wedatasphere.dss.framework.workspace.client.response.GetWorkspaceUsersResult;
+import org.apache.linkis.common.exception.ErrorException;
+import org.apache.linkis.server.Message;
+import org.apache.atlas.model.lineage.AtlasLineageInfo;
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.util.CollectionUtils;
+import org.springframework.web.bind.annotation.RequestBody;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.*;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+
+@Path("/data-assets/asset")
+@Consumes(MediaType.APPLICATION_JSON)
+@Produces(MediaType.APPLICATION_JSON)
+@Component
+public class DSSDataGovernanceAssetRestful implements AuthenticationClientStrategy {
+ private static final Logger logger = LoggerFactory.getLogger(DSSDataGovernanceAssetRestful.class);
+
+ private static final String DEFAULT_DIRECTION = "BOTH";
+ private static final String DEFAULT_DEPTH = "3";
+ private static final String DEFAULT_LIMIT = "25";
+ private static final String DEFAULT_OFFSET = "0";
+
+ @Autowired
+ private AssetService assetService;
+ @Autowired
+ private WorkspaceInfoService workspaceInfoService;
+
+ @Resource
+ private LinkisWorkSpaceRemoteClient linkisWorkSpaceRemoteClient;
+
+ /**
+ * 获取数据资产概要:hivedb数、hivetable数据、总存储量
+ */
+ @GET
+ @Path("/hiveSummary")
+ public Response getHiveSummary(@Context HttpServletRequest req) throws Exception {
+
+ return Message.messageToResponse(Message.ok().data("result", assetService.getHiveSummary()));
+ }
+
+ /**
+ * 搜索hive表
+ */
+ @GET
+ @Path("/hiveTbl/search")
+ public Response searchHiveTbl(@QueryParam("classification") String classification,
+ @QueryParam("query") String query,
+ @QueryParam("label") String label,
+ @QueryParam("type") String type,
+ @QueryParam("precise")@DefaultValue("0") int precise,
+ @QueryParam("owner") @DefaultValue("") String owner,
+ @QueryParam("limit") @DefaultValue(DEFAULT_LIMIT) int limit,
+ @QueryParam("offset") @DefaultValue(DEFAULT_OFFSET) int offset) throws Exception {
+
+ //适配模型
+ if (ClassificationConstant.isTypeScope(type)) {
+ if (StringUtils.isNotBlank(classification)) {
+ classification = ClassificationConstant.getPrefix(type).orElse(null) + classification;
+ } else {
+ classification = ClassificationConstant.getRoot(type).orElse(null);
+ }
+ }
+ //适配标签
+ if (!StringUtils.isBlank(label)){
+ label = GlossaryConstant.LABEL.formatQuery(label);
+ }
+ //判断是否精确查询
+ if (QueryType.PRECISE.getCode()!=precise){
+ query = "*" + query + "*";
+ }
+ List hiveTblBasicList = assetService.searchHiveTable(classification, query,label,limit, offset);
+ if (StringUtils.isBlank(owner) || owner.equals("undefined")|| CollectionUtils.isEmpty(hiveTblBasicList)) {
+ return Message.messageToResponse(Message.ok().data("result", hiveTblBasicList));
+ } else {
+ List res = new ArrayList<>();
+ for (HiveTblSimpleInfo hiveTblSimpleInfo : hiveTblBasicList) {
+ if (hiveTblSimpleInfo.getOwner().equals(owner)) {
+ res.add(hiveTblSimpleInfo);
+ }
+ }
+ return Message.messageToResponse(Message.ok().data("result", res));
+ }
+ }
+
+ /**
+ * 搜索hive表统计信息
+ */
+ @GET
+ @Path("/hiveTbl/stats")
+ public Response searchHiveTblStats(@QueryParam("dbName") String dbName,
+ @QueryParam("tableName") String tableName,
+ @QueryParam("guid") String guid) throws Exception {
+ logger.info("searchHiveTblStats dbName : {}, tableName : {}, guid : {}", dbName, tableName, guid);
+ return Message.messageToResponse(Message.ok().data("result", assetService.hiveTblStats(dbName, tableName, guid)));
+
+ }
+
+ /**
+ * 搜索hive表容量
+ */
+ @GET
+ @Path("/hiveTbl/size")
+ public Response searchHiveTblSize(@QueryParam("dbName") String dbName,
+ @QueryParam("tableName") String tableName,
+ @QueryParam("guid") String guid) throws Exception {
+ logger.info("searchHiveTblSize dbName : {}, tableName : {}, guid : {}", dbName, tableName, guid);
+ return Message.messageToResponse(Message.ok().data("result", assetService.hiveTblSize(dbName, tableName, guid)));
+
+ }
+
+
+ /**
+ * 搜索hive库
+ */
+ @GET
+ @Path("/hiveDb/search")
+ public Response searchHiveDb(@QueryParam("classification") String classification,
+ @QueryParam("query") String query,
+ @QueryParam("owner") @DefaultValue("") String owner,
+ @QueryParam("limit") @DefaultValue(DEFAULT_LIMIT) int limit,
+ @QueryParam("offset") @DefaultValue(DEFAULT_OFFSET) int offset) throws Exception {
+
+ List hiveTblBasicList = assetService.searchHiveDb(classification, '*' + query + '*', limit, offset);
+ if (StringUtils.isBlank(owner) || owner.equals("undefined")) {
+ return Message.messageToResponse(Message.ok().data("result", hiveTblBasicList));
+ } else {
+ List res = new ArrayList<>();
+ for (HiveTblSimpleInfo hiveTblSimpleInfo : hiveTblBasicList) {
+ if (hiveTblSimpleInfo.getOwner().equals(owner)) {
+ res.add(hiveTblSimpleInfo);
+ }
+ }
+ return Message.messageToResponse(Message.ok().data("result", res));
+ }
+ }
+
+ /**
+ * 获取单个表的详细信息,包括:基本信息、字段信息
+ */
+ @GET
+ @Path("/hiveTbl/{guid}/basic")
+ public Response getHiveTblBasic(@PathParam("guid") String guid) throws Exception {
+ return Message.messageToResponse(Message.ok().data("result", assetService.getHiveTblDetail(guid)));
+ }
+
+ /**
+ * 获取表分区信息
+ */
+ @GET
+ @Path("/hiveTbl/{guid}/partition")
+ public Response getHiveTblPartition(@PathParam("guid") String guid) throws Exception {
+ List hiveTblPartition = assetService.getHiveTblPartition(guid);
+ if (hiveTblPartition.size() > 0) {
+ return Message.messageToResponse(Message.ok().data("result", hiveTblPartition));
+ } else {
+ return Message.messageToResponse(Message.ok().data("result", null));
+ }
+ }
+
+ /**
+ * 根据表名获取表分区信息
+ */
+ @GET
+ @Path("/hiveTbl/partition/name")
+ public Response getHiveTblPartitionByName(@QueryParam("dbName") String dbName,@QueryParam("tableName") String tableName) throws Exception {
+ logger.info("getHiveTblPartitionByName dbName : {}, tableName : {}", dbName, tableName);
+ List hiveTblPartition = assetService.getHiveTblPartitionByName(dbName,tableName);
+ return Message.messageToResponse(Message.ok().data("result", hiveTblPartition));
+ }
+
+ /**
+ * 获取表的血缘信息
+ */
+ @GET
+ @Path("/hiveTbl/{guid}/lineage")
+ public Response getHiveTblLineage(@PathParam("guid") String guid,
+ @QueryParam("direction") @DefaultValue(DEFAULT_DIRECTION) AtlasLineageInfo.LineageDirection direction,
+ @QueryParam("depth") @DefaultValue(DEFAULT_DEPTH) int depth) throws Exception {
+ return Message.messageToResponse(Message.ok().data("result", assetService.getHiveTblLineage(guid, direction, depth)));
+ }
+
+ /**
+ * 获取表的select语句
+ */
+ @GET
+ @Path("/hiveTbl/{guid}/select")
+ public Response getHiveTblSelect(@PathParam("guid") String guid) throws Exception {
+
+
+ return Message.messageToResponse(Message.ok().data("result", assetService.getTbSelect(guid)));
+
+ }
+
+ /**
+ * 获取表的create语句
+ */
+ @GET
+ @Path("/hiveTbl/{guid}/create")
+ public Response getHiveTblCreate(@PathParam("guid") String guid) throws Exception {
+ return Message.messageToResponse(Message.ok().data("result", assetService.getTbCreate(guid)));
+
+ }
+
+ /**
+ * 获取存储量前10的表信息
+ */
+ @GET
+ @Path("/hiveTbl/topStorage")
+ public Response getTop10Storage(@Context HttpServletRequest req) throws Exception {
+ List top10Table = assetService.getTop10Table();
+ return Message.messageToResponse(Message.ok().data("result", top10Table));
+ }
+
+ /**
+ * 修改单个表或单个列注释
+ */
+ @PUT
+ @Path("/comment/{guid}")
+ public Response modifyComment(@PathParam("guid") String guid, @QueryParam("comment") String comment) throws Exception {
+ comment = "\"" + comment + "\"";
+ assetService.modifyComment(guid, comment);
+ return Message.messageToResponse(Message.ok().data("result", "修改成功"));
+ }
+
+ /**
+ * 批量修改多个个表或列注释
+ */
+ @PUT
+ @Path("/comment/bulk")
+ public Response modifyComment(@RequestBody Map commentMap) throws Exception {
+ for (Map.Entry stringStringEntry : commentMap.entrySet()) {
+ stringStringEntry.setValue("\"" + stringStringEntry.getValue() + "\"");
+ }
+ assetService.bulkModifyComment(commentMap);
+
+ return Message.messageToResponse(Message.ok().data("result", "修改成功"));
+ }
+
+ /**
+ * 创建模型
+ *
+ * @param req
+ * @param vo
+ * @return
+ * @throws Exception
+ */
+ @POST
+ @Path("/model/type")
+ public Response createModelType(@Context HttpServletRequest req, @RequestBody CreateModelTypeVO vo) throws Exception {
+ logger.info("createModelType : {}", vo);
+ return Message.messageToResponse(Message.ok().data("result", assetService.createModelType(vo)));
+ }
+
+ /**
+ * 删除模型
+ *
+ * @param req
+ * @param vo
+ * @return
+ * @throws Exception
+ */
+ @POST
+ @Path("/model/type/delete")
+ public Response deleteModelType(@Context HttpServletRequest req, @RequestBody DeleteModelTypeVO vo) throws Exception {
+ logger.info("deleteModelTypeVO : {}", vo);
+ assetService.deleteModelType(vo);
+ return Message.messageToResponse(Message.ok().data("result", "删除成功"));
+ }
+
+
+ /**
+ * 绑定模型
+ *
+ * @param req
+ * @param vo
+ * @return
+ * @throws Exception
+ */
+ @POST
+ @Path("/model/bind")
+ public Response bindModelType(@Context HttpServletRequest req, @RequestBody BindModelVO vo) throws Exception {
+ logger.info("bindModelVO : {}", vo);
+ assetService.bindModelType(vo);
+ return Message.messageToResponse(Message.ok().data("result", "绑定成功"));
+ }
+
+ /**
+ * 解绑模型
+ *
+ * @param req
+ * @param vo
+ * @return
+ * @throws Exception
+ */
+ @POST
+ @Path("/model/unbind")
+ public Response unBindModelType(@Context HttpServletRequest req, @RequestBody UnBindModelVO vo) throws Exception {
+ logger.info("unBindModelVO : {}", vo);
+ assetService.unBindModel(vo);
+ return Message.messageToResponse(Message.ok().data("result", "解绑成功"));
+ }
+
+
+ /**
+ * 更新模型
+ *
+ * @param req
+ * @param vo
+ * @return
+ * @throws Exception
+ */
+ @POST
+ @Path("/model/type/modify")
+ public Response updateModelType(@Context HttpServletRequest req, @RequestBody UpdateModelTypeVO vo) throws Exception {
+ logger.info("updateModelTypeVO : {}", vo);
+ return Message.messageToResponse(Message.ok().data("result", assetService.updateModelType(vo)));
+ }
+
+ /**
+ * 创建标签
+ *
+ * @param req
+ * @param vo
+ * @return
+ * @throws Exception
+ */
+ @POST
+ @Path("/labels")
+ public Response createLabel(@Context HttpServletRequest req, @RequestBody CreateLabelVO vo) throws Exception {
+ logger.info("createLabel vo : {}", vo);
+ return Message.messageToResponse(Message.ok().data("result", assetService.createLabel(vo)));
+ }
+
+ /**
+ * 更新标签
+ *
+ * @param req
+ * @param vo
+ * @return
+ * @throws Exception
+ */
+ @POST
+ @Path("/labels/modify")
+ public Response updateLabel(@Context HttpServletRequest req, @RequestBody UpdateLabelVO vo) throws Exception {
+ logger.info("updateLabel vo : {}", vo);
+ return Message.messageToResponse(Message.ok().data("result", assetService.updateLabel(vo)));
+ }
+
+ /**
+ * 删除标签
+ *
+ * @param req
+ * @param vo
+ * @return
+ * @throws Exception
+ */
+ @POST
+ @Path("/labels/delete")
+ public Response deleteLabel(@Context HttpServletRequest req, @RequestBody DeleteLabelVO vo) throws Exception {
+ logger.info("deleteLabel vo : {}", vo);
+ assetService.deleteLabel(vo);
+ return Message.messageToResponse(Message.ok().data("result", "删除成功"));
+ }
+
+ /**
+ * 实体绑定标签
+ *
+ * @param req
+ * @param vo
+ * @return
+ * @throws Exception
+ */
+ @POST
+ @Path("/labels/bind")
+ public Response bindLabel(@Context HttpServletRequest req, @RequestBody BindLabelVO vo) throws Exception {
+ logger.info("bindLabel vo : {}", vo);
+ assetService.bindLabel(vo);
+ return Message.messageToResponse(Message.ok().data("result", "绑定成功"));
+ }
+
+
+ /**
+ * 实体解绑标签
+ *
+ * @param req
+ * @param vo
+ * @return
+ * @throws Exception
+ */
+ @POST
+ @Path("/labels/unbind")
+ public Response unBindLabel(@Context HttpServletRequest req, @RequestBody UnBindLabelVO vo) throws Exception {
+ logger.info("unBindLabel vo : {}", vo);
+ assetService.unBindLabel(vo);
+ return Message.messageToResponse(Message.ok().data("result", "解绑成功"));
+ }
+
+
+ /**
+ * 搜索标签
+ *
+ * @param req
+ * @param query
+ * @return
+ * @throws Exception
+ */
+ @GET
+ @Path("/labels/search")
+ public Response searchLabel(@Context HttpServletRequest req
+ , @QueryParam("query") String query
+ , @QueryParam("limit") @DefaultValue(DEFAULT_LIMIT) int limit
+ , @QueryParam("offset") @DefaultValue(DEFAULT_OFFSET) int offset) throws Exception {
+ logger.info("searchLabel query : {}", query);
+ return Message.messageToResponse(Message.ok().data("result",assetService.listLabels(query,limit,offset)));
+ }
+
+ /**
+ * 设置单个表或单个列的标签
+ */
+ @POST
+ @Path("/label/{guid}")
+ public Response setLabels(@PathParam("guid") String guid, @RequestBody Set labels) throws Exception {
+ logger.info("setLabels guid : {}, labels : {}", guid, labels);
+ assetService.setLabels(guid, labels);
+
+ return Message.messageToResponse(Message.ok().data("result", "设置成功"));
+ }
+
+ /**
+ * 获取工作空间下所有用户名
+ */
+ @GET
+ @Path("getWorkspaceUsers/{workspaceId}/{search}")
+ public Response getWorkspaceUsers(@PathParam("workspaceId") int workspaceId, @PathParam("search") String search) throws Exception {
+ String searchs = "%" + search + "%";
+ List workspaceUsers = workspaceInfoService.getWorkspaceUsers(workspaceId, searchs);
+ return Message.messageToResponse(Message.ok().data("result", workspaceUsers));
+
+ }
+
+ /**
+ * 查询用户
+ *
+ * @param req
+ * @param workspaceId
+ * @return
+ */
+ @GET
+ @Path("/users/{workspaceId}")
+ public Response users(@Context HttpServletRequest req, @PathParam("workspaceId") String workspaceId) throws ErrorException {
+ logger.info("users workspaceId : {}", workspaceId);
+ GetWorkspaceUsersResult result = linkisWorkSpaceRemoteClient.getWorkspaceUsers(GetWorkspaceUsersAction.builder().setUser(getStrategyUser(req)).setWorkspaceId(workspaceId).build());
+ return Message.messageToResponse(Message.ok().data("users", result.getWorkspaceUserList()));
+ }
+
+
+ /**
+ * 查询角色
+ *
+ * @param req
+ * @param workspaceId
+ * @return
+ */
+ @GET
+ @Path("/roles/{workspaceId}")
+ public Response roles(@Context HttpServletRequest req, @PathParam("workspaceId") String workspaceId) throws ErrorException {
+ logger.info("roles workspaceId : {}", workspaceId);
+ GetWorkspaceUsersResult result = linkisWorkSpaceRemoteClient.getWorkspaceUsers(GetWorkspaceUsersAction.builder().setUser(getStrategyUser(req)).setWorkspaceId(workspaceId).build());
+ return Message.messageToResponse(Message.ok().data("users", result.getWorkspaceRoleList()));
+ }
+
+
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/service/AssetService.java b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/service/AssetService.java
new file mode 100644
index 0000000000..d0c0ded84b
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/service/AssetService.java
@@ -0,0 +1,170 @@
+package com.webank.wedatasphere.dss.data.governance.service;
+
+
+import com.webank.wedatasphere.dss.data.governance.dto.HiveTblStatsDTO;
+import com.webank.wedatasphere.dss.data.governance.dto.SearchLabelDTO;
+import com.webank.wedatasphere.dss.data.governance.entity.*;
+import com.webank.wedatasphere.dss.data.governance.exception.DAOException;
+import com.webank.wedatasphere.dss.data.governance.exception.DataGovernanceException;
+import com.webank.wedatasphere.dss.data.governance.vo.*;
+import org.apache.atlas.AtlasServiceException;
+import org.apache.atlas.model.lineage.AtlasLineageInfo;
+
+import java.sql.SQLException;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+
+public interface AssetService {
+ public Map getHiveSummary() throws DataGovernanceException;
+
+ public List searchHiveTable(String classification, String query,String termName,
+ int limit, int offset) throws DataGovernanceException;
+
+ public List searchHiveDb(String classification, String query,
+ int limit, int offset) throws DataGovernanceException;
+
+ public HiveTblDetailInfo getHiveTblDetail(String guid) throws DataGovernanceException ;
+
+ public List getHiveTblPartition(String guid) throws DataGovernanceException;
+
+ public String getTbSelect(String guid) throws DataGovernanceException;
+
+ public String getTbCreate(String guid) throws DataGovernanceException;
+
+ public void modifyComment(String guid, String commentStr) throws DataGovernanceException ;
+
+ public void bulkModifyComment(Map commentMap) throws DataGovernanceException ;
+
+ public void setLabels(String guid, Set labels) throws DataGovernanceException;
+
+ /**
+ * 获取表实体的血缘信息
+ */
+ public AtlasLineageInfo getHiveTblLineage(final String guid, final AtlasLineageInfo.LineageDirection direction, final int depth) throws DataGovernanceException;
+
+ public List getTop10Table () throws DataGovernanceException, SQLException, DAOException;
+
+
+ /**
+ * 创建模型
+ * @param vo
+ * @return
+ */
+ CreateModelTypeInfo createModelType(CreateModelTypeVO vo) throws DataGovernanceException, AtlasServiceException;
+
+
+ /**
+ * 删除模型
+ * @param vo
+ * @throws Exception
+ */
+ void deleteModelType(DeleteModelTypeVO vo) throws Exception;
+
+
+
+ /**
+ * 更新模型
+ * @param vo
+ * @return
+ */
+ UpdateModelTypeInfo updateModelType(UpdateModelTypeVO vo) throws Exception;
+
+
+ /**
+ * 绑定模型
+ * @param vo
+ * @throws Exception
+ */
+ void bindModelType(BindModelVO vo) throws Exception;
+
+
+ /**
+ * 解绑模型
+ * @param vo
+ * @throws Exception
+ */
+ void unBindModel(UnBindModelVO vo) throws Exception;
+
+
+
+ /**
+ * 表统计信息
+ * @param dbName
+ * @param tableName
+ * @param guid
+ * @return
+ */
+ HiveTblStatsDTO hiveTblStats(String dbName, String tableName, String guid) throws AtlasServiceException, Exception;
+
+
+ /**
+ * 表统计信息
+ * @param dbName
+ * @param tableName
+ * @param guid
+ * @return
+ */
+ Long hiveTblSize(String dbName, String tableName, String guid) throws Exception;
+
+
+ /**
+ * 新建标签
+ * @param vo
+ * @return
+ * @throws Exception
+ */
+ CreateLabelInfo createLabel(CreateLabelVO vo) throws Exception;
+
+
+ /**
+ * 删除标签
+ * @param vo
+ * @return
+ * @throws Exception
+ */
+ void deleteLabel(DeleteLabelVO vo) throws Exception;
+
+
+ /**
+ * 删除标签
+ * @param vo
+ * @return
+ * @throws Exception
+ */
+ UpdateLabelInfo updateLabel(UpdateLabelVO vo) throws Exception;
+
+
+ /**
+ * 绑定标签
+ * @param vo
+ * @throws Exception
+ */
+ void bindLabel(BindLabelVO vo) throws Exception;
+
+
+ /**
+ * 解绑实体
+ * @param vo
+ * @throws Exception
+ */
+ void unBindLabel(UnBindLabelVO vo) throws Exception;
+
+ /**
+ * 标签搜索列表
+ * @param query
+ * @param limit
+ * @param offset
+ * @return
+ */
+ List listLabels(String query, Integer limit, Integer offset) throws AtlasServiceException, Exception;
+ /*
+ * 根据名称查询分区
+ * @param name
+ * @return
+ * @throws Exception
+ */
+ List getHiveTblPartitionByName(String dbName, String tableName) throws Exception;
+
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/service/AuthenticationClientStrategy.java b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/service/AuthenticationClientStrategy.java
new file mode 100644
index 0000000000..4a036cf58a
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/service/AuthenticationClientStrategy.java
@@ -0,0 +1,22 @@
+package com.webank.wedatasphere.dss.data.governance.service;
+
+
+
+import com.webank.wedatasphere.dss.data.governance.conf.ClientStrategy;
+import org.apache.linkis.common.conf.CommonVars;
+import org.apache.linkis.server.security.SecurityFilter;
+import org.apache.commons.lang.StringUtils;
+
+import javax.servlet.http.HttpServletRequest;
+
+public interface AuthenticationClientStrategy {
+
+ CommonVars CLIENT_STRATEGY = CommonVars.apply("wds.wedatasphere.data.assert.client.strategy", "");
+
+ default String getStrategyUser(HttpServletRequest req){
+ if (StringUtils.equals(ClientStrategy.TOKEN.getCode(),CLIENT_STRATEGY.getValue())){
+ return SecurityFilter.getLoginUsername(req);
+ }
+ return "hdfs";
+ }
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/service/WorkspaceInfoService.java b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/service/WorkspaceInfoService.java
new file mode 100644
index 0000000000..2cd9e43441
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/service/WorkspaceInfoService.java
@@ -0,0 +1,31 @@
+/*
+ *
+ * * Copyright 2019 WeBank
+ * *
+ * * Licensed under the Apache License, Version 2.0 (the "License");
+ * * you may not use this file except in compliance with the License.
+ * * You may obtain a copy of the License at
+ * *
+ * * http://www.apache.org/licenses/LICENSE-2.0
+ * *
+ * * Unless required by applicable law or agreed to in writing, software
+ * * distributed under the License is distributed on an "AS IS" BASIS,
+ * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * * See the License for the specific language governing permissions and
+ * * limitations under the License.
+ *
+ */
+
+package com.webank.wedatasphere.dss.data.governance.service;
+
+
+import com.webank.wedatasphere.dss.data.governance.exception.DataGovernanceException;
+
+import java.util.List;
+
+
+public interface WorkspaceInfoService {
+
+ public List getWorkspaceUsers(int workspaceId,String search) throws DataGovernanceException;
+
+}
diff --git a/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/service/impl/AssetServiceImpl.java b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/service/impl/AssetServiceImpl.java
new file mode 100644
index 0000000000..773318a16c
--- /dev/null
+++ b/dss-apps/dss-dataasset-management/data-assets-server/src/main/java/com/webank/wedatasphere/dss/data/governance/service/impl/AssetServiceImpl.java
@@ -0,0 +1,841 @@
+package com.webank.wedatasphere.dss.data.governance.service.impl;
+
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.google.common.collect.Sets;
+import com.google.gson.internal.LinkedTreeMap;
+import com.webank.wedatasphere.dss.data.governance.atlas.AtlasService;
+import com.webank.wedatasphere.dss.data.governance.dao.*;
+import com.webank.wedatasphere.dss.data.governance.dao.impl.MetaInfoMapperImpl;
+import com.webank.wedatasphere.dss.data.governance.dto.HiveTblStatsDTO;
+import com.webank.wedatasphere.dss.data.governance.dto.SearchLabelDTO;
+import com.webank.wedatasphere.dss.data.governance.entity.*;
+import com.webank.wedatasphere.dss.data.governance.exception.DAOException;
+import com.webank.wedatasphere.dss.data.governance.exception.DataGovernanceException;
+import com.webank.wedatasphere.dss.data.governance.restful.DSSDataGovernanceAssetRestful;
+import com.webank.wedatasphere.dss.data.governance.service.AssetService;
+import com.webank.wedatasphere.dss.data.governance.utils.DateUtil;
+import com.webank.wedatasphere.dss.data.governance.vo.*;
+import jersey.repackaged.com.google.common.collect.Lists;
+import org.apache.atlas.AtlasServiceException;
+import org.apache.atlas.model.glossary.AtlasGlossaryTerm;
+import org.apache.atlas.model.glossary.relations.AtlasTermAssignmentHeader;
+import org.apache.atlas.model.instance.AtlasEntity;
+import org.apache.atlas.model.instance.AtlasEntityHeader;
+import org.apache.atlas.model.instance.AtlasStruct;
+import org.apache.atlas.model.lineage.AtlasLineageInfo;
+import org.apache.atlas.model.typedef.AtlasClassificationDef;
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
+import javax.annotation.Resource;
+import java.util.*;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.stream.Collectors;
+
+
+@Service
+public class AssetServiceImpl implements AssetService {
+ private static final Logger logger = LoggerFactory.getLogger(AssetServiceImpl.class);
+ private AtlasService atlasService;
+ private MetaInfoMapper metaInfoMapper;
+ private WorkspaceInfoMapper workspaceInfoMapper;
+
+ @Resource
+ private TableColumnCountQueryMapper tableColumnCountQueryMapper;
+
+ @Resource
+ private TableSizeInfoMapper tableSizeInfoMapper;
+
+ @Resource
+ private TableSizePartitionInfoMapper tableSizePartitionInfoMapper;
+
+ public AssetServiceImpl(AtlasService atlasService) {
+ this.atlasService = atlasService;
+ this.metaInfoMapper = new MetaInfoMapperImpl();
+ }
+
+ @Override
+ public Map getHiveSummary() throws DataGovernanceException {
+ try {
+ Map result = new HashMap<>();
+
+ result.put("hiveDb", atlasService.getHiveDbCnt());
+ result.put("hiveTable", atlasService.getHiveTableCnt());
+ result.put("hiveStore", metaInfoMapper.getTableStorage());
+
+ return result;
+ } catch (AtlasServiceException | DAOException exception) {
+ throw new DataGovernanceException(23000, exception.getMessage());
+ }
+ }
+
+
+ @Override
+ public CreateModelTypeInfo createModelType(CreateModelTypeVO vo) throws DataGovernanceException {
+ if (!ClassificationConstant.isTypeScope(vo.getType())) {
+ throw new DataGovernanceException(23000, "不支持此类型" + vo.getType());
+ }
+ try {
+ AtlasClassificationDef atlasClassificationDef = atlasService.createSubClassification(ClassificationConstant.formatName(vo.getType(), vo.getName()).get(), ClassificationConstant.getRoot(vo.getType()).get());
+ CreateModelTypeInfo dto = new CreateModelTypeInfo();
+ dto.setGuid(atlasClassificationDef.getGuid());
+ dto.setName(atlasClassificationDef.getName());
+ return dto;
+ } catch (AtlasServiceException ex) {
+ throw new DataGovernanceException(23000, ex.getMessage());
+ }
+ }
+
+
+ @Override
+ public void deleteModelType(DeleteModelTypeVO vo) throws Exception {
+ if (!ClassificationConstant.isTypeScope(vo.getType())) {
+ throw new DataGovernanceException(23000, "不支持此类型" + vo.getType());
+ }
+ try {
+ atlasService.deleteClassification(ClassificationConstant.formatName(vo.getType(), vo.getName()).get());
+ } catch (AtlasServiceException ex) {
+ throw new DataGovernanceException(23000, ex.getMessage());
+ }
+ }
+
+ @Override
+ public UpdateModelTypeInfo updateModelType(UpdateModelTypeVO vo) throws Exception {
+ if (!ClassificationConstant.isTypeScope(vo.getType())) {
+ throw new DataGovernanceException(23000, "不支持此类型" + vo.getType());
+ }
+ String newName = ClassificationConstant.formatName(vo.getType(), vo.getName()).get();
+ String root = ClassificationConstant.getRoot(vo.getType()).get();
+ String orgName = ClassificationConstant.formatName(vo.getType(), vo.getOrgName()).get();
+ AtlasClassificationDef atlasClassificationDef = null;
+ //首先尝试创建
+ try {
+ atlasClassificationDef = atlasService.createSubClassification(newName, root);
+ } catch (AtlasServiceException ex) {
+ //创建失败直接回退
+ throw new DataGovernanceException(23000, ex.getMessage());
+ }
+
+ //尝试原类型
+ try {
+ atlasService.deleteClassification(orgName);
+ } catch (AtlasServiceException ex) {
+ //回滚删除创建的新类型
+ try {
+ atlasService.deleteClassification(newName);
+ } catch (AtlasServiceException ex1) {
+ throw new DataGovernanceException(23000, ex1.getMessage());
+ }
+ throw new DataGovernanceException(23000, ex.getMessage());
+ }
+ UpdateModelTypeInfo info = new UpdateModelTypeInfo();
+ info.setGuid(atlasClassificationDef.getGuid());
+ info.setName(atlasClassificationDef.getName());
+ return info;
+ }
+
+
+ @Override
+ public void bindModelType(BindModelVO vo) throws Exception {
+ if (!ClassificationConstant.isTypeScope(vo.getModelType())) {
+ throw new DataGovernanceException(23000, "不支持此类型" + vo.getModelType());
+ }
+ String tableGuid = vo.getGuid();
+
+ if (StringUtils.isBlank(tableGuid)) {
+ tableGuid = getGuid(vo.getTableName());
+ }
+
+ try {
+ atlasService.addClassification(ClassificationConstant.formatName(vo.getModelType(), vo.getModelName()).get(), tableGuid, false);
+ } catch (AtlasServiceException ex) {
+ throw new DataGovernanceException(23000, ex.getMessage());
+ }
+
+ }
+
+ @Override
+ public void unBindModel(UnBindModelVO vo) throws Exception {
+ if (!ClassificationConstant.isTypeScope(vo.getModelType())) {
+ throw new DataGovernanceException(23000, "不支持此类型" + vo.getModelType());
+ }
+ String tableGuid = vo.getGuid();
+
+ if (StringUtils.isBlank(tableGuid)) {
+ tableGuid = getGuid(vo.getTableName());
+ }
+
+ try {
+ atlasService.deleteClassification(tableGuid, ClassificationConstant.formatName(vo.getModelType(), vo.getModelName()).get());
+ } catch (AtlasServiceException ex) {
+ throw new DataGovernanceException(23000, ex.getMessage());
+ }
+
+ }
+
+ private String getGuid(String tableName) throws DataGovernanceException {
+
+ //首先搜索指定表,查找guid
+ List atlasEntityHeaders = null;
+ try {
+ atlasEntityHeaders = atlasService.searchHiveTable0(null, tableName, null,true, 1, 0);
+ } catch (AtlasServiceException ex) {
+ throw new DataGovernanceException(23000, ex.getMessage());
+ }
+ if (CollectionUtils.isEmpty(atlasEntityHeaders)) {
+ throw new DataGovernanceException(23000, "table " + tableName + " not find");
+ }
+
+ if (atlasEntityHeaders.size() > 1) {
+ throw new DataGovernanceException(23000, "table " + tableName + " duplicate " + atlasEntityHeaders);
+ }
+ return atlasEntityHeaders.get(0).getGuid();
+ }
+
+ @Override
+ public List searchHiveTable(String classification, String query, String termName,
+ int limit, int offset) throws DataGovernanceException {
+ List atlasEntityHeaders = null;
+ try {
+ atlasEntityHeaders = atlasService.searchHiveTable0(classification, query, termName,true, limit, offset);
+ } catch (AtlasServiceException ex) {
+ throw new DataGovernanceException(23000, ex.getMessage());
+ }
+
+ if (atlasEntityHeaders != null) {
+ return atlasEntityHeaders.parallelStream().map(atlasEntityHeader -> {
+ HiveTblSimpleInfo hiveTblBasic = new HiveTblSimpleInfo();
+ hiveTblBasic.setGuid(atlasEntityHeader.getGuid());
+ hiveTblBasic.setName(atlasEntityHeader.getAttribute("name").toString());
+ hiveTblBasic.setQualifiedName(atlasEntityHeader.getAttribute("qualifiedName").toString());
+ hiveTblBasic.setOwner(atlasEntityHeader.getAttribute("owner").toString());
+ Object createTime = atlasEntityHeader.getAttribute("createTime");
+ if (createTime != null) {
+ hiveTblBasic.setCreateTime(DateUtil.unixToTimeStr((Double) createTime));
+ }
+ hiveTblBasic.setClassifications(atlasEntityHeader.getClassificationNames());
+
+ Object comment = atlasEntityHeader.getAttribute("comment");
+ if (comment != null) {
+ hiveTblBasic.setComment(comment.toString());
+ }
+
+ Object aliases = atlasEntityHeader.getAttribute("aliases");
+ if (aliases != null) {
+ hiveTblBasic.setAliases(aliases.toString());
+ }
+
+ Object lastAccessTime = atlasEntityHeader.getAttribute("lastAccessTime");
+ if (lastAccessTime != null) {
+ hiveTblBasic.setLastAccessTime(DateUtil.unixToTimeStr((Double) lastAccessTime));
+ }
+
+ Object parameters = atlasEntityHeader.getAttribute("parameters");
+ if (parameters != null) {
+ Map mapParameters = (Map) parameters;
+ Object totalSize = mapParameters.get("totalSize");
+ if (totalSize != null) {
+ hiveTblBasic.setTotalSize(totalSize.toString());
+ }
+ }
+
+ return hiveTblBasic;
+ }).collect(Collectors.toList());
+ }
+ return null;
+ }
+
+ @Override
+ public List searchHiveDb(String classification, String query, int limit, int offset) throws DataGovernanceException {
+ List atlasEntityHeaders = null;
+ try {
+ atlasEntityHeaders = atlasService.searchHiveDb(classification, query, true, limit, offset);
+ } catch (AtlasServiceException ex) {
+ throw new DataGovernanceException(23000, ex.getMessage());
+ }
+
+ if (atlasEntityHeaders != null) {
+ return atlasEntityHeaders.parallelStream().map(atlasEntityHeader -> {
+ HiveTblSimpleInfo hiveTblBasic = new HiveTblSimpleInfo();
+ hiveTblBasic.setGuid(atlasEntityHeader.getGuid());
+ hiveTblBasic.setName(atlasEntityHeader.getAttribute("name").toString());
+ hiveTblBasic.setQualifiedName(atlasEntityHeader.getAttribute("qualifiedName").toString());
+ hiveTblBasic.setOwner(atlasEntityHeader.getAttribute("owner").toString());
+
+
+ Object createTime = atlasEntityHeader.getAttribute("createTime");
+ if (createTime != null) {
+ hiveTblBasic.setCreateTime(DateUtil.unixToTimeStr((Double) createTime));
+ }
+
+
+ return hiveTblBasic;
+ }).collect(Collectors.toList());
+ }
+ return null;
+ }
+
+ @Override
+ public HiveTblDetailInfo getHiveTblDetail(String guid) throws DataGovernanceException {
+ try {
+ HiveTblDetailInfo hiveTblDetailInfo = new HiveTblDetailInfo();
+
+ AtlasEntity atlasEntity = atlasService.getHiveTbl(guid);
+ Map hiveTblNameAndIsPartById = atlasService.getHiveTblNameAndIsPartById(guid);
+ Boolean isPartTable = (Boolean) hiveTblNameAndIsPartById.get("isPartition");
+ int storage = 0;
+ String db_name = String.valueOf(atlasEntity.getAttributes().get("qualifiedName")).split("@")[0];
+ String tableName = db_name.split("\\.")[1];
+ String dbName = db_name.split("\\.")[0];
+ try {
+ storage = metaInfoMapper.getTableInfo(dbName, tableName, isPartTable);
+ } catch (DAOException e) {
+ e.printStackTrace();
+ }
+ List guids = new ArrayList<>();
+ List> columns = (List>) atlasEntity.getAttributes().get("columns");
+ for (LinkedTreeMap column : columns) {
+ guids.add(column.get("guid"));
+ }
+ List hiveColumnInfos = new ArrayList<>();
+ if (guids.size() > 0) {
+ List hiveColumnsByGuids = atlasService.getHiveColumnsByGuids(guids);
+ for (AtlasEntity hiveColumnsByGuid : hiveColumnsByGuids) {
+ HiveTblDetailInfo.HiveColumnInfo hiveColumnInfo = new HiveTblDetailInfo.HiveColumnInfo();
+ hiveColumnInfo.setName(String.valueOf(hiveColumnsByGuid.getAttributes().get("name")));
+ hiveColumnInfo.setType(String.valueOf(hiveColumnsByGuid.getAttributes().get("type")));
+ hiveColumnInfo.setComment(String.valueOf(hiveColumnsByGuid.getAttributes().get("comment")));
+ hiveColumnInfo.setGuid(hiveColumnsByGuid.getGuid());
+ hiveColumnInfos.add(hiveColumnInfo);
+ }
+ }
+ List partguids = new ArrayList<>();
+ List> partitionKeys = (List>) atlasEntity.getAttributes().get("partitionKeys");
+ for (LinkedTreeMap column : partitionKeys) {
+ partguids.add(column.get("guid"));
+ }
+ List partitionColumns = new ArrayList<>();
+ if (partguids.size() > 0) {
+ List hivePartColumnsByGuids = atlasService.getHiveColumnsByGuids(partguids);
+ for (AtlasEntity hiveColumnsByGuid : hivePartColumnsByGuids) {
+ HiveTblDetailInfo.HiveColumnInfo hiveColumnInfo = new HiveTblDetailInfo.HiveColumnInfo();
+ hiveColumnInfo.setName(String.valueOf(hiveColumnsByGuid.getAttributes().get("name")));
+ hiveColumnInfo.setType(String.valueOf(hiveColumnsByGuid.getAttributes().get("type")));
+ hiveColumnInfo.setComment(String.valueOf(hiveColumnsByGuid.getAttributes().get("comment")));
+ hiveColumnInfo.setGuid(hiveColumnsByGuid.getGuid());
+ partitionColumns.add(hiveColumnInfo);
+ }
+ }
+ HiveTblDetailInfo.HiveTblBasicInfo basic = new HiveTblDetailInfo.HiveTblBasicInfo();
+ basic.setName(tableName);
+ basic.setQualifiedName(atlasEntity.getAttribute("qualifiedName").toString());
+ basic.setOwner(String.valueOf(atlasEntity.getAttributes().get("owner")));
+ basic.setCreateTime(new java.text.SimpleDateFormat("yyyy MM-dd HH:mm:ss").format(atlasEntity.getCreateTime()));
+ basic.setStore(String.valueOf(storage));
+ //设置标签
+ Set labels = Sets.newHashSet();
+ List