Command.java 11.1 KB
Newer Older
L
ligang 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
/*
 * 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.
 */
17

Q
qiaozhanwei 已提交
18
package org.apache.dolphinscheduler.dao.entity;
L
ligang 已提交
19

20 21 22 23 24 25 26 27
import org.apache.dolphinscheduler.common.enums.CommandType;
import org.apache.dolphinscheduler.common.enums.FailureStrategy;
import org.apache.dolphinscheduler.common.enums.Priority;
import org.apache.dolphinscheduler.common.enums.TaskDependType;
import org.apache.dolphinscheduler.common.enums.WarningType;

import java.util.Date;

B
bao liang 已提交
28 29 30 31
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
L
ligang 已提交
32 33 34 35

/**
 * command
 */
36
@TableName("t_ds_command")
L
ligang 已提交
37 38 39 40 41
public class Command {

    /**
     * id
     */
42
    @TableId(value = "id", type = IdType.AUTO)
L
ligang 已提交
43 44 45 46 47
    private int id;

    /**
     * command type
     */
B
bao liang 已提交
48
    @TableField("command_type")
L
ligang 已提交
49 50 51
    private CommandType commandType;

    /**
52
     * process definition code
L
ligang 已提交
53
     */
54 55
    @TableField("process_definition_code")
    private long processDefinitionCode;
L
ligang 已提交
56 57 58 59

    /**
     * executor id
     */
B
bao liang 已提交
60
    @TableField("executor_id")
L
ligang 已提交
61 62 63 64 65
    private int executorId;

    /**
     * command parameter, format json
     */
B
bao liang 已提交
66
    @TableField("command_param")
L
ligang 已提交
67 68 69 70 71
    private String commandParam;

    /**
     * task depend type
     */
B
bao liang 已提交
72
    @TableField("task_depend_type")
L
ligang 已提交
73 74 75 76 77
    private TaskDependType taskDependType;

    /**
     * failure strategy
     */
B
bao liang 已提交
78
    @TableField("failure_strategy")
L
ligang 已提交
79 80 81
    private FailureStrategy failureStrategy;

    /**
B
bao liang 已提交
82
     * warning type
L
ligang 已提交
83
     */
B
bao liang 已提交
84
    @TableField("warning_type")
L
ligang 已提交
85 86 87 88 89
    private WarningType warningType;

    /**
     * warning group id
     */
90
    @TableField("warning_group_id")
L
ligang 已提交
91 92 93 94 95
    private Integer warningGroupId;

    /**
     * schedule time
     */
B
bao liang 已提交
96
    @TableField("schedule_time")
L
ligang 已提交
97 98 99 100 101
    private Date scheduleTime;

    /**
     * start time
     */
B
bao liang 已提交
102
    @TableField("start_time")
L
ligang 已提交
103 104 105 106 107
    private Date startTime;

    /**
     * process instance priority
     */
B
bao liang 已提交
108
    @TableField("process_instance_priority")
L
ligang 已提交
109 110 111 112 113
    private Priority processInstancePriority;

    /**
     * update time
     */
B
bao liang 已提交
114
    @TableField("update_time")
L
ligang 已提交
115 116
    private Date updateTime;

B
baoliang 已提交
117
    /**
G
gaojun2048 已提交
118
     * worker group
B
baoliang 已提交
119
     */
G
gaojun2048 已提交
120 121
    @TableField("worker_group")
    private String workerGroup;
B
baoliang 已提交
122

123 124 125 126 127 128
    /**
     * environment code
     */
    @TableField("environment_code")
    private Long environmentCode;

B
bao liang 已提交
129
    public Command() {
L
ligang 已提交
130 131 132 133 134 135 136 137 138 139 140
        this.taskDependType = TaskDependType.TASK_POST;
        this.failureStrategy = FailureStrategy.CONTINUE;
        this.startTime = new Date();
        this.updateTime = new Date();
    }

    public Command(
            CommandType commandType,
            TaskDependType taskDependType,
            FailureStrategy failureStrategy,
            int executorId,
141
            long processDefinitionCode,
L
ligang 已提交
142 143 144 145
            String commandParam,
            WarningType warningType,
            int warningGroupId,
            Date scheduleTime,
146
            String workerGroup,
147
            Long environmentCode,
B
bao liang 已提交
148
            Priority processInstancePriority) {
L
ligang 已提交
149 150
        this.commandType = commandType;
        this.executorId = executorId;
151
        this.processDefinitionCode = processDefinitionCode;
L
ligang 已提交
152 153 154 155 156 157 158 159
        this.commandParam = commandParam;
        this.warningType = warningType;
        this.warningGroupId = warningGroupId;
        this.scheduleTime = scheduleTime;
        this.taskDependType = taskDependType;
        this.failureStrategy = failureStrategy;
        this.startTime = new Date();
        this.updateTime = new Date();
160
        this.workerGroup = workerGroup;
161
        this.environmentCode = environmentCode;
L
ligang 已提交
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188
        this.processInstancePriority = processInstancePriority;
    }

    public TaskDependType getTaskDependType() {
        return taskDependType;
    }

    public void setTaskDependType(TaskDependType taskDependType) {
        this.taskDependType = taskDependType;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public CommandType getCommandType() {
        return commandType;
    }

    public void setCommandType(CommandType commandType) {
        this.commandType = commandType;
    }

189 190
    public long getProcessDefinitionCode() {
        return processDefinitionCode;
L
ligang 已提交
191 192
    }

193 194
    public void setProcessDefinitionCode(long processDefinitionCode) {
        this.processDefinitionCode = processDefinitionCode;
L
ligang 已提交
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268
    }

    public FailureStrategy getFailureStrategy() {
        return failureStrategy;
    }

    public void setFailureStrategy(FailureStrategy failureStrategy) {
        this.failureStrategy = failureStrategy;
    }

    public void setCommandParam(String commandParam) {
        this.commandParam = commandParam;
    }

    public String getCommandParam() {
        return commandParam;
    }

    public WarningType getWarningType() {
        return warningType;
    }

    public void setWarningType(WarningType warningType) {
        this.warningType = warningType;
    }

    public Integer getWarningGroupId() {
        return warningGroupId;
    }

    public void setWarningGroupId(Integer warningGroupId) {
        this.warningGroupId = warningGroupId;
    }

    public Date getScheduleTime() {
        return scheduleTime;
    }

    public void setScheduleTime(Date scheduleTime) {
        this.scheduleTime = scheduleTime;
    }

    public Date getStartTime() {
        return startTime;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }

    public int getExecutorId() {
        return executorId;
    }

    public void setExecutorId(int executorId) {
        this.executorId = executorId;
    }

    public Priority getProcessInstancePriority() {
        return processInstancePriority;
    }

    public void setProcessInstancePriority(Priority processInstancePriority) {
        this.processInstancePriority = processInstancePriority;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

G
gaojun2048 已提交
269 270
    public String getWorkerGroup() {
        return workerGroup;
B
baoliang 已提交
271 272
    }

G
gaojun2048 已提交
273 274
    public void setWorkerGroup(String workerGroup) {
        this.workerGroup = workerGroup;
B
baoliang 已提交
275 276
    }

277 278 279 280 281 282 283 284
    public Long getEnvironmentCode() {
        return this.environmentCode;
    }

    public void setEnvironmentCode(Long environmentCode) {
        this.environmentCode = environmentCode;
    }

285 286 287 288 289 290 291 292 293 294 295 296 297 298
    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        Command command = (Command) o;

        if (id != command.id) {
            return false;
        }
299
        if (processDefinitionCode != command.processDefinitionCode) {
300 301 302 303 304
            return false;
        }
        if (executorId != command.executorId) {
            return false;
        }
G
gaojun2048 已提交
305
        if (workerGroup != null ? workerGroup.equals(command.workerGroup) : command.workerGroup == null) {
306 307
            return false;
        }
308 309 310 311 312

        if (environmentCode != null ? environmentCode.equals(command.environmentCode) : command.environmentCode == null) {
            return false;
        }

313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347
        if (commandType != command.commandType) {
            return false;
        }
        if (commandParam != null ? !commandParam.equals(command.commandParam) : command.commandParam != null) {
            return false;
        }
        if (taskDependType != command.taskDependType) {
            return false;
        }
        if (failureStrategy != command.failureStrategy) {
            return false;
        }
        if (warningType != command.warningType) {
            return false;
        }
        if (warningGroupId != null ? !warningGroupId.equals(command.warningGroupId) : command.warningGroupId != null) {
            return false;
        }
        if (scheduleTime != null ? !scheduleTime.equals(command.scheduleTime) : command.scheduleTime != null) {
            return false;
        }
        if (startTime != null ? !startTime.equals(command.startTime) : command.startTime != null) {
            return false;
        }
        if (processInstancePriority != command.processInstancePriority) {
            return false;
        }
        return !(updateTime != null ? !updateTime.equals(command.updateTime) : command.updateTime != null);

    }

    @Override
    public int hashCode() {
        int result = id;
        result = 31 * result + (commandType != null ? commandType.hashCode() : 0);
348
        result = 31 * result + Long.hashCode(processDefinitionCode);
349 350 351 352 353 354 355 356 357 358
        result = 31 * result + executorId;
        result = 31 * result + (commandParam != null ? commandParam.hashCode() : 0);
        result = 31 * result + (taskDependType != null ? taskDependType.hashCode() : 0);
        result = 31 * result + (failureStrategy != null ? failureStrategy.hashCode() : 0);
        result = 31 * result + (warningType != null ? warningType.hashCode() : 0);
        result = 31 * result + (warningGroupId != null ? warningGroupId.hashCode() : 0);
        result = 31 * result + (scheduleTime != null ? scheduleTime.hashCode() : 0);
        result = 31 * result + (startTime != null ? startTime.hashCode() : 0);
        result = 31 * result + (processInstancePriority != null ? processInstancePriority.hashCode() : 0);
        result = 31 * result + (updateTime != null ? updateTime.hashCode() : 0);
G
gaojun2048 已提交
359
        result = 31 * result + (workerGroup != null ? workerGroup.hashCode() : 0);
360
        result = 31 * result + (environmentCode != null ? environmentCode.hashCode() : 0);
361 362
        return result;
    }
363

L
ligang 已提交
364 365
    @Override
    public String toString() {
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380
        return "Command{"
                + "id=" + id
                + ", commandType=" + commandType
                + ", processDefinitionCode=" + processDefinitionCode
                + ", executorId=" + executorId
                + ", commandParam='" + commandParam + '\''
                + ", taskDependType=" + taskDependType
                + ", failureStrategy=" + failureStrategy
                + ", warningType=" + warningType
                + ", warningGroupId=" + warningGroupId
                + ", scheduleTime=" + scheduleTime
                + ", startTime=" + startTime
                + ", processInstancePriority=" + processInstancePriority
                + ", updateTime=" + updateTime
                + ", workerGroup='" + workerGroup + '\''
381
                + ", environmentCode='" + environmentCode + '\''
382
                + '}';
L
ligang 已提交
383 384
    }
}
B
bao liang 已提交
385