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

net.thucydides.plugins.jira.domain.IssueSummary Maven / Gradle / Ivy

There is a newer version: 0.9.268
Show newest version
package net.thucydides.plugins.jira.domain;

import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;

import java.net.URI;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class IssueSummary {

    private final URI self;
    private final Long id;
    private final String key;
    private final String summary;
    private final String description;
    private final String type;
    private final List labels;
    private final List fixVersions;
    private final Map customFieldValues;
    private final Map renderedFieldValues;

    public IssueSummary(URI self, Long id, String key, String summary, String description, Map renderedFieldValues, String type) {
        this(self, id, key, summary, description, renderedFieldValues, type,
                new ArrayList(), new ArrayList(), new HashMap());
    }

    public IssueSummary(URI self, Long id, String key, String summary, String description, Map renderedFieldValues,
                        String type, List labels, List fixVersions, Map customFields) {
        this.self = self;
        this.id = id;
        this.key = key;
        this.summary = summary;
        this.description = description;
        this.renderedFieldValues = renderedFieldValues;
        this.type = type;
        this.labels = ImmutableList.copyOf(labels);
        this.fixVersions = ImmutableList.copyOf(fixVersions);
        this.customFieldValues = ImmutableMap.copyOf(customFields);
    }

    public URI getSelf() {
        return self;
    }

    public Long getId() {
        return id;
    }

    public String getKey() {
        return key;
    }

    public String getSummary() {
        return summary;
    }

    public String getDescription() {
        return description;
    }

    public String getType() {
        return type;
    }

    public List getLabels() {
        return labels;
    }

    public List getFixVersions() {
        return fixVersions;
    }

    @Override
    public String toString() {
        return "IssueSummary{" +
                "key='" + key + '\'' +
                ", summary='" + summary + '\'' +
                '}';
    }

    public Optional customField(String fieldName) {
        if (customFieldValues.get(fieldName) == null) {
            return Optional.absent();
        } else {
            return Optional.of(new CustomFieldCast(customFieldValues.get(fieldName)));
        }
    }

    public RenderedView getRendered() {
        return new RenderedView(renderedFieldValues);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy