forked from DataLinkDC/dinky
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature-3034][admin] Support task export (DataLinkDC#3808)
Co-authored-by: suxinshuo <[email protected]> Co-authored-by: suxinshuo <[email protected]>
- Loading branch information
1 parent
19ffae8
commit 43b6486
Showing
24 changed files
with
1,046 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
dinky-admin/src/main/java/org/dinky/data/bo/catalogue/export/ExportCatalogueBO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* | ||
* 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.dinky.data.bo.catalogue.export; | ||
|
||
import java.util.List; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Data | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class ExportCatalogueBO { | ||
|
||
private String name; | ||
|
||
private Boolean enabled; | ||
|
||
private Boolean isLeaf; | ||
|
||
private ExportTaskBO task; | ||
|
||
private String type; | ||
|
||
private List<ExportCatalogueBO> children; | ||
} |
66 changes: 66 additions & 0 deletions
66
dinky-admin/src/main/java/org/dinky/data/bo/catalogue/export/ExportTaskBO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* | ||
* 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.dinky.data.bo.catalogue.export; | ||
|
||
import org.dinky.data.model.ext.TaskExtConfig; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Data | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class ExportTaskBO { | ||
|
||
private String name; | ||
|
||
private String dialect; | ||
|
||
private String type; | ||
|
||
private Integer checkPoint; | ||
|
||
private Integer savePointStrategy; | ||
|
||
private Integer parallelism; | ||
|
||
private Boolean fragment; | ||
|
||
private Boolean statementSet; | ||
|
||
private Boolean batchModel; | ||
|
||
private Integer envId; | ||
|
||
private Integer alertGroupId; | ||
|
||
private TaskExtConfig configJson; | ||
|
||
private String note; | ||
|
||
private Integer step; | ||
|
||
private Boolean enabled; | ||
|
||
private String statement; | ||
} |
68 changes: 68 additions & 0 deletions
68
dinky-admin/src/main/java/org/dinky/data/dto/ImportCatalogueDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* | ||
* 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.dinky.data.dto; | ||
|
||
import org.dinky.data.bo.catalogue.export.ExportCatalogueBO; | ||
|
||
import java.io.BufferedReader; | ||
import java.io.IOException; | ||
import java.io.InputStreamReader; | ||
import java.util.Objects; | ||
|
||
import org.springframework.web.multipart.MultipartFile; | ||
import org.springframework.web.multipart.MultipartHttpServletRequest; | ||
|
||
import cn.hutool.json.JSONUtil; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
||
@Slf4j | ||
@Getter | ||
@Builder | ||
public class ImportCatalogueDTO { | ||
|
||
private Integer parentCatalogueId; | ||
|
||
private ExportCatalogueBO exportCatalogue; | ||
|
||
public static ImportCatalogueDTO build(MultipartHttpServletRequest request) { | ||
int parentCatalogueId = Integer.parseInt(request.getParameter("pid")); | ||
ExportCatalogueBO exportCatalogue = null; | ||
MultipartFile file = request.getFile("file"); | ||
if (Objects.isNull(file)) { | ||
return null; | ||
} | ||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(file.getInputStream()))) { | ||
StringBuilder content = new StringBuilder(); | ||
String line; | ||
while ((line = reader.readLine()) != null) { | ||
content.append(line); | ||
} | ||
exportCatalogue = JSONUtil.toBean(content.toString(), ExportCatalogueBO.class); | ||
} catch (IOException e) { | ||
log.error("Convert MultipartHttpServletRequest to ExportCatalogueBO failed", e); | ||
} | ||
return ImportCatalogueDTO.builder() | ||
.parentCatalogueId(parentCatalogueId) | ||
.exportCatalogue(exportCatalogue) | ||
.build(); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
dinky-admin/src/main/java/org/dinky/data/vo/ExportCatalogueVO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* | ||
* 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.dinky.data.vo; | ||
|
||
import io.swagger.annotations.ApiModel; | ||
import io.swagger.annotations.ApiModelProperty; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Data | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@ApiModel(value = "ExportCatalogueVO", description = "The return value of export catalogue") | ||
public class ExportCatalogueVO { | ||
|
||
@ApiModelProperty(value = "FileName", dataType = "String", example = "data.json") | ||
private String fileName; | ||
|
||
@ApiModelProperty(value = "DataJson", dataType = "String") | ||
private String dataJson; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.