Class GenerateUniqueMetadataValueService

  • All Implemented Interfaces:
    AdaptrisComponent, ComponentLifecycle, ComponentLifecycleExtension, MessageEventGenerator, Service, StateManagedComponent

    @ComponentProfile(summary="Generate a unique value and attach it as metadata",
                      tag="service,metadata")
    public class GenerateUniqueMetadataValueService
    extends MetadataServiceImpl
    Service implementation that generates a unique item of metadata.

    Uses the configured IdGenerator instance to generate a unique value that is subsequently assigned to metadata. Note that this is not designed to replace the unique-id that is associated with an AdaptrisMessage, but is intended to be an additional way for you to generate unique ids that can be associated with a message.

    In the adapter configuration file this class is aliased as generate-unique-metadata-value-service which is the preferred alternative to the fully qualified classname when building your configuration.

    • Constructor Detail

      • GenerateUniqueMetadataValueService

        public GenerateUniqueMetadataValueService()
      • GenerateUniqueMetadataValueService

        public GenerateUniqueMetadataValueService​(java.lang.String metadataKey)
      • GenerateUniqueMetadataValueService

        public GenerateUniqueMetadataValueService​(java.lang.String metadataKey,
                                                  IdGenerator generator)
    • Method Detail

      • doService

        public void doService​(AdaptrisMessage msg)
                       throws ServiceException
        Description copied from interface: Service

        Apply the service to the message.

        Parameters:
        msg - the AdaptrisMessage to process
        Throws:
        ServiceException - wrapping any underlying Exceptions
      • getMetadataKey

        public java.lang.String getMetadataKey()

        Returns the metadata key whose value should be checked.

        Returns:
        metadataKey the metadata key whose value should be checked
      • setMetadataKey

        public void setMetadataKey​(java.lang.String s)
        Sets the metadata key whose which will store the new value.
        Parameters:
        s - the metadata key; if set to null, then a unique-key will be generated using the configured setGenerator(IdGenerator).
      • setGenerator

        public void setGenerator​(IdGenerator idg)
        Set the generator to be used.
        Parameters:
        idg - the generator; default is GuidGenerator