Search in sources :

Example 1 with ObjectCannotBeTaggedException

use of com.axway.ats.action.objects.model.ObjectCannotBeTaggedException in project ats-framework by Axway.

the class MimePackage method tag.

/**
     * Tagging the message by adding "Automation-Message-Tag" header with the current time value(in milliseconds).
     * This is useful if want to recognize this message between others in the same IMAP folder.
     *      *
     * @throws ActionException
     */
@PublicAtsApi
public void tag() throws ActionException {
    // we use the message's sent time as a unique tag
    String tagValue = Long.toString(Calendar.getInstance().getTimeInMillis());
    try {
        setHeader("Automation-Message-Tag", tagValue);
        // if everything is OK, then this is our tag
        tag = tagValue;
        log.info(getDescription() + " tagged with tag '" + tag + "'");
    } catch (PackageException e) {
        throw new ObjectCannotBeTaggedException(getDescription(), null, e);
    }
}
Also used : NoSuchMimePackageException(com.axway.ats.action.objects.model.NoSuchMimePackageException) PackageException(com.axway.ats.action.objects.model.PackageException) ObjectCannotBeTaggedException(com.axway.ats.action.objects.model.ObjectCannotBeTaggedException) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Aggregations

NoSuchMimePackageException (com.axway.ats.action.objects.model.NoSuchMimePackageException)1 ObjectCannotBeTaggedException (com.axway.ats.action.objects.model.ObjectCannotBeTaggedException)1 PackageException (com.axway.ats.action.objects.model.PackageException)1 PublicAtsApi (com.axway.ats.common.PublicAtsApi)1