Mercurial > public > JIRA
view 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 |
line wrap: on
line source
/* * IsTestingUserCondition.java * * Created on May 11, 2007, 5:07 PM * * To change this template, choose Tools | Template Manager * and open the template in the editor. */ package org.nwoca.ssdt.jira; import com.atlassian.jira.ManagerFactory; import com.atlassian.jira.issue.Issue; import com.atlassian.jira.issue.fields.CustomField; import com.atlassian.jira.workflow.condition.AbstractJiraCondition; import java.util.Map; import com.opensymphony.module.propertyset.PropertySet; import com.opensymphony.user.User; /** * Our first plugin to simply see if the current user is the "Testing Assignee". * The plugin is not very clever (e.g. name of custom field is hard-coded) but * suffices for now. * * @author SMITH */ public class IsTestingUserCondition extends AbstractJiraCondition { /** Creates a new instance of IsTestingUserCondition. */ public IsTestingUserCondition() { } public boolean passesCondition(Map transientVars, Map args, PropertySet ps) { Issue issue = (Issue) transientVars.get("issue"); CustomField testerField = ManagerFactory.getCustomFieldManager() .getCustomFieldObjectByName("QA Assignee"); if (testerField == null) { return false; } User tester = (User)issue.getCustomFieldValue(testerField); if (tester == null) { return false; } User caller = getCaller(transientVars,args); return caller.getName().equals(tester.getName()); } }