@ComponentProfile(summary="Perform a branch based on whether a metadata value has already been processed", tag="service,duplicate") public class CheckMetadataValueService extends DuplicateMetadataValueService
Branching Service
implementation which checks the value stored against a configured metadata key against a list of
previously received values. If the value to check is null or empty, a ServiceException
is thrown. If the value has
previously been received, the configured nextServiceIdIfDuplicate
is set on the message. If the value is not
contained in the store of previous values, nextServiceIdIfUnique
is set.
In the adapter configuration file this class is aliased as check-metadata-value-service which is the preferred alternative to the fully qualified classname when building your configuration.
previousValuesStore, store
log
CONFIRMATION_ID_KEY
Constructor and Description |
---|
CheckMetadataValueService()
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
doService(AdaptrisMessage msg)
Apply the service to the message.
|
java.lang.String |
getNextServiceIdIfDuplicate()
Returns the ID of the next
Service to apply if the metadata
exists if the store of previous values. |
java.lang.String |
getNextServiceIdIfUnique()
Returns the ID of the next
Service to apply if the metadata
does not exist if the store of previous values. |
protected void |
initService() |
boolean |
isBranching()
This is a branching service, even though its parent(s) aren't.
|
void |
setNextServiceIdIfDuplicate(java.lang.String s)
Sets the ID of the next
Service to apply if the metadata
exists if the store of previous values. |
void |
setNextServiceIdIfUnique(java.lang.String s)
Sets the ID of the next
Service to apply if the metadata
does not exist if the store of previous values. |
closeService, getMetadataKey, getStoreFileUrl, loadPreviouslyReceivedValues, prepare, setMetadataKey, setStoreFileUrl
changeState, close, continueOnFailure, createName, createQualifier, getContinueOnFail, getIsTrackingEndpoint, getLookupName, getUniqueId, init, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, setLookupName, setUniqueId, start, stop
public CheckMetadataValueService()
Creates a new instance.
protected void initService() throws CoreException
initService
in class DuplicateMetadataValueService
CoreException
public void doService(AdaptrisMessage msg) throws ServiceException
Service
Apply the service to the message.
msg
- the AdaptrisMessage
to processServiceException
- wrapping any underlying Exception
s#doService(com.adaptris.core.AdaptrisMessage)
public boolean isBranching()
This is a branching service, even though its parent(s) aren't.
isBranching
in interface Service
isBranching
in class ServiceImp
ServiceImp.isBranching()
public java.lang.String getNextServiceIdIfDuplicate()
Returns the ID of the next Service
to apply if the metadata
exists if the store of previous values.
Service
to apply if the metadata
exists if the store of previous valuespublic void setNextServiceIdIfDuplicate(java.lang.String s)
Sets the ID of the next Service
to apply if the metadata
exists if the store of previous values. May not be null or empty.
s
- the ID of the next Service
to apply if the metadata
exists if the store of previous valuespublic java.lang.String getNextServiceIdIfUnique()
Returns the ID of the next Service
to apply if the metadata
does not exist if the store of previous values.
Service
to apply if the metadata
does not exist if the store of previous valuespublic void setNextServiceIdIfUnique(java.lang.String s)
Sets the ID of the next Service
to apply if the metadata
does not exist if the store of previous values. May not be null or empty.
s
- the ID of the next Service
to apply if the metadata
does not exist if the store of previous values