sc = connect();
Shark shark = Shark.getInstance();
WfActivityIterator ai = sc.get_iterator_activity();
ActivityFilterBuilder aieb = shark.getActivityFilterBuilder();
WMSessionHandle sessionHandle = sc.getSessionHandle();
WMFilter filter = new WMFilter();
if (activityInstanceId != null && activityInstanceId.trim().length() > 0) {
filter = aieb.addIdEquals(sessionHandle, activityInstanceId);