There is a constants file in the taskmanager client jar. Here is a sample of how we use the filter to get tasks for a provided processinstanceid. We did the sort on pCREATION_TIME but this could easily be changed to pID to sort by task id.
TaskManagerQueryService tmqs = TaskManagerClientFactory.getQueryManager(clientFactory);
TaskSearchFilter taskSearchFilter = new TaskSearchFilter();
taskSearchFilter.addSortDesc(TaskSearchingConstants.pCREATION_TIME);
taskSearchFilter.addCondition(TaskSearchingConstants.pPROCESS_INSTANCE_ID, Operator.EQUALS, Long.valueOf(processInstanceId));
List results = tmqs.taskSearch(taskSearchFilter);
Hope this helps.