Mercurial > public > JIRA
comparison ssdt-jira-plugins-v2/plugins/src/main/java/org/nwoca/ssdt/jira/RequireTimeSpentValidator.java @ 2:4ca1ef5be75e
Added validators for Time tracking. New validator to require Time
Spent.
author | smith |
---|---|
date | Fri, 23 May 2008 18:06:10 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1:56349dc044f5 | 2:4ca1ef5be75e |
---|---|
1 /* | |
2 * RequireDocumentIssueValidator.java | |
3 * | |
4 * Created on May 14, 2007, 1:04 PM | |
5 * | |
6 * To change this template, choose Tools | Template Manager | |
7 * and open the template in the editor. | |
8 */ | |
9 package org.nwoca.ssdt.jira; | |
10 | |
11 import com.atlassian.jira.issue.Issue; | |
12 import com.atlassian.jira.issue.IssueUtils; | |
13 import com.opensymphony.module.propertyset.PropertySet; | |
14 import com.opensymphony.workflow.InvalidInputException; | |
15 import com.opensymphony.workflow.Validator; | |
16 import com.opensymphony.workflow.WorkflowException; | |
17 import java.util.Map; | |
18 | |
19 /** | |
20 * Requires zero time remaining if the issue has Time Tracking. Can use | |
21 * during resolve step. | |
22 * | |
23 * @author SMITH | |
24 */ | |
25 public class RequireTimeSpentValidator implements Validator { | |
26 | |
27 /** | |
28 * Creates a new instance of RequireDocumentIssueValidator. | |
29 */ | |
30 public RequireTimeSpentValidator() { | |
31 } | |
32 | |
33 public void validate(Map transientVars, Map args, PropertySet ps) | |
34 throws InvalidInputException, WorkflowException { | |
35 | |
36 Issue issue = (Issue) transientVars.get("issue"); | |
37 | |
38 if (IssueUtils.hasTimeTracking(issue) && (issue.getTimeSpent() == null || issue.getTimeSpent().longValue() == 0)) { | |
39 throw new InvalidInputException("There is has been no Time Spent on this issue. Please update work log."); | |
40 } | |
41 | |
42 } | |
43 } |