If i'm not mistaken when using a task any variables i.e. comming from parammeter mapping, or even entry actions etc should be placed in content then the content is accessed like below,
long contentId = task.getTaskData().getDocumentContentId();
if (contentId != -1) {
BlockingGetContentResponseHandler getContentResponseHandler = new BlockingGetContentResponseHandler();
client.getContent(contentId, getContentResponseHandler);
Content content = getContentResponseHandler.getContent();
all other arguments of task are access from the methods of TaskData , i.e. task.getTaskData().getComments(); etc
Otherwise a custom workitem has method getParameter for the custom arguments specified for this workitem.But again the variables from parameter mapping and entry actions will have to be placed to the specific argument of that workitem.
Please correct me if there is a better approach....