View Javadoc

1   /*
2    * Copyright (C) 2010 Atlassian
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package com.atlassian.jira.rest.client.domain.input;
18  
19  import com.atlassian.jira.rest.client.domain.Comment;
20  
21  import javax.annotation.Nullable;
22  import java.util.Collection;
23  import java.util.Collections;
24  
25  /**
26   * Input data used while transitioning an issue including new values for this issue and the optional comment.  
27   *
28   * @since v0.1
29   */
30  public class TransitionInput {
31  	private final int id;
32  	@Nullable
33  	private final Comment comment;
34  
35  	private final Collection<FieldInput> fields;
36  
37  	/**
38  	 *
39  	 * @param id id of the issue transition which should be performed
40  	 * @param fields new values for the issue fields. Use empty collection if no fields are to be changed
41  	 */
42  	public TransitionInput(int id, Collection<FieldInput> fields) {
43  		this(id, fields, null);
44  	}
45  
46  
47  	/**
48  	 *
49  	 * @param id id of the issue transition which should be performed
50  	 * @param fields new values for the issue fields. Use empty collection if no fields are to be changed
51  	 * @param comment optional comment
52  	 */
53  	public TransitionInput(int id, Collection<FieldInput> fields, @Nullable Comment comment) {
54  		this.id = id;
55  		this.comment = comment;
56  		this.fields = fields;
57  	}
58  
59  	/**
60  	 *
61  	 * @param id id of the issue transition which should be performed
62  	 * @param comment optional comment
63  	 */
64  	public TransitionInput(int id, @Nullable Comment comment) {
65  		this(id, Collections.<FieldInput>emptyList(), comment);
66  	}
67  
68  	public TransitionInput(int id) {
69  		this(id, Collections.<FieldInput>emptyList(), null);
70  	}
71  
72  	/**
73  	 * @return id of the issue transition which should be performed
74  	 */
75  	public int getId() {
76  		return id;
77  	}
78  
79  	@Nullable
80  	public Comment getComment() {
81  		return comment;
82  	}
83  
84  	public Iterable<FieldInput> getFields() {
85  		return fields;
86  	}
87  }