Class UUIDTagger

  • All Implemented Interfaces:
    IXMLConfigurable, IImporterHandler, IDocumentTagger

    public class UUIDTagger
    extends AbstractDocumentTagger

    Generates a random Universally unique identifier (UUID) and stores it in the specified field. If no field is provided, the UUID will be added to document.uuid.

    Storing values in an existing field

    If a target field with the same name already exists for a document, values will be added to the end of the existing value list. It is possible to change this default behavior by supplying a PropertySetter.

    Can be used both as a pre-parse or post-parse handler.

    XML configuration usage:

    
    <handler
        class="com.norconex.importer.handler.tagger.impl.UUIDTagger"
        toField="(target field)">
      <!-- multiple "restrictTo" tags allowed (only one needs to match) -->
      <restrictTo>
        <fieldMatcher>(field-matching expression)</fieldMatcher>
        <valueMatcher>(value-matching expression)</valueMatcher>
      </restrictTo>
    </handler>

    XML usage example:

    
    <handler
        class="UUIDTagger"
        field="uuid"
        onSet="replace"/>

    The above generates a UUID and stores it in a "uuid" field, overwriting any existing values under that field.

    Since:
    2.7.0
    Author:
    Pascal Essiembre