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.api.domain.input;
18  
19  import com.atlassian.jira.rest.client.api.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       * @param id     id of the issue transition which should be performed
39       * @param fields new values for the issue fields. Use empty collection if no fields are to be changed
40       */
41      public TransitionInput(int id, Collection<FieldInput> fields) {
42          this(id, fields, null);
43      }
44  
45  
46      /**
47       * @param id      id of the issue transition which should be performed
48       * @param fields  new values for the issue fields. Use empty collection if no fields are to be changed
49       * @param comment optional comment
50       */
51      public TransitionInput(int id, Collection<FieldInput> fields, @Nullable Comment comment) {
52          this.id = id;
53          this.comment = comment;
54          this.fields = fields;
55      }
56  
57      /**
58       * @param id      id of the issue transition which should be performed
59       * @param comment optional comment
60       */
61      public TransitionInput(int id, @Nullable Comment comment) {
62          this(id, Collections.<FieldInput>emptyList(), comment);
63      }
64  
65      public TransitionInput(int id) {
66          this(id, Collections.<FieldInput>emptyList(), null);
67      }
68  
69      /**
70       * @return id of the issue transition which should be performed
71       */
72      public int getId() {
73          return id;
74      }
75  
76      @Nullable
77      public Comment getComment() {
78          return comment;
79      }
80  
81      public Iterable<FieldInput> getFields() {
82          return fields;
83      }
84  }