diff --git a/appconn/pom.xml b/appconn/pom.xml
new file mode 100644
index 00000000..2c2ae115
--- /dev/null
+++ b/appconn/pom.xml
@@ -0,0 +1,194 @@
+
+
+
+
+
+ dss
+ com.webank.wedatasphere.dss
+ 1.0.1
+ ../../../pom.xml
+
+ 4.0.0
+
+ dss-qualitis-appconn
+
+
+
+ com.webank.wedatasphere.dss
+ dss-project-plugin
+ ${dss.version}
+
+
+ com.webank.wedatasphere.dss
+ dss-appconn-core
+ ${dss.version}
+
+
+ com.webank.wedatasphere.dss
+ spring-origin-dss-project-plugin
+ ${dss.version}
+
+
+
+ com.webank.wedatasphere.dss
+ dss-structure-integration-standard
+ ${dss.version}
+
+
+
+ com.webank.wedatasphere.dss
+ dss-development-process-standard
+ ${dss.version}
+
+
+ com.webank.wedatasphere.dss
+ dss-development-process-standard-execution
+ ${dss.version}
+
+
+
+ org.apache.linkis
+ linkis-cs-common
+ ${linkis.version}
+ compile
+
+
+ org.apache.linkis
+ linkis-bml-client
+ ${linkis.version}
+
+
+ gson
+ com.google.code.gson
+
+
+ provided
+ true
+
+
+
+ org.apache.linkis
+ linkis-httpclient
+ ${linkis.version}
+
+
+ org.apache.linkis
+ linkis-common
+
+
+ json4s-jackson_2.11
+ org.json4s
+
+
+
+
+
+ org.apache.linkis
+ linkis-storage
+ ${linkis.version}
+ provided
+
+
+ org.apache.linkis
+ linkis-common
+
+
+
+
+
+ com.webank.wedatasphere.dss
+ dss-common
+ ${dss.version}
+ provided
+
+
+
+
+
+
+
+ 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
+ out
+ false
+ false
+
+ src/main/assembly/distribution.xml
+
+
+
+
+ org.apache.maven.plugins
+ maven-gpg-plugin
+
+ true
+
+
+
+
+
+ src/main/java
+
+ **/*.xml
+
+
+
+ src/main/resources
+
+ **/*.properties
+ **/application.yml
+ **/bootstrap.yml
+ **/log4j2.xml
+
+
+
+
+
+
\ No newline at end of file
diff --git a/appconn/src/main/assembly/distribution.xml b/appconn/src/main/assembly/distribution.xml
new file mode 100644
index 00000000..242b5d09
--- /dev/null
+++ b/appconn/src/main/assembly/distribution.xml
@@ -0,0 +1,78 @@
+
+
+
+ dss-qualitis-appconn
+
+ dir
+
+ true
+ qualitis
+
+
+
+ lib
+ true
+ true
+ false
+ true
+ true
+
+
+
+
+
+ ${basedir}/conf
+
+ *
+
+ 0777
+ conf
+ unix
+
+
+ ${basedir}/bin
+
+ *
+
+ 0777
+ bin
+ unix
+
+
+ .
+
+ */**
+
+ logs
+
+
+
+ ${basedir}/src/main/resources
+
+ init.sql
+
+ 0777
+ db
+ unix
+
+
+
+
+
diff --git a/appconn/src/main/java/com/webank/wedatasphere/dss/appconn/qualitis/QualitisAppConn.java b/appconn/src/main/java/com/webank/wedatasphere/dss/appconn/qualitis/QualitisAppConn.java
new file mode 100644
index 00000000..d073f2e0
--- /dev/null
+++ b/appconn/src/main/java/com/webank/wedatasphere/dss/appconn/qualitis/QualitisAppConn.java
@@ -0,0 +1,51 @@
+/*
+ * 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.appconn.qualitis;
+
+import com.webank.wedatasphere.dss.appconn.core.ext.ThirdlyAppConn;
+import com.webank.wedatasphere.dss.appconn.core.impl.AbstractOnlySSOAppConn;
+import com.webank.wedatasphere.dss.standard.app.development.standard.DevelopmentIntegrationStandard;
+import com.webank.wedatasphere.dss.standard.app.structure.StructureIntegrationStandard;
+import org.apache.linkis.common.conf.CommonVars;
+
+/**
+ * @author allenzhou@webank.com
+ * @date 2021/6/21 14:40
+ */
+public class QualitisAppConn extends AbstractOnlySSOAppConn implements ThirdlyAppConn {
+ public static final String QUALITIS_APPCONN_NAME = CommonVars.apply("wds.dss.appconn.qualitis.name", "Qualitis").getValue();
+
+ private QualitisDevelopmentIntegrationStandard developmentIntegrationStandard;
+ private QualitisStructureIntegrationStandard structureIntegrationStandard;
+
+ @Override
+ protected void initialize() {
+ structureIntegrationStandard = new QualitisStructureIntegrationStandard();
+ developmentIntegrationStandard = new QualitisDevelopmentIntegrationStandard();
+ }
+
+ @Override
+ public StructureIntegrationStandard getOrCreateStructureStandard() {
+ return structureIntegrationStandard;
+ }
+
+ @Override
+ public DevelopmentIntegrationStandard getOrCreateDevelopmentStandard() {
+ return developmentIntegrationStandard;
+ }
+
+}
diff --git a/appconn/src/main/java/com/webank/wedatasphere/dss/appconn/qualitis/QualitisDevelopmentIntegrationStandard.java b/appconn/src/main/java/com/webank/wedatasphere/dss/appconn/qualitis/QualitisDevelopmentIntegrationStandard.java
new file mode 100644
index 00000000..f0f8563a
--- /dev/null
+++ b/appconn/src/main/java/com/webank/wedatasphere/dss/appconn/qualitis/QualitisDevelopmentIntegrationStandard.java
@@ -0,0 +1,54 @@
+/*
+ * 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.appconn.qualitis;
+
+import com.webank.wedatasphere.dss.appconn.qualitis.execution.QualitisExecutionService;
+import com.webank.wedatasphere.dss.appconn.qualitis.service.QualitisCrudService;
+import com.webank.wedatasphere.dss.appconn.qualitis.service.QualitisQueryService;
+import com.webank.wedatasphere.dss.appconn.qualitis.service.QualitisRefExportService;
+import com.webank.wedatasphere.dss.appconn.qualitis.service.QualitisRefImportService;
+import com.webank.wedatasphere.dss.standard.app.development.service.*;
+import com.webank.wedatasphere.dss.standard.app.development.standard.AbstractDevelopmentIntegrationStandard;
+
+/**
+ * @author allenzhou@webank.com
+ * @date 2021/6/21 14:40
+ */
+public class QualitisDevelopmentIntegrationStandard extends AbstractDevelopmentIntegrationStandard {
+
+ @Override
+ protected RefCRUDService createRefCRUDService() {
+ return new QualitisCrudService();
+ }
+
+ @Override
+ protected RefExecutionService createRefExecutionService() { return new QualitisExecutionService(); }
+
+ @Override
+ protected RefExportService createRefExportService() {
+ return new QualitisRefExportService();
+ }
+
+ @Override
+ protected RefImportService createRefImportService() { return new QualitisRefImportService(); }
+
+ @Override
+ protected RefQueryService createRefQueryService() {
+ return new QualitisQueryService();
+ }
+
+}
diff --git a/appconn/src/main/java/com/webank/wedatasphere/dss/appconn/qualitis/QualitisStructureIntegrationStandard.java b/appconn/src/main/java/com/webank/wedatasphere/dss/appconn/qualitis/QualitisStructureIntegrationStandard.java
new file mode 100644
index 00000000..b5a2a533
--- /dev/null
+++ b/appconn/src/main/java/com/webank/wedatasphere/dss/appconn/qualitis/QualitisStructureIntegrationStandard.java
@@ -0,0 +1,33 @@
+/*
+ * 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.appconn.qualitis;
+
+import com.webank.wedatasphere.dss.appconn.qualitis.project.QualitisProjectService;
+import com.webank.wedatasphere.dss.standard.app.structure.AbstractStructureIntegrationStandard;
+import com.webank.wedatasphere.dss.standard.app.structure.project.ProjectService;
+
+/**
+ * @author allenzhou@webank.com
+ * @date 2021/6/21 14:40
+ */
+public class QualitisStructureIntegrationStandard extends AbstractStructureIntegrationStandard {
+
+ @Override
+ protected ProjectService createProjectService() {
+ return new QualitisProjectService();
+ }
+}
diff --git a/appconn/src/main/java/com/webank/wedatasphere/dss/appconn/qualitis/constant/QualitisProjectUserPermissionEnum.java b/appconn/src/main/java/com/webank/wedatasphere/dss/appconn/qualitis/constant/QualitisProjectUserPermissionEnum.java
new file mode 100644
index 00000000..4c4a486a
--- /dev/null
+++ b/appconn/src/main/java/com/webank/wedatasphere/dss/appconn/qualitis/constant/QualitisProjectUserPermissionEnum.java
@@ -0,0 +1,46 @@
+/*
+ * 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.appconn.qualitis.constant;
+
+/**
+ * @author allenzhou
+ */
+public enum QualitisProjectUserPermissionEnum {
+ /**
+ * 创建者(管理员: 编辑,删除,执行,查看),开发者(编辑),运维者(执行),业务员(查看)
+ */
+ CREATOR(1, "创建者"),
+ DEVELOPER(2, "开发者"),
+ OPERATOR(3, "运维者"),
+ BUSSMAN(4, "业务员");
+
+ private Integer code;
+ private String message;
+
+ QualitisProjectUserPermissionEnum(Integer code, String message) {
+ this.code = code;
+ this.message = message;
+ }
+
+ public Integer getCode() {
+ return code;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+}
diff --git a/appconn/src/main/java/com/webank/wedatasphere/dss/appconn/qualitis/constant/QualitisTaskStatusEnum.java b/appconn/src/main/java/com/webank/wedatasphere/dss/appconn/qualitis/constant/QualitisTaskStatusEnum.java
new file mode 100644
index 00000000..2e0351f4
--- /dev/null
+++ b/appconn/src/main/java/com/webank/wedatasphere/dss/appconn/qualitis/constant/QualitisTaskStatusEnum.java
@@ -0,0 +1,61 @@
+/*
+ * 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.appconn.qualitis.constant;
+
+/**
+ * @author allenzhou@webank.com
+ * @date 2021/7/12 20:17
+ */
+public enum QualitisTaskStatusEnum {
+ /**
+ * Task status enum
+ */
+ SUBMITTED(1, "已提交", "SUBMITTED"),
+ INITED(2, "初始化", "INITED"),
+ RUNNING(3, "运行中", "RUNNING"),
+ SUCCEED(4, "成功", "SUCCEED"),
+ PASS_CHECKOUT(5, "通过校验", "PASS_CHECKOUT"),
+ FAIL_CHECKOUT(6, "未通过校验", "FAIL_CHECKOUT"),
+ FAILED(7, "失败", "FAILED"),
+ TASK_NOT_EXIST(8, "Task不存在", "TASK_NOT_EXIST"),
+ CANCELLED(9, "取消", "CANCELLED"),
+ TIMEOUT(10, "超时", "TIMEOUT"),
+ SCHEDULED(11, "调度中", "SCHEDULED"),;
+
+ private Integer code;
+ private String message;
+ private String state;
+
+ QualitisTaskStatusEnum(Integer code, String message, String state) {
+ this.code = code;
+ this.message = message;
+ this.state = state;
+ }
+
+ public Integer getCode() {
+ return code;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public String getState() {
+ return state;
+ }
+
+}
diff --git a/appconn/src/main/java/com/webank/wedatasphere/dss/appconn/qualitis/execution/QualitisCompletedExecutionResponseRef.java b/appconn/src/main/java/com/webank/wedatasphere/dss/appconn/qualitis/execution/QualitisCompletedExecutionResponseRef.java
new file mode 100644
index 00000000..6c4f76f7
--- /dev/null
+++ b/appconn/src/main/java/com/webank/wedatasphere/dss/appconn/qualitis/execution/QualitisCompletedExecutionResponseRef.java
@@ -0,0 +1,50 @@
+/*
+ * 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.appconn.qualitis.execution;
+
+import com.webank.wedatasphere.dss.standard.app.development.listener.common.CompletedExecutionResponseRef;
+import java.util.Map;
+
+/**
+ * @author allenzhou@webank.com
+ * @date 2021/6/21 14:40
+ */
+public class QualitisCompletedExecutionResponseRef extends CompletedExecutionResponseRef {
+
+ public QualitisCompletedExecutionResponseRef(int status) {
+ super(status);
+ }
+
+ public QualitisCompletedExecutionResponseRef(int status, String errorMessage){
+ super(status);
+ this.errorMsg = errorMessage;
+ }
+
+ public QualitisCompletedExecutionResponseRef(String responseBody, int status) {
+ super(responseBody, status);
+ }
+
+ @Override
+ public Map toMap() {
+ return null;
+ }
+
+ @Override
+ public String getErrorMsg() {
+ return this.errorMsg;
+ }
+}
diff --git a/appconn/src/main/java/com/webank/wedatasphere/dss/appconn/qualitis/execution/QualitisExecutionService.java b/appconn/src/main/java/com/webank/wedatasphere/dss/appconn/qualitis/execution/QualitisExecutionService.java
new file mode 100644
index 00000000..70709095
--- /dev/null
+++ b/appconn/src/main/java/com/webank/wedatasphere/dss/appconn/qualitis/execution/QualitisExecutionService.java
@@ -0,0 +1,33 @@
+/*
+ * 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.appconn.qualitis.execution;
+
+import com.webank.wedatasphere.dss.standard.app.development.operation.RefExecutionOperation;
+import com.webank.wedatasphere.dss.standard.app.development.service.AbstractRefExecutionService;
+/**
+ * @author allenzhou@webank.com
+ * @date 2021/6/21 14:40
+ */
+public class QualitisExecutionService extends AbstractRefExecutionService {
+
+ @Override
+ public RefExecutionOperation createRefExecutionOperation() {
+ QualitisRefExecutionOperation qualtiisRefExecutionOperation = new QualitisRefExecutionOperation();
+ return qualtiisRefExecutionOperation;
+ }
+
+}
diff --git a/appconn/src/main/java/com/webank/wedatasphere/dss/appconn/qualitis/execution/QualitisRefExecutionAction.java b/appconn/src/main/java/com/webank/wedatasphere/dss/appconn/qualitis/execution/QualitisRefExecutionAction.java
new file mode 100644
index 00000000..00b4a159
--- /dev/null
+++ b/appconn/src/main/java/com/webank/wedatasphere/dss/appconn/qualitis/execution/QualitisRefExecutionAction.java
@@ -0,0 +1,91 @@
+/*
+ * 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.appconn.qualitis.execution;
+
+import com.webank.wedatasphere.dss.standard.app.development.listener.common.AbstractRefExecutionAction;
+import com.webank.wedatasphere.dss.standard.app.development.listener.common.LongTermRefExecutionAction;
+import com.webank.wedatasphere.dss.standard.app.sso.builder.SSOUrlBuilderOperation;
+
+/**
+ * @author allenzhou@webank.com
+ * @date 2021/7/12 15:20
+ */
+public class QualitisRefExecutionAction extends AbstractRefExecutionAction implements LongTermRefExecutionAction {
+ private String applicationId;
+
+ private String executionUser;
+
+ private int schedulerId;
+
+ private SSOUrlBuilderOperation ssoUrlBuilderOperation;
+
+ private String workspaceName;
+
+ public QualitisRefExecutionAction() {
+ }
+
+ public QualitisRefExecutionAction(String applicationId) {
+ this.applicationId = applicationId;
+ }
+
+ public QualitisRefExecutionAction(String applicationId, String executionUser) {
+ this.applicationId = applicationId;
+ this.executionUser = executionUser;
+ }
+
+ public String getApplicationId() {
+ return applicationId;
+ }
+
+ public void setApplicationId(String applicationId) {
+ this.applicationId = applicationId;
+ }
+
+ public String getExecutionUser() {
+ return executionUser;
+ }
+
+ public void setExecutionUser(String executionUser) {
+ this.executionUser = executionUser;
+ }
+
+ public SSOUrlBuilderOperation getSsoUrlBuilderOperation() {
+ return ssoUrlBuilderOperation;
+ }
+
+ public void setSsoUrlBuilderOperation(SSOUrlBuilderOperation ssoUrlBuilderOperation) {
+ this.ssoUrlBuilderOperation = ssoUrlBuilderOperation;
+ }
+
+ public String getWorkspaceName() {
+ return workspaceName;
+ }
+
+ public void setWorkspaceName(String workspaceName) {
+ this.workspaceName = workspaceName;
+ }
+
+ @Override
+ public void setSchedulerId(int schedulerId) {
+ this.schedulerId = schedulerId;
+ }
+
+ @Override
+ public int getSchedulerId() {
+ return schedulerId;
+ }
+}
diff --git a/appconn/src/main/java/com/webank/wedatasphere/dss/appconn/qualitis/execution/QualitisRefExecutionOperation.java b/appconn/src/main/java/com/webank/wedatasphere/dss/appconn/qualitis/execution/QualitisRefExecutionOperation.java
new file mode 100644
index 00000000..ab111124
--- /dev/null
+++ b/appconn/src/main/java/com/webank/wedatasphere/dss/appconn/qualitis/execution/QualitisRefExecutionOperation.java
@@ -0,0 +1,373 @@
+/*
+ * 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.appconn.qualitis.execution;
+
+import com.google.gson.Gson;
+import com.webank.wedatasphere.dss.appconn.qualitis.constant.QualitisTaskStatusEnum;
+import com.webank.wedatasphere.dss.appconn.qualitis.utils.HttpUtils;
+import com.webank.wedatasphere.dss.standard.app.development.listener.common.AsyncExecutionRequestRef;
+import com.webank.wedatasphere.dss.standard.app.development.listener.common.CompletedExecutionResponseRef;
+import com.webank.wedatasphere.dss.standard.app.development.listener.common.RefExecutionAction;
+import com.webank.wedatasphere.dss.standard.app.development.listener.common.RefExecutionState;
+import com.webank.wedatasphere.dss.standard.app.development.listener.core.Killable;
+import com.webank.wedatasphere.dss.standard.app.development.listener.core.LongTermRefExecutionOperation;
+import com.webank.wedatasphere.dss.standard.app.development.listener.core.Procedure;
+import com.webank.wedatasphere.dss.standard.app.development.ref.ExecutionRequestRef;
+import com.webank.wedatasphere.dss.standard.app.development.service.DevelopmentService;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.security.NoSuchAlgorithmException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.ws.rs.HttpMethod;
+import org.springframework.web.client.RestTemplate;
+import org.apache.commons.lang.RandomStringUtils;
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
+
+/**
+ * @author allenzhou@webank.com
+ * @date 2021/7/12 15:23
+ */
+public class QualitisRefExecutionOperation extends LongTermRefExecutionOperation implements Killable, Procedure {
+ private static final String SUBMIT_TASK_PATH = "/qualitis/outer/api/v1/execution";
+ private static final String GET_TASK_STATUS_PATH = "/qualitis/outer/api/v1/application/{applicationId}/status/";
+ private static final String GET_TASK_RESULT_PATH = "/qualitis/outer/api/v1/application/{applicationId}/result/";
+ private static final String KILL_TASK_PATH = "/qualitis/outer/api/v1/execution/application/kill/{applicationId}/{executionUser}";
+
+ private static Logger LOGGER = LoggerFactory.getLogger(QualitisRefExecutionOperation.class);
+
+ private String appId = "linkis_id";
+ private String appToken = "***REMOVED***";
+
+ private DevelopmentService developmentService;
+
+ @Override
+ public boolean kill(RefExecutionAction action) {
+ String applicationId = ((QualitisRefExecutionAction) action).getApplicationId();
+ String executtionUser = ((QualitisRefExecutionAction) action).getExecutionUser();
+ if (applicationId == null) {
+ LOGGER.error("Cannot get application id from QualitisNodeExecutionAction. Kill qualitis job failed.");
+ return false;
+ }
+ try {
+ // Send request and get response
+ RestTemplate restTemplate = new RestTemplate();
+ HttpHeaders headers = new HttpHeaders();
+ HttpEntity entity = new HttpEntity(headers);
+
+ String path = KILL_TASK_PATH.replace("{applicationId}", applicationId).replace("{executionUser}", executtionUser);
+ URI url = HttpUtils.buildUrI(getBaseUrl(), path, appId, appToken, RandomStringUtils.randomNumeric(5), String.valueOf(System.currentTimeMillis()));
+ String startLog = String.format("Start to kill job. url: %s, method: %s, body: %s", url, HttpMethod.GET, entity);
+ LOGGER.info(startLog);
+ Map response = restTemplate.getForEntity(url.toString(), Map.class).getBody();
+
+ if (response == null) {
+ String errorMsg = String.format("Error! Can not get kill result, job_id: %s, response is null", applicationId);
+ LOGGER.error(errorMsg);
+ return false;
+ }
+
+ if (!checkResponse(response)) {
+ String message = (String) response.get("message");
+ String errorMsg = String.format("Error! Can not get kill result, exception: {}", message);
+ LOGGER.error(errorMsg);
+ return false;
+ }
+
+ String finishLog = String.format("Succeed to get kill result. response: %s", response);
+ LOGGER.info(finishLog);
+ return true;
+ } catch (Exception e) {
+ String errorMsg = String.format("Error! Can not kill job result, job_id: %s", applicationId);
+ LOGGER.error(errorMsg, e);
+ return false;
+ }
+
+ }
+
+ @Override
+ protected RefExecutionAction submit(ExecutionRequestRef requestRef) {
+ try {
+ Map jobContent = requestRef.getJobContent();
+ LOGGER.info("Qualitis rule group content: " + new Gson().toJson(requestRef.getJobContent()));
+ String executionUser = String.valueOf(((AsyncExecutionRequestRef) requestRef).getExecutionRequestRefContext().getRuntimeMap().get("wds.dss.workflow.submit.user").toString());
+ String nodeName = "";
+ nodeName = String.valueOf(((AsyncExecutionRequestRef) requestRef).getExecutionRequestRefContext().getRuntimeMap().get("nodeName"));
+ if ("null".equals(nodeName) || StringUtils.isEmpty(nodeName)) {
+ nodeName = requestRef.getName();
+ }
+ LOGGER.info("The node name: " + nodeName);
+ String id = "";
+ if (jobContent.get("ruleGroupId") != null) {
+ id = jobContent.get("ruleGroupId").toString();
+ } else {
+ id = jobContent.get("rule_group_id").toString();
+ }
+ float f = Float.valueOf(id);
+
+ Long groupId = (long)f;
+
+ if (nodeName == null) {
+ String errorMsg = "Error! Can not submit job, node name is null";
+ LOGGER.error(errorMsg);
+ return null;
+ }
+ HttpHeaders headers = new HttpHeaders();
+ headers.setContentType(MediaType.APPLICATION_JSON);
+
+ Gson gson = new Gson();
+
+ Map requestPayLoad = new HashMap<>();
+ requestPayLoad.put("execution_user", executionUser);
+ requestPayLoad.put("create_user", executionUser);
+ requestPayLoad.put("node_name", nodeName);
+ requestPayLoad.put("group_id", groupId);
+
+ HttpEntity