PageRenderTime 19ms CodeModel.GetById 14ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/plugin-module-codegen-engine/src/main/resources/templates/jira/workflow/validator/WorkflowValidator.java.vtl

https://bitbucket.org/mmeinhold/amps
Unknown | 26 lines | 21 code | 5 blank | 0 comment | 0 complexity | 1315674725a5d8793725ec1ca810119e MD5 | raw file
 1package ${PACKAGE};
 2
 3import org.slf4j.Logger;
 4import org.slf4j.LoggerFactory;
 5import com.atlassian.jira.issue.Issue;
 6import com.opensymphony.module.propertyset.PropertySet;
 7import com.opensymphony.workflow.Validator;
 8import com.opensymphony.workflow.InvalidInputException;
 9import java.util.Map;
10
11public class ${CLASSNAME} implements Validator
12{
13    private static final Logger log = LoggerFactory.getLogger(${CLASSNAME}.class);
14    public static final String FIELD_WORD="word";
15
16    public void validate(Map transientVars, Map args, PropertySet ps) throws InvalidInputException
17    {
18        String word = (String) transientVars.get(FIELD_WORD);
19
20        Issue issue = (Issue) transientVars.get("issue");
21
22        if(null == issue.getDescription() || "".equals(issue.getDescription()) || !issue.getDescription().contains(word)) {
23            throw new InvalidInputException("Issue must contain the word '" + word + "' in the description");
24        }
25    }
26}