Terminator111 commented on code in PR #5602:
URL: https://github.com/apache/shenyu/pull/5602#discussion_r1743948373


##########
shenyu-admin/src/main/java/org/apache/shenyu/admin/model/entity/ScalePolicyDO.java:
##########
@@ -0,0 +1,385 @@
+/*
+ * 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.shenyu.admin.model.entity;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shenyu.admin.model.dto.ScalePolicyDTO;
+import org.apache.shenyu.common.utils.DateUtils;
+import org.apache.shenyu.common.utils.UUIDUtils;
+
+import java.sql.Timestamp;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Objects;
+import java.util.Optional;
+
+/**
+ * Table: scale_policy.
+ */
+public final class ScalePolicyDO extends BaseDO {
+
+    private static final long serialVersionUID = -6895279885108899135L;
+
+    /**
+     * Column: sort.
+     * Type: INT.
+     * Remark: sort.
+     */
+    private Integer sort;
+
+    /**
+     * Column: status.
+     * Type: INT.
+     * Remark: status 1:enable 0:disable.
+     */
+    private Integer status;
+
+    /**
+     * Column: num.
+     * Type: INT.
+     * Remark: number of bootstrap.
+     */
+    private Integer num;
+
+    /**
+     * Column: begin_time.
+     * Type: DATETIME.
+     * Remark: begin time.
+     */
+    private Date beginTime;
+
+    /**
+     * Column: end_time.
+     * Type: DATETIME.
+     * Remark: end time.
+     */
+    private Date endTime;
+
+    /**
+     * Column: date_created.
+     * Type: TIMESTAMP.
+     * Default value: CURRENT_TIMESTAMP(3).
+     * Remark: create time.
+     */
+    private Date dateCreated;
+
+    /**
+     * Column: date_updated.
+     * Type: TIMESTAMP.
+     * Default value: CURRENT_TIMESTAMP(3).
+     * Remark: update time.
+     */
+    private Date dateUpdated;
+
+    public ScalePolicyDO() {
+    }
+
+    public ScalePolicyDO(final Integer sort, final Integer status, final 
Integer num, final Date beginTime, final Date endTime) {
+        this.sort = sort;
+        this.status = status;
+        this.num = num;
+        this.beginTime = beginTime;
+        this.endTime = endTime;
+    }
+
+    /**
+     * Gets the value of sort.
+     *
+     * @return the value of sort
+     */
+    public Integer getSort() {
+        return sort;
+    }
+
+    /**
+     * Sets the sort.
+     *
+     * @param sort sort
+     */
+    public void setSort(final Integer sort) {
+        this.sort = sort;
+    }
+
+    /**
+     * Gets the value of status.
+     *
+     * @return the value of status
+     */
+    public Integer getStatus() {
+        return status;
+    }
+
+    /**
+     * Sets the status.
+     *
+     * @param status status
+     */
+    public void setStatus(final Integer status) {
+        this.status = status;
+    }
+
+    /**
+     * Gets the value of num.
+     *
+     * @return the value of num
+     */
+    public Integer getNum() {
+        return num;
+    }
+
+    /**
+     * Sets the num.
+     *
+     * @param num num
+     */
+    public void setNum(final Integer num) {
+        this.num = num;
+    }
+
+    /**
+     * Gets the value of beginTime.
+     *
+     * @return the value of beginTime
+     */
+    public Date getBeginTime() {
+        return beginTime;
+    }
+
+    /**
+     * Sets the beginTime.
+     *
+     * @param beginTime beginTime
+     */
+    public void setBeginTime(final Date beginTime) {
+        this.beginTime = beginTime;
+    }
+
+    /**
+     * Gets the value of endTime.
+     *
+     * @return the value of endTime
+     */
+    public Date getEndTime() {
+        return endTime;
+    }
+
+    /**
+     * Sets the endTime.
+     *
+     * @param endTime endTime
+     */
+    public void setEndTime(final Date endTime) {
+        this.endTime = endTime;
+    }
+
+    @Override
+    public boolean equals(final Object o) {
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
+        if (!super.equals(o)) {
+            return false;
+        }
+        ScalePolicyDO that = (ScalePolicyDO) o;
+        return Objects.equals(sort, that.sort)
+                && Objects.equals(status, that.status)
+                && Objects.equals(num, that.num)
+                && Objects.equals(beginTime, that.beginTime)
+                && Objects.equals(endTime, that.endTime);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(super.hashCode(), sort, status, num, beginTime, 
endTime);
+    }
+
+    /**
+     * builder.
+     *
+     * @return ScalePolicyDOBuilder
+     */
+    public static ScalePolicyDO.ScalePolicyDOBuilder builder() {
+        return new ScalePolicyDO.ScalePolicyDOBuilder();
+    }
+
+    /**
+     * buildScalePolicyDO.
+     *
+     * @param scalePolicyDTO scalePolicyDTO
+     * @return ScalePolicyDO
+     */
+    public static ScalePolicyDO buildScalePolicyDO(final ScalePolicyDTO 
scalePolicyDTO) {
+        return Optional.ofNullable(scalePolicyDTO).map(item -> {
+            Timestamp currentTime = new Timestamp(System.currentTimeMillis());
+            try {
+                ScalePolicyDO scalePolicyDO =
+                        ScalePolicyDO.builder()
+                                .sort(item.getSort())
+                                .status(item.getStatus())
+                                .num(item.getNum())
+                                
.beginTime(DateUtils.isValidDate(item.getBeginTime())

Review Comment:
   when use manual strategy or dynamic strategy, there is not need to fill it.



-- 
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: notifications-unsubscr...@shenyu.apache.org

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

Reply via email to