Class Timesheet

java.lang.Object
overit.geocallapp.wfm.core.bl.timesheet.Timesheet
All Implemented Interfaces:
Serializable, Iterable<BOTask>

public class Timesheet extends Object implements Iterable<BOTask>, Serializable
Business object representing a timesheet. It consists of a header BOTimesheetHeader and a list of related tasks BOTask
Since:
9.2
See Also:
GCApi:
bo
  • Field Details

  • Constructor Details

    • Timesheet

      public Timesheet()
      Instantiates a new timesheet.
  • Method Details

    • getHeader

      public BOTimesheetHeader getHeader()
      Returns the timesheet header.
      Returns:
      the header id
      See Also:
    • setHeader

      public void setHeader(BOTimesheetHeader header)
      Sets the timesheet header.
      Parameters:
      header - the header id
      See Also:
    • getId

      public Long getId()
      Returns the timesheet id.
      Returns:
      the id of the timesheet header
    • getTasks

      public List<BOTask> getTasks()
      Returns the tasks list.
      Returns:
      a list of BO task elements of type BOTask
    • setTasks

      public void setTasks(List<BOTask> tasks)
      Sets the task list.
      Parameters:
      tasks - the task list
    • getActiveTasks

      public List<BOTask> getActiveTasks()
      Returns the active tasks list.
      Returns:
      a list of active BO task elements of type BOTask
    • getActiveShiftTasks

      public List<BOTask> getActiveShiftTasks()
    • getActiveTasksByRange

      public List<BOTask> getActiveTasksByRange(Date rangeStartDate, Date rangeEndDate)
    • getTaskById

      public BOTask getTaskById(Long taskId)
      Returns the task by the given id.
      Parameters:
      taskId - the task id
      Returns:
      the BOTask
    • addTask

      public void addTask(BOTask toAdd)
      Adds the given task.
      Parameters:
      toAdd - the task to add
    • removeTask

      public boolean removeTask(Long taskId)
      Remove the given task.
      Parameters:
      taskId - the task id
      Returns:
      true, if successful
    • replaceTask

      public void replaceTask(BOTask task)
      Replace task.
      Parameters:
      task - the task
    • sortTasks

      public void sortTasks(Comparator<BOTask> comparator)
      Sort tasks.
      Parameters:
      comparator - the comparator
    • findTask

      public BOTask findTask(Predicate<BOTask> searchFunction)
      Find the timesheet's task by the given search function
      Parameters:
      searchFunction - the search function
      Returns:
      the BOTask
    • iterator

      public Iterator<BOTask> iterator()
      Returns an iterator on the timesheet tasks list.
      Specified by:
      iterator in interface Iterable<BOTask>
      Returns:
      the iterator
    • isActiveTask

      protected Predicate<BOTask> isActiveTask()
    • fallsIntoRange

      protected Predicate<BOTask> fallsIntoRange(Date rangeStartDate, Date rangeEndDate)
    • isShiftTask

      protected Predicate<BOTask> isShiftTask(Long shift)
    • isOnCallShiftTask

      protected Predicate<BOTask> isOnCallShiftTask(Long onCallShift)
    • isWithoutShiftTask

      protected Predicate<BOTask> isWithoutShiftTask()
    • isInterventionTask

      protected Predicate<BOTask> isInterventionTask(Long intervention)
    • includesDate

      public boolean includesDate(Date referenceDate)
      Checks whether the timesheet includes the specified date.
      Parameters:
      referenceDate - the reference date
      Returns:
      true if timesheet interval includes the date, false otherwise
    • isOpen

      public boolean isOpen()
      Checks whether the timesheet is in open state.
      Returns:
      true if timesheet state is BOTimesheetState.Values.OPEN
    • isToBeValidated

      public boolean isToBeValidated()
      Checks whether the timesheet is in to be validated state.
      Returns:
      true if timesheet state is BOTimesheetState.Values.TO_BE_VALIDATED
    • isValidated

      public boolean isValidated()
      Checks whether the timesheet is in validated state.
      Returns:
      true if timesheet state is BOTimesheetState.Values.VALIDATED
    • getShiftIds

      public List<Long> getShiftIds()
      Returns the shift id list of the timesheet tasks.
      Returns:
      the list of task shift id
    • getOnCallShiftIds

      public List<Long> getOnCallShiftIds()
      Returns the on call shift id list of the timesheet tasks.
      Returns:
      the list of task on call shift id
    • getTaskCategoryIds

      public List<Long> getTaskCategoryIds()
      Returns the task category id list of the timesheet tasks.
      Returns:
      the list of task category id
    • getUnavailabilityReasonIds

      public List<Long> getUnavailabilityReasonIds()
      Returns the on unavailability reason id list of the timesheet tasks.
      Returns:
      the list of unavailability reason id
    • getShiftTasks

      public List<BOTask> getShiftTasks(Long shift)
      Returns the tasks of the shift.
      Parameters:
      shift - shift id
      Returns:
      the list of the tasks related to the shift
    • getActiveShiftTasks

      public List<BOTask> getActiveShiftTasks(Long shift)
      Returns the active tasks of the shift.
      Parameters:
      shift - shift id
      Returns:
      the list of the active tasks related to the shift
    • getOnCallShiftTasks

      public List<BOTask> getOnCallShiftTasks(Long onCallShift)
      Returns the tasks of the on call shift.
      Parameters:
      onCallShift - on call shift id
      Returns:
      the list of the tasks related to the on call shift
    • getActiveOnCallShiftTasks

      public List<BOTask> getActiveOnCallShiftTasks(Long onCallShift)
      Returns the active tasks of the on call shift.
      Parameters:
      onCallShift - on call shift id
      Returns:
      the list of the active tasks related to the on call shift
    • getTaskByStartEntity

      public Optional<BOTask> getTaskByStartEntity(Long category, Long eventType, BOEventEntity eventEntity)
      Finds the active task by the given category, start event type and start event entity.
      Parameters:
      category - category id
      eventType - start event type id
      eventEntity - start event entity id
      Returns:
      an optional BOTask
    • getTaskByEndEntity

      public Optional<BOTask> getTaskByEndEntity(Long category, Long eventType, BOEventEntity eventEntity)
      Finds the active task by the given category, end event type and end event entity.
      Parameters:
      category - category id
      eventType - end event type id
      eventEntity - end event entity id
      Returns:
      the task by end entity
    • getShiftActualStartDate

      public Date getShiftActualStartDate(Long shift)
      Returns the minumum start date of the tasks of the given shift.
      Parameters:
      shift - the shift id
      Returns:
      the actual start date of the shift
    • getShiftActualEndDate

      public Date getShiftActualEndDate(Long shift)
      Returns the maximum end date of the tasks of the given shift.
      Parameters:
      shift - the shift id
      Returns:
      the actual end date of the shift
    • getOnCallShiftActualStartDate

      public Date getOnCallShiftActualStartDate(Long onCallShift)
      Returns the minumum start date of the tasks of the given on call shift.
      Parameters:
      onCallShift - the on call shift id
      Returns:
      the actual start date of the on call shift
    • getOnCallShiftActualEndDate

      public Date getOnCallShiftActualEndDate(Long onCallShift)
      Returns the maximum end date of the tasks of the given on call shift.
      Parameters:
      onCallShift - the on call shift id
      Returns:
      the actual end date of the on call shift
    • getActiveWithoutShiftTasks

      public List<BOTask> getActiveWithoutShiftTasks()
    • getWithoutShiftActualStartDate

      public Date getWithoutShiftActualStartDate()
    • getWithoutShiftActualEndDate

      public Date getWithoutShiftActualEndDate()
    • getActiveTasksByIntervention

      public List<BOTask> getActiveTasksByIntervention(Long intervention)
    • getWarnings

      public List<BOWarning> getWarnings()
    • setWarnings

      public void setWarnings(List<BOWarning> warnings)
    • getWarningById

      public BOWarning getWarningById(Long id)
    • getWarningsByTask

      public List<BOWarning> getWarningsByTask(Long taskId)
    • getEventEntities

      public List<BOEventEntity> getEventEntities()
    • setEventEntities

      public void setEventEntities(List<BOEventEntity> eventEntities)
    • getEventEntityById

      public BOEventEntity getEventEntityById(Long id)
    • addEventEntity

      public void addEventEntity(BOEventEntity toAdd)
    • removeEventEntity

      public boolean removeEventEntity(Long eventEntityId)
    • replaceEventEntity

      public void replaceEventEntity(BOEventEntity eventEntity)