com.amazonaws.services.datapipeline.model.TaskObject Maven / Gradle / Ivy
Show all versions of aws-java-sdk-datapipeline Show documentation
/*
 * Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights
 * Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License").
 * You may not use this file except in compliance with the License.
 * A copy of the License is located at
 *
 *  http://aws.amazon.com/apache2.0
 *
 * or in the "license" file accompanying this file. This file 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.
 */
package com.amazonaws.services.datapipeline.model;
import java.io.Serializable;
/**
 * 
 * Contains information about a pipeline task that is assigned to a task runner.
 * 
 */
public class TaskObject implements Serializable, Cloneable {
    /**
     * 
     * An internal identifier for the task. This ID is passed to the
     * SetTaskStatus and ReportTaskProgress actions.
     * 
     */
    private String taskId;
    /**
     * 
     * The ID of the pipeline that provided the task.
     * 
     */
    private String pipelineId;
    /**
     * 
     * The ID of the pipeline task attempt object. AWS Data Pipeline uses this
     * value to track how many times a task is attempted.
     * 
     */
    private String attemptId;
    /**
     * 
     * Connection information for the location where the task runner will
     * publish the output of the task.
     * 
     */
    private java.util.Map objects;
    /**
     * 
     * An internal identifier for the task. This ID is passed to the
     * SetTaskStatus and ReportTaskProgress actions.
     * 
     * 
     * @param taskId
     *        An internal identifier for the task. This ID is passed to the
     *        SetTaskStatus and ReportTaskProgress actions.
     */
    public void setTaskId(String taskId) {
        this.taskId = taskId;
    }
    /**
     * 
     * An internal identifier for the task. This ID is passed to the
     * SetTaskStatus and ReportTaskProgress actions.
     * 
     * 
     * @return An internal identifier for the task. This ID is passed to the
     *         SetTaskStatus and ReportTaskProgress actions.
     */
    public String getTaskId() {
        return this.taskId;
    }
    /**
     * 
     * An internal identifier for the task. This ID is passed to the
     * SetTaskStatus and ReportTaskProgress actions.
     * 
     * 
     * @param taskId
     *        An internal identifier for the task. This ID is passed to the
     *        SetTaskStatus and ReportTaskProgress actions.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public TaskObject withTaskId(String taskId) {
        setTaskId(taskId);
        return this;
    }
    /**
     * 
     * The ID of the pipeline that provided the task.
     * 
     * 
     * @param pipelineId
     *        The ID of the pipeline that provided the task.
     */
    public void setPipelineId(String pipelineId) {
        this.pipelineId = pipelineId;
    }
    /**
     * 
     * The ID of the pipeline that provided the task.
     * 
     * 
     * @return The ID of the pipeline that provided the task.
     */
    public String getPipelineId() {
        return this.pipelineId;
    }
    /**
     * 
     * The ID of the pipeline that provided the task.
     * 
     * 
     * @param pipelineId
     *        The ID of the pipeline that provided the task.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public TaskObject withPipelineId(String pipelineId) {
        setPipelineId(pipelineId);
        return this;
    }
    /**
     * 
     * The ID of the pipeline task attempt object. AWS Data Pipeline uses this
     * value to track how many times a task is attempted.
     * 
     * 
     * @param attemptId
     *        The ID of the pipeline task attempt object. AWS Data Pipeline uses
     *        this value to track how many times a task is attempted.
     */
    public void setAttemptId(String attemptId) {
        this.attemptId = attemptId;
    }
    /**
     * 
     * The ID of the pipeline task attempt object. AWS Data Pipeline uses this
     * value to track how many times a task is attempted.
     * 
     * 
     * @return The ID of the pipeline task attempt object. AWS Data Pipeline
     *         uses this value to track how many times a task is attempted.
     */
    public String getAttemptId() {
        return this.attemptId;
    }
    /**
     * 
     * The ID of the pipeline task attempt object. AWS Data Pipeline uses this
     * value to track how many times a task is attempted.
     * 
     * 
     * @param attemptId
     *        The ID of the pipeline task attempt object. AWS Data Pipeline uses
     *        this value to track how many times a task is attempted.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public TaskObject withAttemptId(String attemptId) {
        setAttemptId(attemptId);
        return this;
    }
    /**
     * 
     * Connection information for the location where the task runner will
     * publish the output of the task.
     * 
     * 
     * @return Connection information for the location where the task runner
     *         will publish the output of the task.
     */
    public java.util.Map getObjects() {
        return objects;
    }
    /**
     * 
     * Connection information for the location where the task runner will
     * publish the output of the task.
     * 
     * 
     * @param objects
     *        Connection information for the location where the task runner will
     *        publish the output of the task.
     */
    public void setObjects(java.util.Map objects) {
        this.objects = objects;
    }
    /**
     * 
     * Connection information for the location where the task runner will
     * publish the output of the task.
     * 
     * 
     * @param objects
     *        Connection information for the location where the task runner will
     *        publish the output of the task.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public TaskObject withObjects(java.util.Map objects) {
        setObjects(objects);
        return this;
    }
    public TaskObject addObjectsEntry(String key, PipelineObject value) {
        if (null == this.objects) {
            this.objects = new java.util.HashMap();
        }
        if (this.objects.containsKey(key))
            throw new IllegalArgumentException("Duplicated keys ("
                    + key.toString() + ") are provided.");
        this.objects.put(key, value);
        return this;
    }
    /**
     * Removes all the entries added into Objects. <p> Returns a reference to
     * this object so that method calls can be chained together.
     */
    public TaskObject clearObjectsEntries() {
        this.objects = null;
        return this;
    }
    /**
     * Returns a string representation of this object; useful for testing and
     * debugging.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getTaskId() != null)
            sb.append("TaskId: " + getTaskId() + ",");
        if (getPipelineId() != null)
            sb.append("PipelineId: " + getPipelineId() + ",");
        if (getAttemptId() != null)
            sb.append("AttemptId: " + getAttemptId() + ",");
        if (getObjects() != null)
            sb.append("Objects: " + getObjects());
        sb.append("}");
        return sb.toString();
    }
    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (obj instanceof TaskObject == false)
            return false;
        TaskObject other = (TaskObject) obj;
        if (other.getTaskId() == null ^ this.getTaskId() == null)
            return false;
        if (other.getTaskId() != null
                && other.getTaskId().equals(this.getTaskId()) == false)
            return false;
        if (other.getPipelineId() == null ^ this.getPipelineId() == null)
            return false;
        if (other.getPipelineId() != null
                && other.getPipelineId().equals(this.getPipelineId()) == false)
            return false;
        if (other.getAttemptId() == null ^ this.getAttemptId() == null)
            return false;
        if (other.getAttemptId() != null
                && other.getAttemptId().equals(this.getAttemptId()) == false)
            return false;
        if (other.getObjects() == null ^ this.getObjects() == null)
            return false;
        if (other.getObjects() != null
                && other.getObjects().equals(this.getObjects()) == false)
            return false;
        return true;
    }
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        hashCode = prime * hashCode
                + ((getTaskId() == null) ? 0 : getTaskId().hashCode());
        hashCode = prime * hashCode
                + ((getPipelineId() == null) ? 0 : getPipelineId().hashCode());
        hashCode = prime * hashCode
                + ((getAttemptId() == null) ? 0 : getAttemptId().hashCode());
        hashCode = prime * hashCode
                + ((getObjects() == null) ? 0 : getObjects().hashCode());
        return hashCode;
    }
    @Override
    public TaskObject clone() {
        try {
            return (TaskObject) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException(
                    "Got a CloneNotSupportedException from Object.clone() "
                            + "even though we're Cloneable!", e);
        }
    }
}