package com.hpe.caf.api.worker;


import java.util.HashMap;
import java.util.Map;
import java.util.Objects;


/**
 * The generic task message class to be serialised from or to a queue.
 * This will contain the serialised worker-specific data inside.
 */
public final class TaskMessage
{
    /**
     * Unique id for this message chain.
     */
    private String taskId;
    /**
     * Identifies the sort of task this message is.
     */
    private String taskClassifier;
    /**
     * The numeric API version of the message task.
     */
    private int taskApiVersion;
    /**
     * The serialised data of the task-specific message.
     */
    private byte[] taskData;
    /**
     * Status of this task.
     */
    private TaskStatus taskStatus;
    /**
     * Holds worker-specific context data.
     */
    private Map<String, byte[]> context;


    public TaskMessage(){ }


    public TaskMessage(final String taskId, final String taskClassifier, final int taskApiVersion, final byte[] taskData,
                       final TaskStatus taskStatus, final Map<String, byte[]> context)
    {
        this.taskId = Objects.requireNonNull(taskId);
        this.taskClassifier = Objects.requireNonNull(taskClassifier);
        this.taskApiVersion = Objects.requireNonNull(taskApiVersion);
        this.taskData = Objects.requireNonNull(taskData);
        this.taskStatus = Objects.requireNonNull(taskStatus);
        this.context = Objects.requireNonNull(context);
    }


    public String getTaskId()
    {
        return taskId;
    }


    public void setTaskId(final String taskId)
    {
        this.taskId = taskId;
    }


    public String getTaskClassifier()
    {
        return taskClassifier;
    }


    public void setTaskClassifier(final String taskClassifier)
    {
        this.taskClassifier = taskClassifier;
    }


    public byte[] getTaskData()
    {
        return taskData;
    }


    public void setTaskData(final byte[] taskData)
    {
        this.taskData = taskData;
    }


    public TaskStatus getTaskStatus()
    {
        return taskStatus;
    }


    public void setTaskStatus(final TaskStatus taskStatus)
    {
        this.taskStatus = taskStatus;
    }


    public int getTaskApiVersion()
    {
        return taskApiVersion;
    }


    public void setTaskApiVersion(final int taskApiVersion)
    {
        this.taskApiVersion = taskApiVersion;
    }


    public Map<String, byte[]> getContext()
    {
        return context == null ? new HashMap<>() : context;
    }


    public void setContext(final Map<String, byte[]> context)
    {
        this.context = context;
    }
}

@@ -280,16 +280,182 @@
 ssage%0A%7B%0A
+    public static final int TASK_MESSAGE_VERSION = 1;%0A    /**%0A     * The version of this TaskMessage wrapper.%0A     */%0A    private int version = TASK_MESSAGE_VERSION;%0A
     /**%0A
@@ -480,23 +480,20 @@
 or this 
-message
+task
  chain.%0A
@@ -1628,32 +1628,190 @@
 ntext);%0A    %7D%0A%0A%0A
+    public int getVersion()%0A    %7B%0A        return version;%0A    %7D%0A%0A%0A    public void setVersion(final int version)%0A    %7B%0A        this.version = version;%0A    %7D%0A%0A%0A
     public Strin

Add versioning to TaskMessage