/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package schedule;

/**
 * Container storing configuration parameters of scheduled tasks.
 * 
 * @author Marcel Duris
 */
public class TaskContainer {

    private String taskName;
    private String taskParam;
    private String taskTime;
    private Long notAfter = 0l;
    private ITask task;

    /**
     * Constructor takes arguments representing schedulable task and stores them
     * in internal variables. Format of any parameter is not checked.
     *
     * @param taskName name of task
     * @param taskParam parameters of task
     * @param taskTime execution time
     * @see schedule.ScheduleConfigManager
     */
    public TaskContainer(String taskName, String taskParam, String taskTime) {
        this.taskName = taskName;
        this.taskParam = taskParam;
        this.taskTime = taskTime;
        //task =
    }

    public TaskContainer(String taskName, String taskParam, String taskTime, Long notAfter) {
        this(taskName, taskParam, taskTime);
        this.notAfter = notAfter;
    }

    /**
     * Returns name or type of task based on which exact operation can be
     * scheduled.
     *
     * @return String name of task.
     */
    public String getName() {
        return taskName;
    }

    /**
     * Arguments of task serialized into string. Exact format of this string
     * depends on type of task.
     *
     * @return string storing serialized parameters
     */
    public String getParam() {
        return taskParam;
    }

    /**
     * Concatedaned string representing time of execution. For exact syntax see
     * ScheduleConfigManager.
     *
     * @return string serialization of time
     * @see schedule.ScheduleConfigManager
     */
    public String getTime() {
        return taskTime;
    }

    public String getNotAfter() {
        if (notAfter == 0) {
            return null;
        } else {
            return Long.toString(notAfter);
        }
    }
}


