com.unboundid.ldap.sdk.unboundidds.tasks.Task Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of unboundid-ldapsdk Show documentation
Show all versions of unboundid-ldapsdk Show documentation
The UnboundID LDAP SDK for Java is a fast, comprehensive, and easy-to-use
Java API for communicating with LDAP directory servers and performing
related tasks like reading and writing LDIF, encoding and decoding data
using base64 and ASN.1 BER, and performing secure communication. This
package contains the Standard Edition of the LDAP SDK, which is a
complete, general-purpose library for communicating with LDAPv3 directory
servers.
/*
* Copyright 2008-2022 Ping Identity Corporation
* All Rights Reserved.
*/
/*
* Copyright 2008-2022 Ping Identity Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Copyright (C) 2008-2022 Ping Identity Corporation
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (GPLv2 only)
* or the terms of the GNU Lesser General Public License (LGPLv2.1 only)
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see .
*/
package com.unboundid.ldap.sdk.unboundidds.tasks;
import java.io.Serializable;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import com.unboundid.ldap.sdk.Attribute;
import com.unboundid.ldap.sdk.Entry;
import com.unboundid.util.CryptoHelper;
import com.unboundid.util.Debug;
import com.unboundid.util.NotExtensible;
import com.unboundid.util.NotNull;
import com.unboundid.util.Nullable;
import com.unboundid.util.StaticUtils;
import com.unboundid.util.ThreadSafety;
import com.unboundid.util.ThreadSafetyLevel;
import com.unboundid.util.Validator;
import static com.unboundid.ldap.sdk.unboundidds.tasks.TaskMessages.*;
/**
* This class defines a data structure for holding information about scheduled
* tasks as used by the Ping Identity, UnboundID, or Nokia/Alcatel-Lucent 8661
* Directory Server. Subclasses will be used to provide additional
* functionality when dealing with certain types of tasks.
*
*
* NOTE: This class, and other classes within the
* {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only
* supported for use against Ping Identity, UnboundID, and
* Nokia/Alcatel-Lucent 8661 server products. These classes provide support
* for proprietary functionality or for external specifications that are not
* considered stable or mature enough to be guaranteed to work in an
* interoperable way with other types of LDAP servers.
*
*
* All types of tasks can include the following information:
*
* - Task ID -- Uniquely identifies the task in the server. It may be
* omitted when scheduling a new task in order to have a task ID generated
* for the task.
* - Task Class Name -- The fully-qualified name of the {@code Task}
* subclass that provides the logic for the task. This does not need to
* be provided when creating a new task from one of the task-specific
* subclasses.
* - Task State -- The current state of the task. See the {@link TaskState}
* enum for information about the possible states that a task may
* have.
* - Scheduled Start Time -- The earliest time that the task should be
* eligible to start. It may be omitted when scheduling a new task in
* order to use the current time.
* - Actual Start Time -- The time that server started processing the
* task.
* - Actual Start Time -- The time that server completed processing for the
* task.
* - Dependency IDs -- A list of task IDs for tasks that must complete
* before this task may be considered eligible to start.
* - Failed Dependency Action -- Specifies how the server should treat this
* task if any of the tasks on which it depends failed. See the
* {@link FailedDependencyAction} enum for the failed dependency action
* values that may be used.
* - Notify on Completion -- A list of e-mail addresses for users that
* should be notified when the task completes, regardless of whether it
* was successful.
* - Notify On Error -- A list of e-mail addresses for users that should be
* notified if the task fails.
* - Log Messages -- A list of the messages logged by the task while it was
* running.
*
* Each of these elements can be retrieving using specific methods within this
* class (e.g., the {@link Task#getTaskID} method can be used to retrieve the
* task ID), but task properties (including those specific to the particular
* type to task) may also be accessed using a generic API. For example, the
* {@link Task#getTaskPropertyValues} method retrieves a map that correlates the
* {@link TaskProperty} objects for the task with the values that have been set
* for those properties. See the documentation for the {@link TaskManager}
* class for an example that demonstrates accessing task information using the
* generic API.
*
* Also note that it is possible to create new tasks using information obtained
* from the generic API, but that is done on a per-class basis. For example, in
* order to create a new {@link BackupTask} instance using the generic API, you
* would use the {@link BackupTask#BackupTask(Map)} constructor, in which the
* provided map contains a mapping between the properties and their values for
* that task. The {@link Task#getTaskSpecificProperties} method may be used to
* retrieve a list of the task-specific properties that may be provided when
* scheduling a task, and the {@link Task#getCommonTaskProperties} method may be
* used to retrieve a list of properties that can be provided when scheduling
* any type of task.
*/
@NotExtensible()
@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
public class Task
implements Serializable
{
/**
* The name of the attribute used to hold the actual start time for scheduled
* tasks.
*/
@NotNull private static final String ATTR_ACTUAL_START_TIME =
"ds-task-actual-start-time";
/**
* The name of the attribute used to indicate whether the server should
* generate an administrative alert when the task fails to complete
* successfully.
*/
@NotNull private static final String ATTR_ALERT_ON_ERROR =
"ds-task-alert-on-error";
/**
* The name of the attribute used to indicate whether the server should
* generate an administrative alert when the task starts running.
*/
@NotNull private static final String ATTR_ALERT_ON_START =
"ds-task-alert-on-start";
/**
* The name of the attribute used to indicate whether the server should
* generate an administrative alert when the task completes successfully.
*/
@NotNull private static final String ATTR_ALERT_ON_SUCCESS =
"ds-task-alert-on-success";
/**
* The name of the attribute used to hold the completion time for scheduled
* tasks.
*/
@NotNull private static final String ATTR_COMPLETION_TIME =
"ds-task-completion-time";
/**
* The name of the attribute used to hold the task IDs for tasks on which a
* scheduled task is dependent.
*/
@NotNull private static final String ATTR_DEPENDENCY_ID =
"ds-task-dependency-id";
/**
* The name of the attribute used to indicate what action to take if one of
* the dependencies for a task failed to complete successfully.
*/
@NotNull private static final String ATTR_FAILED_DEPENDENCY_ACTION =
"ds-task-failed-dependency-action";
/**
* The name of the attribute used to hold the log messages for scheduled
* tasks.
*/
@NotNull private static final String ATTR_LOG_MESSAGE = "ds-task-log-message";
/**
* The name of the attribute used to hold the e-mail addresses of the users
* that should be notified whenever a scheduled task completes, regardless of
* success or failure.
*/
@NotNull private static final String ATTR_NOTIFY_ON_COMPLETION =
"ds-task-notify-on-completion";
/**
* The name of the attribute used to hold the e-mail addresses of the users
* that should be notified if a scheduled task fails to complete successfully.
*/
@NotNull private static final String ATTR_NOTIFY_ON_ERROR =
"ds-task-notify-on-error";
/**
* The name of the attribute used to hold the e-mail addresses of the users
* that should be notified when a scheduled task starts running.
*/
@NotNull private static final String ATTR_NOTIFY_ON_START =
"ds-task-notify-on-start";
/**
* The name of the attribute used to hold the e-mail addresses of the users
* that should be notified when a scheduled task completes successfully.
*/
@NotNull private static final String ATTR_NOTIFY_ON_SUCCESS =
"ds-task-notify-on-success";
/**
* The name of the attribute used to hold the scheduled start time for
* scheduled tasks.
*/
@NotNull private static final String ATTR_SCHEDULED_START_TIME =
"ds-task-scheduled-start-time";
/**
* The name of the attribute used to hold the name of the class that provides
* the logic for scheduled tasks.
*/
@NotNull private static final String ATTR_TASK_CLASS = "ds-task-class-name";
/**
* The name of the attribute used to hold the task ID for scheduled tasks.
*/
@NotNull static final String ATTR_TASK_ID = "ds-task-id";
/**
* The name of the attribute used to hold the current state for scheduled
* tasks.
*/
@NotNull static final String ATTR_TASK_STATE = "ds-task-state";
/**
* The name of the base object class for scheduled tasks.
*/
@NotNull static final String OC_TASK = "ds-task";
/**
* The DN of the entry below which scheduled tasks reside.
*/
@NotNull static final String SCHEDULED_TASKS_BASE_DN =
"cn=Scheduled Tasks,cn=tasks";
/**
* The task property that will be used for the task ID.
*/
@NotNull private static final TaskProperty PROPERTY_TASK_ID =
new TaskProperty(ATTR_TASK_ID, INFO_DISPLAY_NAME_TASK_ID.get(),
INFO_DESCRIPTION_TASK_ID.get(), String.class, false,
false, true);
/**
* The task property that will be used for the scheduled start time.
*/
@NotNull private static final TaskProperty PROPERTY_SCHEDULED_START_TIME =
new TaskProperty(ATTR_SCHEDULED_START_TIME,
INFO_DISPLAY_NAME_SCHEDULED_START_TIME.get(),
INFO_DESCRIPTION_SCHEDULED_START_TIME.get(), Date.class,
false, false, true);
/**
* The task property that will be used for the set of dependency IDs.
*/
@NotNull private static final TaskProperty PROPERTY_DEPENDENCY_ID =
new TaskProperty(ATTR_DEPENDENCY_ID,
INFO_DISPLAY_NAME_DEPENDENCY_ID.get(),
INFO_DESCRIPTION_DEPENDENCY_ID.get(), String.class,
false, true, true);
/**
* The task property that will be used for the failed dependency action.
*/
@NotNull private static final TaskProperty PROPERTY_FAILED_DEPENDENCY_ACTION =
new TaskProperty(ATTR_FAILED_DEPENDENCY_ACTION,
INFO_DISPLAY_NAME_FAILED_DEPENDENCY_ACTION.get(),
INFO_DESCRIPTION_FAILED_DEPENDENCY_ACTION.get(),
String.class, false, false, true,
new String[]
{
FailedDependencyAction.CANCEL.getName(),
FailedDependencyAction.DISABLE.getName(),
FailedDependencyAction.PROCESS.getName()
});
/**
* The task property that will be used for the notify on completion addresses.
*/
@NotNull private static final TaskProperty PROPERTY_NOTIFY_ON_COMPLETION =
new TaskProperty(ATTR_NOTIFY_ON_COMPLETION,
INFO_DISPLAY_NAME_NOTIFY_ON_COMPLETION.get(),
INFO_DESCRIPTION_NOTIFY_ON_COMPLETION.get(),
String.class, false, true, true);
/**
* The task property that will be used for the notify on error addresses.
*/
@NotNull private static final TaskProperty PROPERTY_NOTIFY_ON_ERROR =
new TaskProperty(ATTR_NOTIFY_ON_ERROR,
INFO_DISPLAY_NAME_NOTIFY_ON_ERROR.get(),
INFO_DESCRIPTION_NOTIFY_ON_ERROR.get(),
String.class, false, true, true);
/**
* The task property that will be used for the notify on success addresses.
*/
@NotNull private static final TaskProperty PROPERTY_NOTIFY_ON_SUCCESS =
new TaskProperty(ATTR_NOTIFY_ON_SUCCESS,
INFO_DISPLAY_NAME_NOTIFY_ON_SUCCESS.get(),
INFO_DESCRIPTION_NOTIFY_ON_SUCCESS.get(),
String.class, false, true, true);
/**
* The task property that will be used for the notify on start addresses.
*/
@NotNull private static final TaskProperty PROPERTY_NOTIFY_ON_START =
new TaskProperty(ATTR_NOTIFY_ON_START,
INFO_DISPLAY_NAME_NOTIFY_ON_START.get(),
INFO_DESCRIPTION_NOTIFY_ON_START.get(),
String.class, false, true, true);
/**
* The task property that will be used for the alert on error flag.
*/
@NotNull private static final TaskProperty PROPERTY_ALERT_ON_ERROR =
new TaskProperty(ATTR_ALERT_ON_ERROR,
INFO_DISPLAY_NAME_ALERT_ON_ERROR.get(),
INFO_DESCRIPTION_ALERT_ON_ERROR.get(),
Boolean.class, false, false, true);
/**
* The task property that will be used for the alert on start flag.
*/
@NotNull private static final TaskProperty PROPERTY_ALERT_ON_START =
new TaskProperty(ATTR_ALERT_ON_START,
INFO_DISPLAY_NAME_ALERT_ON_START.get(),
INFO_DESCRIPTION_ALERT_ON_START.get(),
Boolean.class, false, false, true);
/**
* The task property that will be used for the alert on success flag.
*/
@NotNull private static final TaskProperty PROPERTY_ALERT_ON_SUCCESS =
new TaskProperty(ATTR_ALERT_ON_SUCCESS,
INFO_DISPLAY_NAME_ALERT_ON_SUCCESS.get(),
INFO_DESCRIPTION_ALERT_ON_SUCCESS.get(),
Boolean.class, false, false, true);
/**
* The serial version UID for this serializable class.
*/
private static final long serialVersionUID = -4082350090081577623L;
// Indicates whether to generate an administrative alert when the task fails
// to complete successfully.
@Nullable private final Boolean alertOnError;
// Indicates whether to generate an administrative alert when the task starts.
@Nullable private final Boolean alertOnStart;
// Indicates whether to generate an administrative alert when the task
// completes successfully.
@Nullable private final Boolean alertOnSuccess;
// The time that this task actually started.
@Nullable private final Date actualStartTime;
// The time that this task completed.
@Nullable private final Date completionTime;
// The time that this task was scheduled to start.
@Nullable private final Date scheduledStartTime;
// The entry from which this task was decoded.
@Nullable private final Entry taskEntry;
// The failed dependency action for this task.
@Nullable private final FailedDependencyAction failedDependencyAction;
// The set of task IDs of the tasks on which this task is dependent.
@NotNull private final List dependencyIDs;
// The set of log messages for this task.
@NotNull private final List logMessages;
// The set of e-mail addresses of users that should be notified when the task
// processing is complete.
@NotNull private final List notifyOnCompletion;
// The set of e-mail addresses of users that should be notified if task
// processing completes with an error.
@NotNull private final List notifyOnError;
// The set of e-mail addresses of users that should be notified if task
// processing starts.
@NotNull private final List notifyOnStart;
// The set of e-mail addresses of users that should be notified if task
// processing completes successfully.
@NotNull private final List notifyOnSuccess;
// The fully-qualified name of the task class.
@NotNull private final String taskClassName;
// The DN of the entry for this task.
@NotNull private final String taskEntryDN;
// The task ID for this task.
@NotNull private final String taskID;
// The current state for this task.
@NotNull private final TaskState taskState;
/**
* Creates a new uninitialized task instance which should only be used for
* obtaining general information about this task, including the task name,
* description, and supported properties. Attempts to use a task created with
* this constructor for any other reason will likely fail.
*/
protected Task()
{
alertOnError = null;
alertOnStart = null;
alertOnSuccess = null;
actualStartTime = null;
completionTime = null;
scheduledStartTime = null;
taskEntry = null;
failedDependencyAction = null;
dependencyIDs = null;
logMessages = null;
notifyOnCompletion = null;
notifyOnError = null;
notifyOnStart = null;
notifyOnSuccess = null;
taskClassName = null;
taskEntryDN = null;
taskID = null;
taskState = null;
}
/**
* Creates a new unscheduled task with the specified task ID and class name.
*
* @param taskID The task ID to use for this task. If it is
* {@code null} then a UUID will be generated for use
* as the task ID.
* @param taskClassName The fully-qualified name of the Java class that
* provides the logic for the task. It must not be
* {@code null}.
*/
public Task(@Nullable final String taskID,
@NotNull final String taskClassName)
{
this(taskID, taskClassName, null, null, null, null, null);
}
/**
* Creates a new unscheduled task with the provided information.
*
* @param taskID The task ID to use for this task.
* @param taskClassName The fully-qualified name of the Java class
* that provides the logic for the task. It
* must not be {@code null}.
* @param scheduledStartTime The time that this task should start
* running.
* @param dependencyIDs The list of task IDs that will be required
* to complete before this task will be
* eligible to start.
* @param failedDependencyAction Indicates what action should be taken if
* any of the dependencies for this task do
* not complete successfully.
* @param notifyOnCompletion The list of e-mail addresses of individuals
* that should be notified when this task
* completes.
* @param notifyOnError The list of e-mail addresses of individuals
* that should be notified if this task does
* not complete successfully.
*/
public Task(@Nullable final String taskID,
@NotNull final String taskClassName,
@Nullable final Date scheduledStartTime,
@Nullable final List dependencyIDs,
@Nullable final FailedDependencyAction failedDependencyAction,
@Nullable final List notifyOnCompletion,
@Nullable final List notifyOnError)
{
this(taskID, taskClassName, scheduledStartTime, dependencyIDs,
failedDependencyAction, null, notifyOnCompletion, null,
notifyOnError, null, null, null);
}
/**
* Creates a new unscheduled task with the provided information.
*
* @param taskID The task ID to use for this task.
* @param taskClassName The fully-qualified name of the Java class
* that provides the logic for the task. It
* must not be {@code null}.
* @param scheduledStartTime The time that this task should start
* running.
* @param dependencyIDs The list of task IDs that will be required
* to complete before this task will be
* eligible to start.
* @param failedDependencyAction Indicates what action should be taken if
* any of the dependencies for this task do
* not complete successfully.
* @param notifyOnStart The list of e-mail addresses of individuals
* that should be notified when this task
* starts running.
* @param notifyOnCompletion The list of e-mail addresses of individuals
* that should be notified when this task
* completes.
* @param notifyOnSuccess The list of e-mail addresses of individuals
* that should be notified if this task
* completes successfully.
* @param notifyOnError The list of e-mail addresses of individuals
* that should be notified if this task does
* not complete successfully.
* @param alertOnStart Indicates whether the server should send an
* alert notification when this task starts.
* @param alertOnSuccess Indicates whether the server should send an
* alert notification if this task completes
* successfully.
* @param alertOnError Indicates whether the server should send an
* alert notification if this task fails to
* complete successfully.
*/
public Task(@Nullable final String taskID,
@NotNull final String taskClassName,
@Nullable final Date scheduledStartTime,
@Nullable final List dependencyIDs,
@Nullable final FailedDependencyAction failedDependencyAction,
@Nullable final List notifyOnStart,
@Nullable final List notifyOnCompletion,
@Nullable final List notifyOnSuccess,
@Nullable final List notifyOnError,
@Nullable final Boolean alertOnStart,
@Nullable final Boolean alertOnSuccess,
@Nullable final Boolean alertOnError)
{
Validator.ensureNotNull(taskClassName);
this.taskClassName = taskClassName;
this.scheduledStartTime = scheduledStartTime;
this.failedDependencyAction = failedDependencyAction;
this.alertOnStart = alertOnStart;
this.alertOnSuccess = alertOnSuccess;
this.alertOnError = alertOnError;
if (taskID == null)
{
this.taskID = CryptoHelper.getRandomUUID().toString();
}
else
{
this.taskID = taskID;
}
if (dependencyIDs == null)
{
this.dependencyIDs = Collections.emptyList();
}
else
{
this.dependencyIDs = Collections.unmodifiableList(dependencyIDs);
}
if (notifyOnStart == null)
{
this.notifyOnStart = Collections.emptyList();
}
else
{
this.notifyOnStart =
Collections.unmodifiableList(notifyOnStart);
}
if (notifyOnCompletion == null)
{
this.notifyOnCompletion = Collections.emptyList();
}
else
{
this.notifyOnCompletion =
Collections.unmodifiableList(notifyOnCompletion);
}
if (notifyOnSuccess == null)
{
this.notifyOnSuccess = Collections.emptyList();
}
else
{
this.notifyOnSuccess = Collections.unmodifiableList(notifyOnSuccess);
}
if (notifyOnError == null)
{
this.notifyOnError = Collections.emptyList();
}
else
{
this.notifyOnError = Collections.unmodifiableList(notifyOnError);
}
taskEntry = null;
taskEntryDN = ATTR_TASK_ID + '=' + this.taskID + ',' +
SCHEDULED_TASKS_BASE_DN;
actualStartTime = null;
completionTime = null;
logMessages = Collections.emptyList();
taskState = TaskState.UNSCHEDULED;
}
/**
* Creates a new task from the provided entry.
*
* @param entry The entry to use to create this task.
*
* @throws TaskException If the provided entry cannot be parsed as a
* scheduled task.
*/
public Task(@NotNull final Entry entry)
throws TaskException
{
taskEntry = entry;
taskEntryDN = entry.getDN();
// Ensure that the task entry has the appropriate object class for a
// scheduled task.
if (! entry.hasObjectClass(OC_TASK))
{
throw new TaskException(ERR_TASK_MISSING_OC.get(taskEntryDN));
}
// Get the task ID. It must be present.
taskID = entry.getAttributeValue(ATTR_TASK_ID);
if (taskID == null)
{
throw new TaskException(ERR_TASK_NO_ID.get(taskEntryDN));
}
// Get the task class name. It must be present.
taskClassName = entry.getAttributeValue(ATTR_TASK_CLASS);
if (taskClassName == null)
{
throw new TaskException(ERR_TASK_NO_CLASS.get(taskEntryDN));
}
// Get the task state. If it is not present, then assume "unscheduled".
final String stateStr = entry.getAttributeValue(ATTR_TASK_STATE);
if (stateStr == null)
{
taskState = TaskState.UNSCHEDULED;
}
else
{
taskState = TaskState.forName(stateStr);
if (taskState == null)
{
throw new TaskException(ERR_TASK_INVALID_STATE.get(taskEntryDN,
stateStr));
}
}
// Get the scheduled start time. It may be absent.
String timestamp = entry.getAttributeValue(ATTR_SCHEDULED_START_TIME);
if (timestamp == null)
{
scheduledStartTime = null;
}
else
{
try
{
scheduledStartTime = StaticUtils.decodeGeneralizedTime(timestamp);
}
catch (final ParseException pe)
{
Debug.debugException(pe);
throw new TaskException(ERR_TASK_CANNOT_PARSE_SCHEDULED_START_TIME.get(
taskEntryDN, timestamp, pe.getMessage()),
pe);
}
}
// Get the actual start time. It may be absent.
timestamp = entry.getAttributeValue(ATTR_ACTUAL_START_TIME);
if (timestamp == null)
{
actualStartTime = null;
}
else
{
try
{
actualStartTime = StaticUtils.decodeGeneralizedTime(timestamp);
}
catch (final ParseException pe)
{
Debug.debugException(pe);
throw new TaskException(ERR_TASK_CANNOT_PARSE_ACTUAL_START_TIME.get(
taskEntryDN, timestamp, pe.getMessage()),
pe);
}
}
// Get the completion start time. It may be absent.
timestamp = entry.getAttributeValue(ATTR_COMPLETION_TIME);
if (timestamp == null)
{
completionTime = null;
}
else
{
try
{
completionTime = StaticUtils.decodeGeneralizedTime(timestamp);
}
catch (final ParseException pe)
{
Debug.debugException(pe);
throw new TaskException(ERR_TASK_CANNOT_PARSE_COMPLETION_TIME.get(
taskEntryDN, timestamp, pe.getMessage()),
pe);
}
}
// Get the failed dependency action for this task. It may be absent.
final String name = entry.getAttributeValue(ATTR_FAILED_DEPENDENCY_ACTION);
if (name == null)
{
failedDependencyAction = null;
}
else
{
failedDependencyAction = FailedDependencyAction.forName(name);
}
// Get the dependent task IDs for this task. It may be absent.
dependencyIDs = parseStringList(entry, ATTR_DEPENDENCY_ID);
// Get the log messages for this task. It may be absent.
logMessages = parseStringList(entry, ATTR_LOG_MESSAGE);
// Get the notify on start addresses for this task. It may be absent.
notifyOnStart = parseStringList(entry, ATTR_NOTIFY_ON_START);
// Get the notify on completion addresses for this task. It may be absent.
notifyOnCompletion = parseStringList(entry, ATTR_NOTIFY_ON_COMPLETION);
// Get the notify on success addresses for this task. It may be absent.
notifyOnSuccess = parseStringList(entry, ATTR_NOTIFY_ON_SUCCESS);
// Get the notify on error addresses for this task. It may be absent.
notifyOnError = parseStringList(entry, ATTR_NOTIFY_ON_ERROR);
// Get the alert on start flag for this task. It may be absent.
alertOnStart = entry.getAttributeValueAsBoolean(ATTR_ALERT_ON_START);
// Get the alert on success flag for this task. It may be absent.
alertOnSuccess = entry.getAttributeValueAsBoolean(ATTR_ALERT_ON_SUCCESS);
// Get the alert on error flag for this task. It may be absent.
alertOnError = entry.getAttributeValueAsBoolean(ATTR_ALERT_ON_ERROR);
}
/**
* Creates a new task from the provided set of task properties.
*
* @param taskClassName The fully-qualified name of the Java class that
* provides the logic for the task. It must not be
* {@code null}.
* @param properties The set of task properties and their corresponding
* values to use for the task. It must not be
* {@code null}.
*
* @throws TaskException If the provided set of properties cannot be used to
* create a valid scheduled task.
*/
public Task(@NotNull final String taskClassName,
@NotNull final Map> properties)
throws TaskException
{
Validator.ensureNotNull(taskClassName, properties);
this.taskClassName = taskClassName;
String idStr = CryptoHelper.getRandomUUID().toString();
Date sst = null;
String[] depIDs = StaticUtils.NO_STRINGS;
FailedDependencyAction fda = FailedDependencyAction.CANCEL;
String[] nob = StaticUtils.NO_STRINGS;
String[] noc = StaticUtils.NO_STRINGS;
String[] noe = StaticUtils.NO_STRINGS;
String[] nos = StaticUtils.NO_STRINGS;
Boolean aob = null;
Boolean aoe = null;
Boolean aos = null;
for (final Map.Entry> entry :
properties.entrySet())
{
final TaskProperty p = entry.getKey();
final String attrName = p.getAttributeName();
final List