|
51 | 51 | */ |
52 | 52 | public class JiraHelper { |
53 | 53 |
|
54 | | - public static final String FORK_TO_JIRA_FIELD = "customfield_10321"; |
55 | | - public static final String FORK_FROM_JIRA_FIELD = "customfield_10320"; |
56 | | - public static final String USER_LIST_JIRA_FIELD = "customfield_10323"; |
57 | | - public static final String ISSUE_TRACKER_JIRA_FIELD = "customfield_11320"; |
58 | | - public static final String DONE_JIRA_RESOLUTION_NAME = "Done"; |
59 | | - |
60 | 54 | /** |
61 | 55 | * Creates JIRA client using settings from {@link ConnectionInfo} and {@link IrcBotConfig}. |
62 | 56 | * @return Created client with configured authentication settings. |
@@ -85,13 +79,6 @@ static <T> T wait(Promise<T> promise) |
85 | 79 | return promise.get(IrcBotConfig.JIRA_TIMEOUT_SEC, TimeUnit.SECONDS); |
86 | 80 | } |
87 | 81 |
|
88 | | - @Nonnull |
89 | | - static Issue getIssue(JiraRestClient client, String ticket) |
90 | | - throws ExecutionException, TimeoutException, InterruptedException { |
91 | | - return client.getIssueClient().getIssue(ticket).get(IrcBotConfig.JIRA_TIMEOUT_SEC, TimeUnit.SECONDS); |
92 | | - } |
93 | | - |
94 | | - |
95 | 82 | static boolean close(JiraRestClient client) { |
96 | 83 | try { |
97 | 84 | if (client != null) { |
@@ -140,53 +127,4 @@ static String getSummary(String ticket) throws IOException, ExecutionException, |
140 | 127 | close(client); |
141 | 128 | return result; |
142 | 129 | } |
143 | | - |
144 | | - @CheckForNull |
145 | | - static String getFieldValue(@Nonnull Issue issue, @Nonnull String fieldId) { |
146 | | - return getFieldValueOrDefault(issue, fieldId, null); |
147 | | - } |
148 | | - |
149 | | - @Nullable |
150 | | - public static String getFieldValueOrDefault(@Nonnull Issue issue, @Nonnull String fieldId, @CheckForNull String defaultValue) { |
151 | | - String res = defaultValue; |
152 | | - for (IssueField val : issue.getFields()) { |
153 | | - String thisFieldId = val.getId(); |
154 | | - if (thisFieldId.equalsIgnoreCase(fieldId)) { |
155 | | - Object _value = val.getValue(); |
156 | | - if (_value != null) { |
157 | | - if(_value instanceof String) { |
158 | | - res = (String) _value; |
159 | | - break; |
160 | | - } else if (_value instanceof JSONObject) { |
161 | | - JSONObject _jsonValue = (JSONObject)_value; |
162 | | - if(_jsonValue.has("value")) { |
163 | | - try { |
164 | | - res = _jsonValue.getString("value"); |
165 | | - break; |
166 | | - } catch(JSONException e) { |
167 | | - // we should log this? |
168 | | - res = defaultValue; |
169 | | - } |
170 | | - } |
171 | | - } |
172 | | - } |
173 | | - } |
174 | | - } |
175 | | - return res; |
176 | | - } |
177 | | - |
178 | | - static Iterable<Transition> getTransitions(@Nonnull Issue issue) throws IOException, ExecutionException, TimeoutException, InterruptedException { |
179 | | - JiraRestClient client = createJiraClient(); |
180 | | - return client.getIssueClient().getTransitions(issue).get(IrcBotConfig.JIRA_TIMEOUT_SEC, TimeUnit.SECONDS); |
181 | | - } |
182 | | - |
183 | | - @CheckForNull |
184 | | - static Transition getTransitionByName(@Nonnull Iterable<Transition> transitions, String name) { |
185 | | - for (Transition transition : transitions) { |
186 | | - if (transition.getName().equalsIgnoreCase(name)) { |
187 | | - return transition; |
188 | | - } |
189 | | - } |
190 | | - return null; |
191 | | - } |
192 | 130 | } |
0 commit comments