All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.capitalone.dashboard.model.PipelineResponse Maven / Gradle / Ivy

There is a newer version: 3.4.53
Show newest version
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

public class PipelineResponse {
    private String name;
    private ObjectId collectorItemId;
    private List unmappedStages;
    private Map> stages = new LinkedHashMap<>();
    private String prodStage;
    private Map orderMap = new LinkedHashMap<>();

    public Map getOrderMap() {
        return orderMap;
    }

    public void setOrderMap(Map orderMap) {
        this.orderMap = orderMap;
    }
    public String getProdStage() { return prodStage; }

    public void setProdStage(String prodStage) { this.prodStage = prodStage; }

    public String getName() {
        return name;
    }

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

    public ObjectId getCollectorItemId() {
        return collectorItemId;
    }

    public void setCollectorItemId(ObjectId collectorItemId) {
        this.collectorItemId = collectorItemId;
    }

    public Map> getStages() {
        return stages;
    }

    public void setStages(Map> stages) {
        this.stages = stages;
    }

    public List getUnmappedStages() {
        return unmappedStages;
    }

    public void setUnmappedStages(List unmappedStages) {
        this.unmappedStages = unmappedStages;
    }

    public List getStageCommits(PipelineStage stage) {
        return getStages().get(stage.getName());
    }

    public void setStageCommits(PipelineStage stage, List commits) {
        getStages().put(stage.getName(), commits);
    }

    public void addToStage(PipelineStage stage, PipelineResponseCommit pipelineCommit) {
        List pipelineStage = stages.get(stage.getName());
        if (pipelineStage == null) {
            pipelineStage = new ArrayList<>();
            stages.put(stage.getName(), pipelineStage);
        }
        pipelineStage.add(pipelineCommit);
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        PipelineResponse that = (PipelineResponse) o;

        if (name != null ? !name.equals(that.name) : that.name != null) return false;
        if (!collectorItemId.equals(that.collectorItemId)) return false;
        return stages.equals(that.stages);

    }

    @Override
    public int hashCode() {
        int result = name != null ? name.hashCode() : 0;
        result = 31 * result + collectorItemId.hashCode();
        result = 31 * result + stages.hashCode();
        return result;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy