You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@streampark.apache.org by "wolfboys (via GitHub)" <gi...@apache.org> on 2023/02/17 01:11:47 UTC

[GitHub] [incubator-streampark] wolfboys commented on a diff in pull request #2331: [Feature][Issue-2191][Issue-2215] Support external link

wolfboys commented on code in PR #2331:
URL: https://github.com/apache/incubator-streampark/pull/2331#discussion_r1109171803


##########
streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ExternalLinkServiceImpl.java:
##########
@@ -0,0 +1,124 @@
+/*
+ * 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.streampark.console.core.service.impl;
+
+import org.apache.streampark.common.util.Utils;
+import org.apache.streampark.console.core.entity.Application;
+import org.apache.streampark.console.core.entity.ExternalLink;
+import org.apache.streampark.console.core.enums.PlaceholderType;
+import org.apache.streampark.console.core.mapper.ExternalLinkMapper;
+import org.apache.streampark.console.core.service.ApplicationService;
+import org.apache.streampark.console.core.service.ExternalLinkService;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.PropertyPlaceholderHelper;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+
+@Slf4j
+@Service
+@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
+public class ExternalLinkServiceImpl extends ServiceImpl<ExternalLinkMapper, ExternalLink>
+    implements ExternalLinkService {
+
+  @Autowired private ApplicationService applicationService;
+
+  @Override
+  public void create(ExternalLink externalLink) {
+    if (!this.check(externalLink)) {
+      return;
+    }
+    externalLink.setCreateTime(new Date());
+    externalLink.setModifyTime(new Date());
+    externalLink.setId(null);
+    this.save(externalLink);
+  }
+
+  @Override
+  public void update(ExternalLink externalLink) {
+    if (!this.check(externalLink)) {
+      return;
+    }
+    externalLink.setModifyTime(new Date());
+    baseMapper.updateById(externalLink);
+  }
+
+  @Override
+  public void delete(Long linkId) {
+    baseMapper.deleteById(linkId);
+  }
+
+  @Override
+  public List<ExternalLink> render(Long appId) {
+    Application app = applicationService.getById(appId);
+    Utils.required(app != null, "Application doesn't exist");

Review Comment:
   Utils.notNull(app, msg...)



##########
streampark-console/streampark-console-service/src/main/assembly/script/schema/mysql-schema.sql:
##########
@@ -492,5 +492,17 @@ create table `t_alert_config` (
   index `inx_alert_user` (`user_id`) using btree
 ) engine = innodb default charset = utf8mb4 collate = utf8mb4_general_ci;
 
+-- ----------------------------
+-- Table of t_external_link
+-- ----------------------------
+drop table if exists `t_external_link`;
+CREATE TABLE `t_external_link` (
+  `id` bigint not null auto_increment primary key,
+  `name` varchar(255) collate utf8mb4_general_ci default null,
+  `link_url` varchar(255) collate utf8mb4_general_ci default null,
+  `image_url` varchar(255) collate utf8mb4_general_ci default null,

Review Comment:
   If the image address is base64, the varchar(255) length may be too short



-- 
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: issues-unsubscribe@streampark.apache.org

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