public abstract class AbstractMetacardActionProvider extends Object implements ActionProvider
ActionProvider
s that can handle Metacard
source objects.Modifier | Constructor and Description |
---|---|
protected |
AbstractMetacardActionProvider(String actionProviderId,
String title,
String description)
Constructor that accepts the values to be used when a new
Action is created by this
ActionProvider . |
Modifier and Type | Method and Description |
---|---|
<T> boolean |
canHandle(T subject)
Default implementation that ensures the
subject provided is a Metacard before
delegating to canHandleMetacard(Metacard) . |
protected boolean |
canHandleMetacard(Metacard metacard)
Determines if this
ActionProvider can handle this Metacard . |
protected abstract Action |
createMetacardAction(String actionProviderId,
String title,
String description,
URL url)
Factory method that creates the proper
Action object from the information provided. |
<T> Action |
getAction(T subject)
Default implementation that ensures the
subject provided is a Metacard with a
valid ID before delegating to getMetacardAction(String, Metacard) . |
String |
getId() |
protected Action |
getMetacardAction(String metacardSource,
Metacard metacard)
|
protected abstract URL |
getMetacardActionUrl(String metacardSource,
Metacard metacard)
|
String |
toString() |
protected AbstractMetacardActionProvider(String actionProviderId, String title, String description)
Action
is created by this
ActionProvider
.actionProviderId
- ID that will be assigned to the Action
that will be created.
Cannot be empty or blank.title
- title that will be used when this ActionProvider
creates a new Action
description
- description that will be used when this ActionProvider
creates a new
Action
public <T> Action getAction(T subject)
subject
provided is a Metacard
with a
valid ID before delegating to getMetacardAction(String, Metacard)
.
getAction
in interface ActionProvider
subject
- object for which the ActionProvider
is requested to provide an Action
Action
object. If no action can be taken on the input, then null
shall be returnedpublic String getId()
getId
in interface ActionProvider
ActionProvider
providespublic <T> boolean canHandle(T subject)
subject
provided is a Metacard
before
delegating to canHandleMetacard(Metacard)
.
protected boolean canHandleMetacard(Metacard metacard)
ActionProvider
can handle this Metacard
. Returns true
by default. Should be overwritten if more complex verification is needed.metacard
- metacard to which this ActionProvider
could applytrue
if this ActionProvider
applies to the Metacard
protected Action getMetacardAction(String metacardSource, Metacard metacard) throws Exception
Action
given a Metacard
. This method delegates to getMetacardActionUrl(String, Metacard)
and createMetacardAction(String, String,
String, URL)
.protected abstract Action createMetacardAction(String actionProviderId, String title, String description, URL url)
Action
object from the information provided.
Must be implemented by sub-classes.This work is licensed under a Creative Commons Attribution 4.0 International License.