com.baifendian.swordfish.dao.model.ProjectFlow.java Source code

Java tutorial

Introduction

Here is the source code for com.baifendian.swordfish.dao.model.ProjectFlow.java

Source

/*
 * Copyright (C) 2017 Baifendian Corporation
 *
 * Licensed 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 com.baifendian.swordfish.dao.model;

import com.baifendian.swordfish.dao.mapper.utils.EqualUtils;
import com.baifendian.swordfish.dao.model.flow.Property;
import com.baifendian.swordfish.dao.utils.json.JsonObjectDeserializer;
import com.baifendian.swordfish.dao.utils.json.JsonObjectSerializer;
import com.baifendian.swordfish.dao.utils.json.JsonUtil;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;

public class ProjectFlow {

    /**
     * ? id
     * ?
     **/
    private int id;

    /**
     * ???
     * ?/DTO?
     */
    private String name;

    /**
     *  id
     * ?
     */
    private int projectId;

    /**
     * ??
     * DTO?
     */
    private String projectName;

    /**
     * ???
     * ?/DTO?
     */
    private String desc;

    /**
     * 
     * ?/DTO?
     */
    private Date createTime;

    /**
     * 
     * ?/DTO?
     */
    private Date modifyTime;

    /**
     * owner id
     * ?
     */
    private int ownerId;

    /**
     * owner ??
     * DTO?
     */
    private String owner;

    /**
     * ?
     * ?/DTO?
     */
    private String proxyUser;

    /**
     * ?
     * ?
     */
    @JsonDeserialize(using = JsonObjectDeserializer.class)
    @JsonSerialize(using = JsonObjectSerializer.class)
    private String userDefinedParams;

    /**
     * ?
     * ?????DTO
     */
    private List<Property> userDefinedParamList;

    /**
     * ? map ,
     */
    private Map<String, String> userDefinedParamMap;

    /**
     * ?
     * ?/DTO?
     */
    @JsonDeserialize(using = JsonObjectDeserializer.class)
    @JsonSerialize(using = JsonObjectSerializer.class)
    private String extras;

    /**
     * ?
     * ?/DTO?
     */
    private String queue;

    /**
     * ?, ????
     */
    private List<FlowNode> flowsNodes;

    /**
     * ?
     * ?
     */
    private Integer flag;

    public ProjectFlow() {
    }

    public int getId() {
        return id;
    }

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

    public List<FlowNode> getFlowsNodes() {
        return flowsNodes;
    }

    public void setFlowsNodes(List<FlowNode> flowsNodes) {
        this.flowsNodes = flowsNodes;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getModifyTime() {
        return modifyTime;
    }

    public void setModifyTime(Date modifyTime) {
        this.modifyTime = modifyTime;
    }

    public int getOwnerId() {
        return ownerId;
    }

    public void setOwnerId(int ownerId) {
        this.ownerId = ownerId;
    }

    public String getOwner() {
        return owner;
    }

    public void setOwner(String owner) {
        this.owner = owner;
    }

    public String getProxyUser() {
        return proxyUser;
    }

    public void setProxyUser(String proxyUser) {
        this.proxyUser = proxyUser;
    }

    public int getProjectId() {
        return projectId;
    }

    public void setProjectId(int projectId) {
        this.projectId = projectId;
    }

    public String getProjectName() {
        return projectName;
    }

    public void setProjectName(String projectName) {
        this.projectName = projectName;
    }

    public String getExtras() {
        return extras;
    }

    public void setExtras(String extras) {
        this.extras = extras;
    }

    public String getQueue() {
        return queue;
    }

    public void setQueue(String queue) {
        this.queue = queue;
    }

    public String getUserDefinedParams() {
        return userDefinedParams;
    }

    public void setUserDefinedParams(String userDefinedParams) {
        this.userDefinedParamList = JsonUtil.parseObjectList(userDefinedParams, Property.class);
        this.userDefinedParams = userDefinedParams;
    }

    public List<Property> getUserDefinedParamList() {
        return userDefinedParamList;
    }

    public void setUserDefinedParamList(List<Property> userDefinedParamList) {
        this.userDefinedParams = JsonUtil.toJsonString(userDefinedParamList);
        this.userDefinedParamList = userDefinedParamList;
    }

    public Map<String, String> getUserDefinedParamMap() {
        List<Property> propList;

        if (userDefinedParamMap == null && StringUtils.isNotEmpty(userDefinedParams)) {
            propList = JsonUtil.parseObjectList(userDefinedParams, Property.class);
            userDefinedParamMap = propList.stream()
                    .collect(Collectors.toMap(Property::getProp, Property::getValue));
        }

        return userDefinedParamMap;
    }

    public void setUserDefinedParamMap(Map<String, String> userDefinedParamMap) {
        this.userDefinedParamMap = userDefinedParamMap;
    }

    public Integer getFlag() {
        return flag;
    }

    public void setFlag(Integer flag) {
        this.flag = flag;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }

        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        ProjectFlow that = (ProjectFlow) o;

        return id == that.id && projectId == that.projectId && ownerId == that.ownerId
                && Objects.equals(name, that.name) && Objects.equals(projectName, that.projectName)
                && Objects.equals(desc, that.desc) && Objects.equals(owner, that.owner)
                && Objects.equals(proxyUser, that.proxyUser)
                && Objects.equals(userDefinedParams, that.userDefinedParams) && Objects.equals(extras, that.extras)
                && Objects.equals(queue, that.queue) && EqualUtils.equalLists(flowsNodes, that.flowsNodes);
    }
}