You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by GitBox <gi...@apache.org> on 2022/05/25 06:47:37 UTC

[GitHub] [incubator-inlong] LvJiancheng commented on a diff in pull request #4373: [INLONG-4358][Manager]Support sqlserver source

LvJiancheng commented on code in PR #4373:
URL: https://github.com/apache/incubator-inlong/pull/4373#discussion_r881277264


##########
inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/pojo/source/sqlserver/SqlServerSourceDTO.java:
##########
@@ -0,0 +1,100 @@
+/*
+ * 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.inlong.manager.common.pojo.source.sqlserver;
+
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.apache.inlong.manager.common.enums.ErrorCodeEnum;
+import org.apache.inlong.manager.common.exceptions.BusinessException;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * Sqlserver source info
+ */
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class SqlServerSourceDTO {
+
+    private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
+
+    @ApiModelProperty("Username of the Sqlserver")
+    private String username;
+
+    @ApiModelProperty("Password of the Sqlserver")
+    private String password;
+
+    @ApiModelProperty("Hostname of the Sqlserver")
+    private String hostname;
+
+    @ApiModelProperty("Exposed port of the Sqlserver")
+    private int port;
+
+    @ApiModelProperty("database of the Sqlserver")
+    private String database;
+
+    @ApiModelProperty("schemaName of the Sqlserver")
+    private String schemaName;
+
+    @ApiModelProperty("tableName of the Sqlserver")
+    private String tableName;
+
+    @ApiModelProperty("Database time zone, Default is UTC")
+    private String serverTimezone;
+
+    @ApiModelProperty("Whether to migrate all databases")
+    private boolean allMigration;
+
+    @ApiModelProperty(value = "Primary key must be shared by all tables")
+    private String primaryKey;
+
+    /**
+     * Get the dto instance from the request
+     */
+    public static SqlServerSourceDTO getFromRequest(SqlServerSourceRequest request) {
+        return SqlServerSourceDTO.builder()
+                .username(request.getUsername())
+                .password(request.getPassword())
+                .hostname(request.getHostname())
+                .port(request.getPort())
+                .database(request.getDatabase())
+                .schemaName(request.getSchemaName())
+                .tableName(request.getTableName())
+                .serverTimezone(request.getServerTimezone())
+                .allMigration(request.isAllMigration())
+                .primaryKey(request.getPrimaryKey())
+                .build();
+    }
+

Review Comment:
   done



-- 
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@inlong.apache.org

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