Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dinky
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangpeng
dinky
Commits
623fc445
Unverified
Commit
623fc445
authored
Feb 02, 2023
by
Licho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: constant, word error, and Task and TaskServiceImpl file.
parent
105baaed
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
61 additions
and
93 deletions
+61
-93
Task.java
dinky-admin/src/main/java/org/dinky/model/Task.java
+42
-41
StudioServiceImpl.java
...c/main/java/org/dinky/service/impl/StudioServiceImpl.java
+1
-1
TaskServiceImpl.java
...src/main/java/org/dinky/service/impl/TaskServiceImpl.java
+0
-0
Dialect.java
dinky-common/src/main/java/org/dinky/config/Dialect.java
+8
-8
CommonConstant.java
...mmon/src/main/java/org/dinky/constant/CommonConstant.java
+2
-2
NetConstant.java
...-common/src/main/java/org/dinky/constant/NetConstant.java
+7
-7
LogicUtil.java
dinky-common/src/main/java/org/dinky/utils/LogicUtil.java
+0
-33
conf.ts
dlink-web/src/components/Studio/conf.ts
+1
-1
No files found.
dinky-admin/src/main/java/org/dinky/model/Task.java
View file @
623fc445
...
@@ -24,9 +24,9 @@ import org.dinky.db.model.SuperEntity;
...
@@ -24,9 +24,9 @@ import org.dinky.db.model.SuperEntity;
import
org.dinky.job.JobConfig
;
import
org.dinky.job.JobConfig
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
com.baomidou.mybatisplus.annotation.FieldFill
;
import
com.baomidou.mybatisplus.annotation.FieldFill
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableField
;
...
@@ -38,6 +38,7 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
...
@@ -38,6 +38,7 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.EqualsAndHashCode
;
import
lombok.extern.slf4j.Slf4j
;
/**
/**
* 任务
* 任务
...
@@ -48,7 +49,8 @@ import lombok.EqualsAndHashCode;
...
@@ -48,7 +49,8 @@ import lombok.EqualsAndHashCode;
@Data
@Data
@EqualsAndHashCode
(
callSuper
=
false
)
@EqualsAndHashCode
(
callSuper
=
false
)
@TableName
(
"dinky_task"
)
@TableName
(
"dinky_task"
)
public
class
Task
extends
SuperEntity
{
@Slf4j
public
class
Task
extends
SuperEntity
<
Task
>
{
private
static
final
long
serialVersionUID
=
5988972129893667154L
;
private
static
final
long
serialVersionUID
=
5988972129893667154L
;
...
@@ -127,32 +129,36 @@ public class Task extends SuperEntity {
...
@@ -127,32 +129,36 @@ public class Task extends SuperEntity {
@TableField
(
exist
=
false
)
@TableField
(
exist
=
false
)
private
String
alertGroupName
;
private
String
alertGroupName
;
public
static
final
ObjectMapper
objectMapper
=
new
ObjectMapper
();
@SuppressWarnings
(
"unchecked"
)
public
List
<
Map
<
String
,
String
>>
parseConfig
()
{
public
List
<
Map
<
String
,
String
>>
parseConfig
()
{
ObjectMapper
objectMapper
=
new
ObjectMapper
();
if
(
Asserts
.
isNullString
(
configJson
))
{
return
config
;
}
try
{
try
{
if
(
Asserts
.
isNotNullString
(
configJson
))
{
config
=
objectMapper
.
readValue
(
configJson
,
ArrayList
.
class
);
config
=
objectMapper
.
readValue
(
configJson
,
ArrayList
.
class
);
}
}
catch
(
JsonProcessingException
e
)
{
}
catch
(
JsonProcessingException
e
)
{
e
.
printStackTrace
(
);
log
.
error
(
e
.
getMessage
()
);
}
}
return
config
;
return
config
;
}
}
public
JobConfig
buildSubmitConfig
()
{
public
JobConfig
buildSubmitConfig
()
{
boolean
useRemote
=
true
;
boolean
useRemote
=
clusterId
!=
null
&&
clusterId
!=
0
;
if
(
clusterId
==
null
||
clusterId
==
0
)
{
Map
<
String
,
String
>
map
=
useRemote
=
false
;
config
.
stream
()
}
.
filter
(
Asserts:
:
isNotNull
)
Map
<
String
,
String
>
map
=
new
HashMap
<>();
.
collect
(
for
(
Map
<
String
,
String
>
item
:
config
)
{
Collectors
.
toMap
(
if
(
Asserts
.
isNotNull
(
item
))
{
item
->
item
.
get
(
"key"
),
map
.
put
(
item
.
get
(
"key"
),
item
.
get
(
"value"
));
item
->
item
.
get
(
"value"
),
}
(
a
,
b
)
->
b
));
}
int
jid
=
Asserts
.
isNull
(
jarId
)
?
0
:
jarId
;
int
jid
=
Asserts
.
isNull
(
jarId
)
?
0
:
jarId
;
boolean
fg
=
Asserts
.
isN
ull
(
fragment
)
?
false
:
fragment
;
boolean
fg
=
Asserts
.
isN
otNull
(
fragment
)
&&
fragment
;
boolean
sts
=
Asserts
.
isN
ull
(
statementSet
)
?
false
:
statementSet
;
boolean
sts
=
Asserts
.
isN
otNull
(
statementSet
)
&&
statementSet
;
return
new
JobConfig
(
return
new
JobConfig
(
type
,
type
,
step
,
step
,
...
@@ -174,30 +180,25 @@ public class Task extends SuperEntity {
...
@@ -174,30 +180,25 @@ public class Task extends SuperEntity {
map
);
map
);
}
}
public
JsonNode
parseJsonNode
()
{
ObjectMapper
mapper
=
new
ObjectMapper
();
return
parseJsonNode
(
mapper
);
}
public
JsonNode
parseJsonNode
(
ObjectMapper
mapper
)
{
public
JsonNode
parseJsonNode
(
ObjectMapper
mapper
)
{
Json
Node
jsonNode
=
mapper
.
createObjectNode
();
Object
Node
jsonNode
=
mapper
.
createObjectNode
();
((
ObjectNode
)
jsonNode
)
.
put
(
"name"
,
this
.
getName
());
jsonNode
.
put
(
"name"
,
this
.
getName
());
((
ObjectNode
)
jsonNode
)
.
put
(
"alias"
,
this
.
alias
);
jsonNode
.
put
(
"alias"
,
this
.
alias
);
((
ObjectNode
)
jsonNode
)
.
put
(
"dialect"
,
this
.
dialect
);
jsonNode
.
put
(
"dialect"
,
this
.
dialect
);
((
ObjectNode
)
jsonNode
)
.
put
(
"type"
,
this
.
type
);
jsonNode
.
put
(
"type"
,
this
.
type
);
((
ObjectNode
)
jsonNode
)
.
put
(
"statement"
,
this
.
statement
);
jsonNode
.
put
(
"statement"
,
this
.
statement
);
((
ObjectNode
)
jsonNode
)
.
put
(
"checkPoint"
,
this
.
checkPoint
);
jsonNode
.
put
(
"checkPoint"
,
this
.
checkPoint
);
((
ObjectNode
)
jsonNode
)
.
put
(
"savePointStrategy"
,
this
.
savePointStrategy
);
jsonNode
.
put
(
"savePointStrategy"
,
this
.
savePointStrategy
);
((
ObjectNode
)
jsonNode
)
.
put
(
"savePointPath"
,
this
.
savePointPath
);
jsonNode
.
put
(
"savePointPath"
,
this
.
savePointPath
);
((
ObjectNode
)
jsonNode
)
.
put
(
"parallelism"
,
this
.
parallelism
);
jsonNode
.
put
(
"parallelism"
,
this
.
parallelism
);
((
ObjectNode
)
jsonNode
)
.
put
(
"fragment"
,
this
.
fragment
);
jsonNode
.
put
(
"fragment"
,
this
.
fragment
);
((
ObjectNode
)
jsonNode
)
.
put
(
"statementSet"
,
this
.
statementSet
);
jsonNode
.
put
(
"statementSet"
,
this
.
statementSet
);
((
ObjectNode
)
jsonNode
)
.
put
(
"batchModel"
,
this
.
batchModel
);
jsonNode
.
put
(
"batchModel"
,
this
.
batchModel
);
((
ObjectNode
)
jsonNode
)
.
put
(
"clusterName"
,
this
.
clusterName
);
jsonNode
.
put
(
"clusterName"
,
this
.
clusterName
);
((
ObjectNode
)
jsonNode
)
.
put
(
"configJson"
,
this
.
configJson
);
jsonNode
.
put
(
"configJson"
,
this
.
configJson
);
((
ObjectNode
)
jsonNode
)
.
put
(
"note"
,
this
.
note
);
jsonNode
.
put
(
"note"
,
this
.
note
);
((
ObjectNode
)
jsonNode
)
.
put
(
"step"
,
this
.
step
);
jsonNode
.
put
(
"step"
,
this
.
step
);
((
ObjectNode
)
jsonNode
)
.
put
(
"enabled"
,
this
.
getEnabled
());
jsonNode
.
put
(
"enabled"
,
this
.
getEnabled
());
return
jsonNode
;
return
jsonNode
;
}
}
}
}
dinky-admin/src/main/java/org/dinky/service/impl/StudioServiceImpl.java
View file @
623fc445
...
@@ -373,7 +373,7 @@ public class StudioServiceImpl implements StudioService {
...
@@ -373,7 +373,7 @@ public class StudioServiceImpl implements StudioService {
@Override
@Override
public
LineageResult
getLineage
(
StudioCADTO
studioCADTO
)
{
public
LineageResult
getLineage
(
StudioCADTO
studioCADTO
)
{
if
(
Asserts
.
isNotNullString
(
studioCADTO
.
getDialect
())
if
(
Asserts
.
isNotNullString
(
studioCADTO
.
getDialect
())
&&
!
Dialect
.
FLINKSQL
.
equalsVal
(
studioCADTO
.
getDialect
()))
{
&&
!
Dialect
.
FLINK
_
SQL
.
equalsVal
(
studioCADTO
.
getDialect
()))
{
if
(
Asserts
.
isNull
(
studioCADTO
.
getDatabaseId
()))
{
if
(
Asserts
.
isNull
(
studioCADTO
.
getDatabaseId
()))
{
return
null
;
return
null
;
}
}
...
...
dinky-admin/src/main/java/org/dinky/service/impl/TaskServiceImpl.java
View file @
623fc445
This diff is collapsed.
Click to expand it.
dinky-common/src/main/java/org/dinky/config/Dialect.java
View file @
623fc445
...
@@ -28,9 +28,9 @@ import org.dinky.assertion.Asserts;
...
@@ -28,9 +28,9 @@ import org.dinky.assertion.Asserts;
* @since 2021/12/13
* @since 2021/12/13
*/
*/
public
enum
Dialect
{
public
enum
Dialect
{
FLINKSQL
(
"FlinkSql"
),
FLINK
_
SQL
(
"FlinkSql"
),
FLINKJAR
(
"FlinkJar"
),
FLINK
_
JAR
(
"FlinkJar"
),
FLINK
SQL
ENV
(
"FlinkSqlEnv"
),
FLINK
_SQL_
ENV
(
"FlinkSqlEnv"
),
SQL
(
"Sql"
),
SQL
(
"Sql"
),
JAVA
(
"Java"
),
JAVA
(
"Java"
),
PYTHON
(
"Python"
),
PYTHON
(
"Python"
),
...
@@ -43,13 +43,13 @@ public enum Dialect {
...
@@ -43,13 +43,13 @@ public enum Dialect {
DORIS
(
"Doris"
),
DORIS
(
"Doris"
),
PHOENIX
(
"Phoenix"
),
PHOENIX
(
"Phoenix"
),
HIVE
(
"Hive"
),
HIVE
(
"Hive"
),
STARROCKS
(
"StarRocks"
),
STAR
_
ROCKS
(
"StarRocks"
),
PRESTO
(
"Presto"
),
PRESTO
(
"Presto"
),
KUBERNETES_APPLICATION
(
"KubernetesAppl
ac
tion"
);
KUBERNETES_APPLICATION
(
"KubernetesAppl
ica
tion"
);
private
String
value
;
private
String
value
;
public
static
final
Dialect
DEFAULT
=
Dialect
.
FLINKSQL
;
public
static
final
Dialect
DEFAULT
=
Dialect
.
FLINK
_
SQL
;
Dialect
(
String
value
)
{
Dialect
(
String
value
)
{
this
.
value
=
value
;
this
.
value
=
value
;
...
@@ -69,7 +69,7 @@ public enum Dialect {
...
@@ -69,7 +69,7 @@ public enum Dialect {
return
type
;
return
type
;
}
}
}
}
return
Dialect
.
FLINKSQL
;
return
Dialect
.
FLINK
_
SQL
;
}
}
/**
/**
...
@@ -90,7 +90,7 @@ public enum Dialect {
...
@@ -90,7 +90,7 @@ public enum Dialect {
case
DORIS:
case
DORIS:
case
PHOENIX:
case
PHOENIX:
case
HIVE:
case
HIVE:
case
STARROCKS:
case
STAR
_
ROCKS:
case
PRESTO:
case
PRESTO:
return
true
;
return
true
;
default
:
default
:
...
...
dinky-common/src/main/java/org/dinky/constant/CommonConstant.java
View file @
623fc445
...
@@ -25,8 +25,8 @@ package org.dinky.constant;
...
@@ -25,8 +25,8 @@ package org.dinky.constant;
* @author wenmo
* @author wenmo
* @since 2021/5/28 9:35
* @since 2021/5/28 9:35
*/
*/
public
interface
CommonConstant
{
public
final
class
CommonConstant
{
/** 实例健康 */
/** 实例健康 */
String
HEALTHY
=
"1"
;
public
static
final
String
HEALTHY
=
"1"
;
}
}
dinky-common/src/main/java/org/dinky/constant/NetConstant.java
View file @
623fc445
...
@@ -19,18 +19,18 @@
...
@@ -19,18 +19,18 @@
package
org
.
dinky
.
constant
;
package
org
.
dinky
.
constant
;
public
interface
NetConstant
{
public
final
class
NetConstant
{
/** http:// */
/** http:// */
String
HTTP
=
"http://"
;
public
static
final
String
HTTP
=
"http://"
;
/** 冒号: */
/** 冒号: */
String
COLON
=
":"
;
public
static
final
String
COLON
=
":"
;
/** 斜杠/ */
/** 斜杠/ */
String
SLASH
=
"/"
;
public
static
final
String
SLASH
=
"/"
;
/** 连接运行服务器超时时间 1000 */
/** 连接运行服务器超时时间 1000 */
Integer
SERVER_TIME_OUT_ACTIVE
=
1000
;
public
static
final
Integer
SERVER_TIME_OUT_ACTIVE
=
1000
;
/** 读取服务器超时时间 3000 */
/** 读取服务器超时时间 3000 */
Integer
READ_TIME_OUT
=
3000
;
public
static
final
Integer
READ_TIME_OUT
=
3000
;
/** 连接FLINK历史服务器超时时间 2000 */
/** 连接FLINK历史服务器超时时间 2000 */
Integer
SERVER_TIME_OUT_HISTORY
=
3000
;
public
static
final
Integer
SERVER_TIME_OUT_HISTORY
=
3000
;
}
}
dinky-common/src/main/java/org/dinky/utils/LogicUtil.java
deleted
100644 → 0
View file @
105baaed
/*
*
* 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
.
utils
;
/** */
public
class
LogicUtil
{
public
static
<
T
>
boolean
IfThenRun
(
T
object
,
Class
<?>
clazz
,
Runnable
action
)
{
if
(
object
.
getClass
()
==
clazz
)
{
action
.
run
();
return
true
;
}
else
{
return
false
;
}
}
}
dlink-web/src/components/Studio/conf.ts
View file @
623fc445
...
@@ -43,7 +43,7 @@ export const DIALECT = {
...
@@ -43,7 +43,7 @@ export const DIALECT = {
PHOENIX
:
'Phoenix'
,
PHOENIX
:
'Phoenix'
,
STARROCKS
:
'StarRocks'
,
STARROCKS
:
'StarRocks'
,
PRESTO
:
'Presto'
,
PRESTO
:
'Presto'
,
KUBERNETES_APPLICATION
:
'KubernetesAppl
ac
tion'
,
KUBERNETES_APPLICATION
:
'KubernetesAppl
ica
tion'
,
JAVA
:
'Java'
,
JAVA
:
'Java'
,
SCALA
:
'Scala'
,
SCALA
:
'Scala'
,
PYTHON
:
'Python'
,
PYTHON
:
'Python'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment