diff --git a/src/main/java/com/meetme/plugins/jira/gerrit/data/GerritConfigurationImpl.java b/src/main/java/com/meetme/plugins/jira/gerrit/data/GerritConfigurationImpl.java index 2ac744a..18ba607 100644 --- a/src/main/java/com/meetme/plugins/jira/gerrit/data/GerritConfigurationImpl.java +++ b/src/main/java/com/meetme/plugins/jira/gerrit/data/GerritConfigurationImpl.java @@ -1,11 +1,11 @@ /* * Copyright 2012 MeetMe, Inc. - * + * * 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 @@ -13,17 +13,17 @@ */ package com.meetme.plugins.jira.gerrit.data; -import java.io.File; -import java.net.URI; - import com.atlassian.sal.api.pluginsettings.PluginSettings; import com.atlassian.sal.api.pluginsettings.PluginSettingsFactory; +import java.io.File; +import java.net.URI; + /** * {@link GerritConfiguration} implementation that uses {@link PluginSettings} to store * configuration data. - * - * @author Joe Hansche + * + * @author Joe Hansche */ public class GerritConfigurationImpl implements GerritConfiguration { private static final String PLUGIN_STORAGE_KEY = "com.meetme.plugins.jira.gerrit.data"; diff --git a/src/main/java/com/meetme/plugins/jira/gerrit/data/IssueReviewsImpl.java b/src/main/java/com/meetme/plugins/jira/gerrit/data/IssueReviewsImpl.java index 7da258f..a5e2e48 100644 --- a/src/main/java/com/meetme/plugins/jira/gerrit/data/IssueReviewsImpl.java +++ b/src/main/java/com/meetme/plugins/jira/gerrit/data/IssueReviewsImpl.java @@ -13,18 +13,6 @@ */ package com.meetme.plugins.jira.gerrit.data; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import net.sf.json.JSONObject; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import com.atlassian.core.user.preferences.Preferences; import com.atlassian.jira.issue.Issue; import com.atlassian.jira.project.Project; @@ -34,6 +22,18 @@ import com.sonyericsson.hudson.plugins.gerrit.gerritevents.ssh.Authentication; import com.sonyericsson.hudson.plugins.gerrit.gerritevents.ssh.SshException; +import net.sf.json.JSONObject; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + public class IssueReviewsImpl implements IssueReviewsManager { private static final Logger log = LoggerFactory.getLogger(IssueReviewsImpl.class); @@ -168,8 +168,8 @@ public TimedCache(final int capacity, final long expiration) { /** * Returns true if the requested key has expired from the cache. * - * @param key - * @return + * @param key the key + * @return whether the associated value exists and has expired */ private boolean hasKeyExpired(Object key) { if (timestamps.containsKey(key)) { diff --git a/src/main/java/com/meetme/plugins/jira/gerrit/data/IssueReviewsManager.java b/src/main/java/com/meetme/plugins/jira/gerrit/data/IssueReviewsManager.java index 4b3c90e..d86f8fb 100644 --- a/src/main/java/com/meetme/plugins/jira/gerrit/data/IssueReviewsManager.java +++ b/src/main/java/com/meetme/plugins/jira/gerrit/data/IssueReviewsManager.java @@ -1,11 +1,11 @@ /* * Copyright 2012 MeetMe, Inc. - * + * * 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 @@ -13,11 +13,6 @@ */ package com.meetme.plugins.jira.gerrit.data; -import java.io.IOException; -import java.util.List; - -import net.sf.json.JSONObject; - import com.atlassian.core.user.preferences.Preferences; import com.atlassian.jira.issue.Issue; import com.atlassian.jira.project.Project; @@ -25,46 +20,54 @@ import com.sonyericsson.hudson.plugins.gerrit.gerritevents.GerritQueryException; import com.sonyericsson.hudson.plugins.gerrit.gerritevents.GerritQueryHandler; +import net.sf.json.JSONObject; + +import java.io.IOException; +import java.util.List; + public interface IssueReviewsManager { /** * Gets all Gerrit reviews related to the {@link Issue#getKey() issue key}. - * - * @param issueKey + * + * @param issueKey the JIRA issue key * @return A list of {@link JSONObject}s, as retrieved from Gerrit. * @throws GerritQueryException If any failure occurs while querying the Gerrit server. * @see GerritQueryHandler */ - public abstract List getReviewsForIssue(String issueKey) throws GerritQueryException; + List getReviewsForIssue(String issueKey) throws GerritQueryException; /** * Gets all Gerrit reviews related to the {@link Project#getKey() project}. - * - * @param issueKey + * + * @param projectKey the JIRA Project key (i.e., {@code JIRA-123}'s projectKey would be {@code JIRA}) * @return A list of {@link JSONObject}s, as retrieved from Gerrit. * @throws GerritQueryException If any failure occurs while querying the Gerrit server. * @see GerritQueryHandler */ - public abstract List getReviewsForProject(String projectKey) throws GerritQueryException; + List getReviewsForProject(String projectKey) throws GerritQueryException; /** * Performs an approval/review of a change. - * - * @param issueKey - * @param change - * @param args - * @throws IOException + * + * @param issueKey the JIRA issue key + * @param change the Gerrit change + * @param args arguments to add to the approval + * @param prefs the {@link Preferences} for the viewing user + * @return whether the approval was successful + * @throws IOException if so */ - public abstract boolean doApproval(String issueKey, GerritChange change, String args, Preferences prefs) throws IOException; + boolean doApproval(String issueKey, GerritChange change, String args, Preferences prefs) throws IOException; /** * Performs approvals/reviews of all changes. - * - * @param issueKey - * @param change - * @param args - * @param prefs - * @throws IOException + * + * @param issueKey the JIRA issue key + * @param changes the set of Gerrit changes + * @param args arguments to add to each approval + * @param prefs the {@link Preferences} for the viewing user + * @return whether the approvals were successful + * @throws IOException if so */ - public abstract boolean doApprovals(String issueKey, List changes, String args, Preferences prefs) throws IOException; + boolean doApprovals(String issueKey, List changes, String args, Preferences prefs) throws IOException; } diff --git a/src/main/java/com/meetme/plugins/jira/gerrit/data/dto/GerritApproval.java b/src/main/java/com/meetme/plugins/jira/gerrit/data/dto/GerritApproval.java index 75273a4..70d8290 100644 --- a/src/main/java/com/meetme/plugins/jira/gerrit/data/dto/GerritApproval.java +++ b/src/main/java/com/meetme/plugins/jira/gerrit/data/dto/GerritApproval.java @@ -1,11 +1,11 @@ /* * Copyright 2012 MeetMe, Inc. - * + * * 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 @@ -13,16 +13,17 @@ */ package com.meetme.plugins.jira.gerrit.data.dto; -import static com.meetme.plugins.jira.gerrit.tabpanel.GerritEventKeys.BY; -import static com.sonyericsson.hudson.plugins.gerrit.gerritevents.dto.GerritEventKeys.EMAIL; -import static com.sonyericsson.hudson.plugins.gerrit.gerritevents.dto.GerritEventKeys.NAME; +import com.atlassian.crowd.embedded.api.User; +import com.sonyericsson.hudson.plugins.gerrit.gerritevents.dto.attr.Approval; + import net.sf.json.JSONObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.atlassian.crowd.embedded.api.User; -import com.sonyericsson.hudson.plugins.gerrit.gerritevents.dto.attr.Approval; +import static com.meetme.plugins.jira.gerrit.tabpanel.GerritEventKeys.BY; +import static com.sonyericsson.hudson.plugins.gerrit.gerritevents.dto.GerritEventKeys.EMAIL; +import static com.sonyericsson.hudson.plugins.gerrit.gerritevents.dto.GerritEventKeys.NAME; public class GerritApproval extends Approval implements Comparable { private static final Logger log = LoggerFactory.getLogger(GerritApproval.class); @@ -40,8 +41,8 @@ public GerritApproval() { /** * Creates the PatchSetApproval from a {@link JSONObject}. - * - * @param json + * + * @param json the JSON object with corresponding data. */ public GerritApproval(JSONObject json) { super(json); @@ -93,7 +94,7 @@ public static String getUpgradedLabelType(String type) { /** * Returns the approver's name. - * + * * @return Approver's name as a string. */ public String getBy() { @@ -102,7 +103,7 @@ public String getBy() { /** * Sets the approver's name. - * + * * @param by Approver's name */ public void setBy(String by) { @@ -111,8 +112,8 @@ public void setBy(String by) { /** * Returns the approval score as an integer. - * - * @return + * + * @return the integer approval score */ public int getValueAsInt() { String value = getValue(); diff --git a/src/main/java/com/meetme/plugins/jira/gerrit/data/dto/GerritChange.java b/src/main/java/com/meetme/plugins/jira/gerrit/data/dto/GerritChange.java index c14dbf9..058346e 100644 --- a/src/main/java/com/meetme/plugins/jira/gerrit/data/dto/GerritChange.java +++ b/src/main/java/com/meetme/plugins/jira/gerrit/data/dto/GerritChange.java @@ -1,11 +1,11 @@ /* * Copyright 2012 MeetMe, Inc. - * + * * 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 @@ -13,22 +13,23 @@ */ package com.meetme.plugins.jira.gerrit.data.dto; -import static com.meetme.plugins.jira.gerrit.tabpanel.GerritEventKeys.LAST_UPDATED; - -import java.util.Date; +import com.meetme.plugins.jira.gerrit.tabpanel.GerritEventKeys; +import com.sonyericsson.hudson.plugins.gerrit.gerritevents.dto.attr.Change; import net.sf.json.JSONObject; -import com.meetme.plugins.jira.gerrit.tabpanel.GerritEventKeys; -import com.sonyericsson.hudson.plugins.gerrit.gerritevents.dto.attr.Change; +import java.util.Date; +import static com.meetme.plugins.jira.gerrit.tabpanel.GerritEventKeys.LAST_UPDATED; + +/** + * @author Joe Hansche + */ public class GerritChange extends Change implements Comparable { /** * Gerrit review status enumeration, corresponding to the status string in the Gerrit change * payload. - * - * @author Joe Hansche */ public static enum Status { @@ -53,7 +54,7 @@ public GerritChange(JSONObject obj) { /** * Sorts {@link GerritChange}s in order by their Gerrit change number. - * + * * TODO: To be completely accurate, the changes should impose a dependency-tree ordering (via * --dependencies option) to GerritQuery! It is possible for an earlier ChangeId to be * refactored such that it is then dependent on a later change! diff --git a/src/main/java/com/meetme/plugins/jira/gerrit/tabpanel/GerritEventKeys.java b/src/main/java/com/meetme/plugins/jira/gerrit/tabpanel/GerritEventKeys.java index 4ac835b..768c785 100644 --- a/src/main/java/com/meetme/plugins/jira/gerrit/tabpanel/GerritEventKeys.java +++ b/src/main/java/com/meetme/plugins/jira/gerrit/tabpanel/GerritEventKeys.java @@ -17,7 +17,7 @@ * Extension of {@link com.sonyericsson.hudson.plugins.gerrit.gerritevents.dto.GerritEventKeys * sonyericsson.GerritEventKeys} to provide additional missing keys. * - * @author jhansche + * @author Joe Hansche */ public interface GerritEventKeys { public static final String APPROVALS = "approvals"; diff --git a/src/main/java/com/meetme/plugins/jira/gerrit/tabpanel/GerritReviewIssueAction.java b/src/main/java/com/meetme/plugins/jira/gerrit/tabpanel/GerritReviewIssueAction.java index b371f82..4c80ad4 100644 --- a/src/main/java/com/meetme/plugins/jira/gerrit/tabpanel/GerritReviewIssueAction.java +++ b/src/main/java/com/meetme/plugins/jira/gerrit/tabpanel/GerritReviewIssueAction.java @@ -1,11 +1,11 @@ /* * Copyright 2012 MeetMe, Inc. - * + * * 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 @@ -13,12 +13,6 @@ */ package com.meetme.plugins.jira.gerrit.tabpanel; -import java.util.Collections; -import java.util.Date; -import java.util.List; -import java.util.Map; -import java.util.NoSuchElementException; - import com.atlassian.core.util.map.EasyMap; import com.atlassian.jira.plugin.issuetabpanel.AbstractIssueAction; import com.atlassian.jira.plugin.issuetabpanel.IssueAction; @@ -27,6 +21,12 @@ import com.meetme.plugins.jira.gerrit.data.dto.GerritApproval; import com.meetme.plugins.jira.gerrit.data.dto.GerritChange; +import java.util.Collections; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; + public class GerritReviewIssueAction extends AbstractIssueAction implements IssueAction { private String baseUrl; private GerritChange change; @@ -69,9 +69,9 @@ public boolean isDisplayActionAllTab() { /** * Returns the lowest score below 0 if available; otherwise the highest score above 0. - * - * @param approvals - * @return + * + * @param approvals the approvals found on the Gerrit review + * @return the approval that is deemed the "most significant" * @deprecated This functionality can now be found in the velocity template */ @Deprecated diff --git a/src/main/java/com/meetme/plugins/jira/gerrit/tabpanel/GerritReviewsTabPanel.java b/src/main/java/com/meetme/plugins/jira/gerrit/tabpanel/GerritReviewsTabPanel.java index 5fb0e02..0528d7c 100644 --- a/src/main/java/com/meetme/plugins/jira/gerrit/tabpanel/GerritReviewsTabPanel.java +++ b/src/main/java/com/meetme/plugins/jira/gerrit/tabpanel/GerritReviewsTabPanel.java @@ -1,11 +1,11 @@ /* * Copyright 2012 MeetMe, Inc. - * + * * 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 @@ -13,12 +13,6 @@ */ package com.meetme.plugins.jira.gerrit.tabpanel; -import java.util.ArrayList; -import java.util.List; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import com.atlassian.crowd.embedded.api.User; import com.atlassian.jira.issue.Issue; import com.atlassian.jira.issue.tabpanels.GenericMessageAction; @@ -41,11 +35,17 @@ import com.meetme.plugins.jira.gerrit.data.dto.GerritPatchSet; import com.sonyericsson.hudson.plugins.gerrit.gerritevents.GerritQueryException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.ArrayList; +import java.util.List; + /** * An {@link IssueTabPanel2 issue tab panel} for displaying all Gerrit code reviews related to this * issue. - * - * @author Joe Hansche + * + * @author Joe Hansche */ public class GerritReviewsTabPanel extends AbstractIssueTabPanel2 implements IssueTabPanel2 { private static final Logger log = LoggerFactory.getLogger(GerritReviewsTabPanel.class); @@ -100,9 +100,9 @@ public ShowPanelReply showPanel(ShowPanelRequest arg0) { /** * Get all {@link GerritReviewIssueAction}s related to the specified {@link Issue#getKey() issue * key}. - * - * @param issueKey - * @return + * + * @param issueKey the JIRA issue key + * @return the set of {@link IssueAction}s for the issue */ private List getActions(String issueKey) { log.debug("Getting actions for issue: {0}", issueKey); diff --git a/src/main/java/com/meetme/plugins/jira/gerrit/tabpanel/SubtaskReviewsIssueAction.java b/src/main/java/com/meetme/plugins/jira/gerrit/tabpanel/SubtaskReviewsIssueAction.java index 06fe86f..05e2ee6 100644 --- a/src/main/java/com/meetme/plugins/jira/gerrit/tabpanel/SubtaskReviewsIssueAction.java +++ b/src/main/java/com/meetme/plugins/jira/gerrit/tabpanel/SubtaskReviewsIssueAction.java @@ -1,11 +1,11 @@ /* * Copyright 2012 MeetMe, Inc. - * + * * 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 @@ -13,10 +13,6 @@ */ package com.meetme.plugins.jira.gerrit.tabpanel; -import java.util.Date; -import java.util.List; -import java.util.Map; - import com.atlassian.jira.issue.Issue; import com.atlassian.jira.plugin.issuetabpanel.AbstractIssueAction; import com.atlassian.jira.plugin.issuetabpanel.IssueAction; @@ -24,17 +20,18 @@ import com.meetme.plugins.jira.gerrit.data.dto.GerritChange; import com.meetme.plugins.jira.gerrit.workflow.condition.NoOpenReviews; +import java.util.Date; +import java.util.List; +import java.util.Map; + /** - * @author jhansche + * @author Joe Hansche */ public class SubtaskReviewsIssueAction extends AbstractIssueAction implements IssueAction { private Issue subtask; private List changes; - /** - * @param descriptor - */ public SubtaskReviewsIssueAction(IssueTabPanelModuleDescriptor descriptor, Issue subtask, List changes) { super(descriptor); diff --git a/src/main/java/com/meetme/plugins/jira/gerrit/workflow/condition/ApprovalScore.java b/src/main/java/com/meetme/plugins/jira/gerrit/workflow/condition/ApprovalScore.java index fd807bc..06bd3ea 100644 --- a/src/main/java/com/meetme/plugins/jira/gerrit/workflow/condition/ApprovalScore.java +++ b/src/main/java/com/meetme/plugins/jira/gerrit/workflow/condition/ApprovalScore.java @@ -1,11 +1,11 @@ /* * Copyright 2012 MeetMe, Inc. - * + * * 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 @@ -13,12 +13,6 @@ */ package com.meetme.plugins.jira.gerrit.workflow.condition; -import java.util.List; -import java.util.Map; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import com.atlassian.jira.issue.Issue; import com.atlassian.jira.workflow.condition.AbstractJiraCondition; import com.meetme.plugins.jira.gerrit.data.IssueReviewsManager; @@ -28,14 +22,20 @@ import com.opensymphony.workflow.WorkflowException; import com.sonyericsson.hudson.plugins.gerrit.gerritevents.GerritQueryException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.List; +import java.util.Map; + /** * A workflow condition that requires (or rejects) a certain Gerrit approval score. - * - * An example use case might be to require, for example, "MUST have a Code-Review score >= 2", or - * "Must NOT have a Code-Review score < 0" (these could even be combined into a single transition to + * + * An example use case might be to require, for example, "{@literal MUST have a Code-Review score >= 2}", or + * "{@literal Must NOT have a Code-Review score < 0}" (these could even be combined into a single transition to * require both conditions be met). - * - * @author Joe Hansche + * + * @author Joe Hansche */ public class ApprovalScore extends AbstractJiraCondition { private static final Logger log = LoggerFactory.getLogger(ApprovalScore.class); @@ -118,11 +118,11 @@ private String describe(boolean isReverse, String label, ComparisonOperator op, /** * Compare two scores using the provided {@link ComparisonOperator} - * - * @param oper - * @param score - * @param target - * @return + * + * @param oper the comparison operator + * @param score the score that is being compared + * @param target the target score against which {@code score} is being compared + * @return the result of the comparison */ private boolean compareScore(ComparisonOperator oper, int score, int target) { log.debug("Comparing score: " + score + oper + target); @@ -145,8 +145,8 @@ private boolean compareScore(ComparisonOperator oper, int score, int target) { /** * Text-based selection of comparison operators. - * - * @author Joe Hansche + * + * @author Joe Hansche */ public static enum ComparisonOperator { LESS_THAN("<"), LESS_OR_EQUAL("<="), EQUAL_TO("=="), GREATER_OR_EQUAL(">="), GREATER_THAN(">"); diff --git a/src/main/java/com/meetme/plugins/jira/gerrit/workflow/condition/NoOpenReviews.java b/src/main/java/com/meetme/plugins/jira/gerrit/workflow/condition/NoOpenReviews.java index 55e8dc8..c4a2541 100644 --- a/src/main/java/com/meetme/plugins/jira/gerrit/workflow/condition/NoOpenReviews.java +++ b/src/main/java/com/meetme/plugins/jira/gerrit/workflow/condition/NoOpenReviews.java @@ -1,11 +1,11 @@ /* * Copyright 2012 MeetMe, Inc. - * + * * 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 @@ -13,9 +13,6 @@ */ package com.meetme.plugins.jira.gerrit.workflow.condition; -import java.util.List; -import java.util.Map; - import com.atlassian.jira.issue.Issue; import com.atlassian.jira.workflow.condition.AbstractJiraCondition; import com.meetme.plugins.jira.gerrit.data.IssueReviewsManager; @@ -24,11 +21,14 @@ import com.opensymphony.workflow.WorkflowException; import com.sonyericsson.hudson.plugins.gerrit.gerritevents.GerritQueryException; +import java.util.List; +import java.util.Map; + /** * Workflow condition that can be used to enforce that an issue "MUST", or "MUST NOT" have any open * Gerrit reviews. - * - * @author Joe Hansche + * + * @author Joe Hansche */ public class NoOpenReviews extends AbstractJiraCondition { public static final String KEY_REVERSED = "reversed"; @@ -64,10 +64,12 @@ public boolean passesCondition(@SuppressWarnings("rawtypes") Map transientVars, /** * Counts the number of reviews that are open or closed. - * - * @param reviews - * @param isOpen - * @return + * + * @param reviews a set of Gerrit changes + * @param isOpen {@code true} to count all open reviews, {@code false} to + * count all non-open reviews. + * @return the number of changes within {@code reviews} that match the + * {@code isOpen} flag. */ public static int countReviewStatus(List reviews, boolean isOpen) { int count = 0; diff --git a/src/main/java/com/meetme/plugins/jira/gerrit/workflow/function/ApprovalFunction.java b/src/main/java/com/meetme/plugins/jira/gerrit/workflow/function/ApprovalFunction.java index a1fc9ed..eec2ffc 100644 --- a/src/main/java/com/meetme/plugins/jira/gerrit/workflow/function/ApprovalFunction.java +++ b/src/main/java/com/meetme/plugins/jira/gerrit/workflow/function/ApprovalFunction.java @@ -13,13 +13,6 @@ */ package com.meetme.plugins.jira.gerrit.workflow.function; -import java.io.IOException; -import java.util.List; -import java.util.Map; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import com.atlassian.core.user.preferences.Preferences; import com.atlassian.crowd.embedded.api.User; import com.atlassian.jira.user.preferences.UserPreferencesManager; @@ -32,15 +25,19 @@ import com.opensymphony.workflow.WorkflowException; import com.sonyericsson.hudson.plugins.gerrit.gerritevents.GerritQueryException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.util.List; +import java.util.Map; + /** - *

* A Workflow Function that can be used to perform Gerrit approvals as the result of a workflow * transition. The input argument is simply a command line argument string (such as "--verified +1", * or "--submit", etc). The argument will be appended to the gerrit review [ChangeId] ... * command line. - *

* - *

* This function can be used in combination with {@link ApprovalScore} workflow conditions, such * that, e.g., a "Merge Change" workflow transition can be used to automatically "submit" a Gerrit * review, iff all of the following conditions are met: @@ -49,21 +46,16 @@ *

  • MUST have a Verified score >= 1
  • *
  • Must NOT have a Code-Review score < 0
  • * - *

    * - *

    * This ensures that the workflow transition is only available if the "submit" step will be * successful. - *

    * - *

    * Another common use for this function would be to automatically provide a "Verified +1" score, via * another workflow step, e.g., "Ready for Merge". In that way, a "Ready for Merge" transition may * then automatically enable the "Merge Change" transition, as a result of giving the Verified +1 * score. - *

    * - * @author jhansche + * @author Joe Hansche */ public class ApprovalFunction extends AbstractJiraFunctionProvider { private static final Logger log = LoggerFactory.getLogger(ApprovalFunction.class); diff --git a/src/test/java/com/meetme/plugins/jira/gerrit/tabpanel/SubtaskReviewsIssueActionTest.java b/src/test/java/com/meetme/plugins/jira/gerrit/tabpanel/SubtaskReviewsIssueActionTest.java index 1ac7062..ef5a105 100644 --- a/src/test/java/com/meetme/plugins/jira/gerrit/tabpanel/SubtaskReviewsIssueActionTest.java +++ b/src/test/java/com/meetme/plugins/jira/gerrit/tabpanel/SubtaskReviewsIssueActionTest.java @@ -39,7 +39,7 @@ import com.meetme.plugins.jira.gerrit.data.dto.GerritChange; /** - * @author jhansche + * @author Joe Hansche */ public class SubtaskReviewsIssueActionTest { diff --git a/src/test/java/com/meetme/plugins/jira/gerrit/tabpanel/SubtaskReviewsTabPanelTest.java b/src/test/java/com/meetme/plugins/jira/gerrit/tabpanel/SubtaskReviewsTabPanelTest.java index 697f3fc..85b1ff2 100644 --- a/src/test/java/com/meetme/plugins/jira/gerrit/tabpanel/SubtaskReviewsTabPanelTest.java +++ b/src/test/java/com/meetme/plugins/jira/gerrit/tabpanel/SubtaskReviewsTabPanelTest.java @@ -37,7 +37,7 @@ import com.sonyericsson.hudson.plugins.gerrit.gerritevents.GerritQueryException; /** - * @author jhansche + * @author Joe Hansche */ public class SubtaskReviewsTabPanelTest { diff --git a/src/test/java/com/meetme/plugins/jira/gerrit/workflow/function/ApprovalFunctionTest.java b/src/test/java/com/meetme/plugins/jira/gerrit/workflow/function/ApprovalFunctionTest.java index eda44e8..59dfbeb 100644 --- a/src/test/java/com/meetme/plugins/jira/gerrit/workflow/function/ApprovalFunctionTest.java +++ b/src/test/java/com/meetme/plugins/jira/gerrit/workflow/function/ApprovalFunctionTest.java @@ -37,7 +37,7 @@ import com.sonyericsson.hudson.plugins.gerrit.gerritevents.GerritQueryException; /** - * @author jhansche + * @author Joe Hansche */ public abstract class ApprovalFunctionTest extends AbstractWorkflowTest { @Mock