Custom Web-Item conditions?

This page:
https://developer.atlassian.com/server/fisheye-crucible/web-item-conditions/
talks about web-item conditions you can use.

But can you create your own custom conditions?

Those condition classes extend com.atlassian.jira.plugin.webfragment.conditions.AbstractIssueWebCondition but it seems the class is not accessible by default in a plugin project.

Hi @KCWong

yes, you can create your own custom conditions, for example:

public class ExampleCondition extends AbstractWebCondition {

    public ExampleCondition()  { }

    @Override
    public boolean shouldDisplay(ApplicationUser applicationUser, JiraHelper jiraHelper)
    {
        return true;
    }
}

Cheers
Adam

I need to add this dependency to see the Condition class:

<!-- Plugin web fragment API, for the com.atlassian.plugin.web.Condition class -->
		<dependency>
			<groupId>com.atlassian.plugins</groupId>
			<artifactId>atlassian-plugins-webfragment-api</artifactId>
			<version>5.3.2</version>
			<scope>provided</scope>
		</dependency>

And the issue object is stored in jiraHelper.getContextParams(), under the key “issue”.

Yes

Issue issue = null;

if(jiraHelper.getContextParams().get("issue") != null){
    issue = (Issue) jiraHelper.getContextParams().get("issue");
}

Cheers
Adam