You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2022/12/14 08:12:07 UTC

[GitHub] [dolphinscheduler] github-code-scanning[bot] commented on a diff in pull request #13184: [Feature][Api] When use api to run a process we want get processInstanceId

github-code-scanning[bot] commented on code in PR #13184:
URL: https://github.com/apache/dolphinscheduler/pull/13184#discussion_r1048134016


##########
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/TriggerRelationServiceImpl.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.apache.dolphinscheduler.service.process;
+
+import org.apache.dolphinscheduler.common.enums.ApiTriggerType;
+import org.apache.dolphinscheduler.dao.entity.TriggerRelation;
+import org.apache.dolphinscheduler.dao.mapper.TriggerRelationMapper;
+
+import java.util.Date;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ *  Trigger relation operator to db
+ */
+@Component
+public class TriggerRelationServiceImpl implements TriggerRelationService {
+
+    @Autowired
+    private TriggerRelationMapper triggerRelationMapper;
+
+    public void saveTriggerTdoDb(ApiTriggerType type, Long triggerCode, Integer jobId) {
+        TriggerRelation triggerRelation = new TriggerRelation();
+        triggerRelation.setTriggerType(type.getCode());
+        triggerRelation.setJobId(jobId);
+        triggerRelation.setTriggerCode(triggerCode);
+        triggerRelation.setCreateTime(new Date());
+        triggerRelation.setUpdateTime(new Date());
+        triggerRelationMapper.upsert(triggerRelation);
+    }
+
+    public TriggerRelation queryByTypeAndJobId(ApiTriggerType apiTriggerType, int jobId) {

Review Comment:
   ## Missing Override annotation
   
   This method overrides [TriggerRelationService.queryByTypeAndJobId](1); it is advisable to add an Override annotation.
   
   [Show more details](https://github.com/apache/dolphinscheduler/security/code-scanning/2392)



##########
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/TriggerRelationServiceImpl.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.apache.dolphinscheduler.service.process;
+
+import org.apache.dolphinscheduler.common.enums.ApiTriggerType;
+import org.apache.dolphinscheduler.dao.entity.TriggerRelation;
+import org.apache.dolphinscheduler.dao.mapper.TriggerRelationMapper;
+
+import java.util.Date;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ *  Trigger relation operator to db
+ */
+@Component
+public class TriggerRelationServiceImpl implements TriggerRelationService {
+
+    @Autowired
+    private TriggerRelationMapper triggerRelationMapper;
+
+    public void saveTriggerTdoDb(ApiTriggerType type, Long triggerCode, Integer jobId) {

Review Comment:
   ## Missing Override annotation
   
   This method overrides [TriggerRelationService.saveTriggerTdoDb](1); it is advisable to add an Override annotation.
   
   [Show more details](https://github.com/apache/dolphinscheduler/security/code-scanning/2393)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org