com.atlassian.fisheye.plugin.web.conditions
Class AbstractFisheyeCondition

java.lang.Object
  extended by com.atlassian.fisheye.plugin.web.conditions.AbstractFisheyeCondition
All Implemented Interfaces:
com.atlassian.plugin.web.Condition

public abstract class AbstractFisheyeCondition
extends java.lang.Object
implements com.atlassian.plugin.web.Condition

Base class for FishEye and Crucible conditions. Plugins extend this class to create their own conditions. Instances of conditions are created as the decision to display a web-item is taken, and are then discarded.


Constructor Summary
AbstractFisheyeCondition()
           
 
Method Summary
protected  java.util.Map<java.lang.String,java.lang.String> getParams()
          Get a Map of the parameters provided to the condition.
protected  java.lang.String getRequiredParam(java.lang.String name)
          Get a named parameter, throwing an exception if it is not set.
 void init(java.util.Map<java.lang.String,java.lang.String> params)
           
protected abstract  boolean shouldDisplay(Helper context)
          Subclasses must implement this method and return a boolean indicating whether to display the item.
 boolean shouldDisplay(java.util.Map context)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractFisheyeCondition

public AbstractFisheyeCondition()
Method Detail

init

public final void init(java.util.Map<java.lang.String,java.lang.String> params)
                throws com.atlassian.plugin.PluginParseException
Specified by:
init in interface com.atlassian.plugin.web.Condition
Throws:
com.atlassian.plugin.PluginParseException

shouldDisplay

public final boolean shouldDisplay(java.util.Map context)
Specified by:
shouldDisplay in interface com.atlassian.plugin.web.Condition

getParams

protected final java.util.Map<java.lang.String,java.lang.String> getParams()
Get a Map of the parameters provided to the condition.

Returns:
a Map containing the parameters

getRequiredParam

@NotNull
protected final java.lang.String getRequiredParam(java.lang.String name)
Get a named parameter, throwing an exception if it is not set.

Parameters:
name - a String naming the parameter
Returns:
the value of the parameter

shouldDisplay

protected abstract boolean shouldDisplay(Helper context)
Subclasses must implement this method and return a boolean indicating whether to display the item. The decision should be based on the context the web-item is being shown in, and the parameters the Condition has been configured with.

Parameters:
context - a Helper containing the context in which the web-item would be shown
Returns:
true if the web-item should be displayed, false if it should not be displayed