}
protected DecisionTask getNextHistoryTask(String nextPageToken) {
WorkflowExecutionInfo executionInfo = WorkflowExecutionUtils.describeWorkflowInstance(service, domain,
workflowExecution);
History history = WorkflowExecutionUtils.getHistoryPage(nextPageToken, service, domain, workflowExecution);
DecisionTask task = new DecisionTask();
List<HistoryEvent> events = history.getEvents();
events = truncateHistory(events);
if (events == null) {
return null;
}
task.setEvents(events);
task.setWorkflowExecution(workflowExecution);
task.setWorkflowType(executionInfo.getWorkflowType());
task.setNextPageToken(history.getNextPageToken());
return task;
}