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