annotate ssdt-jira-plugins-v2/plugins/src/main/java/org/nwoca/ssdt/jira/IsTestingUserCondition.java @ 0:92d945347fc0

V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created for JIRA 3.12.
author smith
date Tue, 20 May 2008 17:11:35 -0400
parents
children
rev   line source
0
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
1 /*
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
2 * IsTestingUserCondition.java
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
3 *
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
4 * Created on May 11, 2007, 5:07 PM
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
5 *
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
6 * To change this template, choose Tools | Template Manager
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
7 * and open the template in the editor.
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
8 */
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
9
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
10 package org.nwoca.ssdt.jira;
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
11
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
12 import com.atlassian.jira.ManagerFactory;
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
13 import com.atlassian.jira.issue.Issue;
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
14 import com.atlassian.jira.issue.fields.CustomField;
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
15 import com.atlassian.jira.workflow.condition.AbstractJiraCondition;
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
16 import java.util.Map;
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
17 import com.opensymphony.module.propertyset.PropertySet;
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
18 import com.opensymphony.user.User;
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
19
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
20 /**
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
21 * Our first plugin to simply see if the current user is the "Testing Assignee".
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
22 * The plugin is not very clever (e.g. name of custom field is hard-coded) but
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
23 * suffices for now.
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
24 *
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
25 * @author SMITH
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
26 */
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
27 public class IsTestingUserCondition extends AbstractJiraCondition {
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
28
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
29 /** Creates a new instance of IsTestingUserCondition. */
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
30 public IsTestingUserCondition() {
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
31 }
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
32
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
33 public boolean passesCondition(Map transientVars, Map args, PropertySet ps) {
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
34
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
35 Issue issue = (Issue) transientVars.get("issue");
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
36
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
37 CustomField testerField = ManagerFactory.getCustomFieldManager()
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
38 .getCustomFieldObjectByName("QA Assignee");
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
39
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
40 if (testerField == null) {
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
41 return false;
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
42 }
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
43
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
44 User tester = (User)issue.getCustomFieldValue(testerField);
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
45
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
46 if (tester == null) {
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
47 return false;
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
48 }
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
49
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
50 User caller = getCaller(transientVars,args);
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
51
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
52 return caller.getName().equals(tester.getName());
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
53
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
54 }
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
55
92d945347fc0 V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
smith
parents:
diff changeset
56 }