blob: 60a0b670e8b5576ae352097e277bfc38c6e51f2c [file] [log] [blame]
// Copyright (C) 2018 The Android Open Source Project
//
// 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.googlesource.gerrit.plugins.its.jira.restapi;
import java.text.SimpleDateFormat;
import java.util.Date;
/** Represents a version in JIRA. */
public class JiraVersion {
private final String description;
private final String name;
private final boolean archived;
private final boolean released;
private final String releaseDate;
private final String project;
private final Long projectId;
private JiraVersion(
String description,
String name,
boolean archived,
boolean released,
Date releaseDate,
String project,
Long projectId) {
this.description = description;
this.name = name;
this.archived = archived;
this.released = released;
if (releaseDate == null) {
this.releaseDate = null;
} else {
this.releaseDate = new SimpleDateFormat("yyyy-MM-dd").format(releaseDate);
}
this.project = project;
this.projectId = projectId;
}
public String getDescription() {
return description;
}
public String getName() {
return name;
}
public boolean isArchived() {
return archived;
}
public boolean isReleased() {
return released;
}
public String getReleaseDate() {
return releaseDate;
}
public String getProject() {
return project;
}
public Long getProjectId() {
return projectId;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private String description;
private String name;
private boolean archived;
private boolean released;
private Date releaseDate;
private String project;
private Long projectId;
private Builder() {}
public Builder description(String description) {
this.description = description;
return this;
}
public Builder name(String name) {
this.name = name;
return this;
}
public Builder archived(boolean archived) {
this.archived = archived;
return this;
}
public Builder released(boolean released) {
this.released = released;
return this;
}
public Builder releaseDate(Date releaseDate) {
this.releaseDate = releaseDate;
return this;
}
public Builder project(String project) {
this.project = project;
return this;
}
public Builder projectId(Long projectId) {
this.projectId = projectId;
return this;
}
public JiraVersion build() {
return new JiraVersion(
description, name, archived, released, releaseDate, project, projectId);
}
}
}