public void getWorkItemListForAssignments(
     List<TaskAssignment> taskAssignments,
     FmServiceExecutionListener<List<WorkItem>> executionListener) {
   List<Object> taskAssignmendIds = new ArrayList<Object>();
   for (TaskAssignment taskAssignment : taskAssignments) {
     taskAssignmendIds.add(taskAssignment.getId());
   }
   executeServiceMethod(
       METHOD_GET_WORK_ITEM_LIST_FOR_ASSIGNMENTS,
       taskAssignmendIds.toArray(new Object[0]),
       executionListener);
 }
  private Object processServiceResult(final String methodName, final Object serviceResult) {

    Object result = null;

    if (serviceResult == null) {
      return result;
    }

    if (methodName.equals(METHOD_GET_WORK_OBJECT_LIST)) {

      List<WorkObject> workerObjectList = new ArrayList<WorkObject>();

      for (Object workerObjectDataObject : (Object[]) serviceResult) {

        Object[] workerObjectData = (Object[]) workerObjectDataObject;
        WorkObject workObject = new WorkObject((Long) workerObjectData[0]);

        workObject.setNumber((String) workerObjectData[1]);
        workObject.setDescription((String) workerObjectData[2]);

        Object[] addressData = (Object[]) workerObjectData[3];
        Address address = new Address((Long) addressData[0]);
        workObject.setAddress(address);

        address.setCountry((String) addressData[1]);
        address.setCity((String) addressData[2]);
        address.setZipCode((String) addressData[3]);
        address.setStreet((String) addressData[4]);
        address.setNumber((String) addressData[5]);
        address.setLatitude((Long) addressData[6]);
        address.setLongitude((Long) addressData[7]);

        Object[] contactPersonData = (Object[]) workerObjectData[4];
        Person contactPerson = new Person((Long) contactPersonData[0]);
        workObject.setContactPerson(contactPerson);

        contactPerson.setFirstName((String) contactPersonData[1]);
        contactPerson.setLastName((String) contactPersonData[2]);
        contactPerson.setDateOfBirth((Date) contactPersonData[3]);
        contactPerson.setMobile((String) contactPersonData[4]);
        contactPerson.setPhone((String) contactPersonData[5]);
        contactPerson.setEmail((String) contactPersonData[6]);

        workerObjectList.add(workObject);
      }

      result = workerObjectList;

    } else if (methodName.equals(METHOD_GET_TASK_LIST)) {

      List<Task> taskList = new ArrayList<Task>();

      for (Object taskDataObject : (Object[]) serviceResult) {

        Object[] taskData = (Object[]) taskDataObject;

        Task task = new Task((Long) taskData[0]);
        task.setName((String) taskData[1]);
        task.setDescription((String) taskData[2]);

        taskList.add(task);
      }

      result = taskList;

    } else if (methodName.equals(METHOD_GET_TASK_ASSIGNMENT_LIST)) {

      List<TaskAssignment> taskAssignmentList = new ArrayList<TaskAssignment>();

      for (Object taskAssignmentDataObject : (Object[]) serviceResult) {

        Object[] taskAssignmentData = (Object[]) taskAssignmentDataObject;

        TaskAssignment taskAssignment = new TaskAssignment((Long) taskAssignmentData[0]);
        taskAssignment.setFrequency((String) taskAssignmentData[1]);
        taskAssignment.setFrequencyInformation((String) taskAssignmentData[2]);
        taskAssignment.setTaskId((Long) taskAssignmentData[3]);
        taskAssignment.setWorkObjectId((Long) taskAssignmentData[4]);
        taskAssignment.setWorkerId((Long) taskAssignmentData[5]);

        taskAssignmentList.add(taskAssignment);
      }

      result = taskAssignmentList;

    } else if (methodName.equals(METHOD_GET_WORKER_LIST)) {

      List<Worker> workerList = new ArrayList<Worker>();

      for (Object workerDataObject : (Object[]) serviceResult) {

        Object[] workerData = (Object[]) workerDataObject;

        Worker worker = new Worker((Long) workerData[0]);
        worker.setUserName((String) workerData[1]);
        worker.setFirstName((String) workerData[2]);
        worker.setLastName((String) workerData[3]);
        worker.setDateOfBirth((Date) workerData[4]);
        worker.setMobile((String) workerData[5]);
        worker.setPhone((String) workerData[6]);
        worker.setEmail((String) workerData[7]);
        worker.setLatitude((Long) workerData[8]);
        worker.setLongitude((Long) workerData[9]);

        workerList.add(worker);
      }

      result = workerList;

    } else if (methodName.equals(METHOD_GET_WORK_ITEM_LIST_FOR_ASSIGNMENTS)) {

      List<WorkItem> workeItemList = new ArrayList<WorkItem>();

      for (Object workItemDataObject : (Object[]) serviceResult) {

        Object[] workItemData = (Object[]) workItemDataObject;

        WorkItem workItem = new WorkItem();
        workItem.setId((Long) workItemData[0]);
        workItem.setTaskAssignmentId((Long) workItemData[1]);
        workItem.setStatus((String) workItemData[2]);
        workItem.setDate((Date) workItemData[3]);

        workeItemList.add(workItem);
      }

      result = workeItemList;

    } else if (methodName.equals(METHOD_INSERT_OR_UPDATE_WORK_ITEM)) {

      Object[] workItemData = (Object[]) serviceResult;

      WorkItem workItem = new WorkItem();
      workItem.setId((Long) workItemData[0]);
      workItem.setTaskAssignmentId((Long) workItemData[1]);
      workItem.setStatus((String) workItemData[2]);
      workItem.setDate((Date) workItemData[3]);

      result = workItem;

    } else if (methodName.equals(METHOD_AUTHENTICATE)) {

      Object[] workerData = (Object[]) serviceResult;

      if (workerData.length == 0) {
        result = null;
      } else {

        Worker worker = new Worker((Long) workerData[0]);
        worker.setUserName((String) workerData[1]);
        worker.setFirstName((String) workerData[2]);
        worker.setLastName((String) workerData[3]);
        worker.setDateOfBirth((Date) workerData[4]);
        worker.setMobile((String) workerData[5]);
        worker.setPhone((String) workerData[6]);
        worker.setEmail((String) workerData[7]);
        worker.setLatitude((Long) workerData[8]);
        worker.setLongitude((Long) workerData[9]);
        result = worker;
      }

    } else if (methodName.equals(METHOD_INSERT_ADDITIONAL_WORK_ITEM)) {

      result = Boolean.TRUE.equals(serviceResult);
    }
    return result;
  }