Class WorkItem

java.lang.Object
org.tasktide.core.model.workitem.WorkItem
All Implemented Interfaces:
TaskTideModel<WorkItem>

@Entity public class WorkItem extends Object implements TaskTideModel<WorkItem>
TaskTideModel class for Work Items
  • Constructor Details

    • WorkItem

      public WorkItem()
      Null constructor
    • WorkItem

      public WorkItem(String id, String itemName, ItemType itemType, ItemState itemState, String lockId, long lockDate, long doneDate, int taskCount, int taskDone, Workload workload, String stepName)
      Construct with fields
      Parameters:
      id -
      itemName -
      itemType -
      itemState -
      lockId -
      lockDate -
      doneDate -
      taskCount -
      taskDone -
      workload -
      stepName -
    • WorkItem

      public WorkItem(String id, String itemName, ItemType itemType, ItemState itemState, String lockId, long lockDate, long doneDate, int taskCount, int taskDone, Workload workload, String stepName, String stepId, String jobEnvId, CustomAnnotation anno)
      Constructor for JSON Deserialization
      Parameters:
      id -
      itemName -
      itemType -
      itemState -
      lockId -
      lockDate -
      doneDate -
      taskCount -
      taskDone -
      workload -
      stepName -
      stepId -
      jobEnvId -
      anno -
  • Method Details

    • resetModel

      public void resetModel()
      Reset model
      Specified by:
      resetModel in interface TaskTideModel<WorkItem>
    • resetTask

      public void resetTask(String id)
      Unlock ItemTask associated with provided Id
      Parameters:
      id -
    • adjustTaskState

      public void adjustTaskState(ItemTask task)
      Used by engine to adjust a task without changing work item state
      Parameters:
      task -
    • addTask

      public boolean addTask(ItemTask task)
      Add task
      Parameters:
      task -
      Returns:
      boolean
    • dropTask

      public boolean dropTask(ItemTask task)
      Drop task
      Parameters:
      task -
      Returns:
      boolean
    • getWorkloadSize

      public int getWorkloadSize()
      Get workload size
      Returns:
      int
    • summarizeByState

      public Map<ItemState, Integer> summarizeByState()
      Summarize ItemTask by ItemState
      Returns:
      Map-ItemState, Integer
    • fetchByStates

      public Map<ItemState, List<ItemTask>> fetchByStates()
      Fetch ItemTask by their ItemState
      Returns:
      Map-ItemState, List-ItemTask
    • setTaskCounts

      public void setTaskCounts()
      Set task count fields
    • getId

      public String getId()
      Get work item Id
      Specified by:
      getId in interface TaskTideModel<WorkItem>
      Returns:
      String
    • setId

      public void setId(String id)
      Set work item id
      Parameters:
      id -
    • getJobEnvId

      public String getJobEnvId()
      Get job environment Id
      Returns:
      String
    • setJobEnvId

      public void setJobEnvId(String jobEnvId)
      Sets job environment Id
      Parameters:
      jobEnvId -
    • getItemName

      public String getItemName()
      Get item name
      Returns:
      String
    • setItemName

      public void setItemName(String itemName)
      Set item name
      Parameters:
      itemName -
    • getAnnotations

      public CustomAnnotation getAnnotations()
      Get annotations
      Specified by:
      getAnnotations in interface TaskTideModel<WorkItem>
      Returns:
      CustomAnnotation
    • setAnnotations

      public void setAnnotations(CustomAnnotation anno)
      Set annotation provided
      Specified by:
      setAnnotations in interface TaskTideModel<WorkItem>
      Parameters:
      anno -
    • getItemType

      public ItemType getItemType()
      Get item type
      Returns:
      ItemType
    • setItemType

      public void setItemType(ItemType itemType)
      Set item type
      Parameters:
      itemType -
    • getItemState

      public ItemState getItemState()
      Get item state
      Returns:
      ItemState
    • setItemState

      public void setItemState(ItemState itemState)
      Set item state
      Parameters:
      itemState -
    • getLockId

      public String getLockId()
      Get lock Id
      Returns:
      String
    • setLockId

      public void setLockId(String lockId)
      Set lock Id
      Parameters:
      lockId -
    • getLockDate

      public long getLockDate()
      Get lock date
      Returns:
      long
    • setLockDate

      public void setLockDate(long lockDate)
      Set lock date
      Parameters:
      lockDate -
    • getDoneDate

      public long getDoneDate()
      Get done date
      Returns:
      long
    • setDoneDate

      public void setDoneDate(long doneDate)
      Set done date
      Parameters:
      doneDate -
    • getTaskCount

      public int getTaskCount()
      Get total task count
      Returns:
      int
    • setTaskCount

      public void setTaskCount(int taskCount)
      Set total task count
      Parameters:
      taskCount -
    • setTaskCount

      public void setTaskCount()
      Set task count from workload size
    • getTaskDone

      public int getTaskDone()
      Get task done count
      Returns:
      int
    • setTaskDone

      public void setTaskDone(int taskDone)
      Set task done count
      Parameters:
      taskDone -
    • setTaskDone

      public void setTaskDone()
      Set task done count from summary
    • getWorkload

      public Workload getWorkload()
      Get workload
      Returns:
      Workload
    • setWorkload

      public void setWorkload(Workload workload)
      Set workload
      Parameters:
      workload -
    • getStepName

      public String getStepName()
      Get step name
      Returns:
      String
    • setStepName

      public void setStepName(String stepName)
      Set step name
      Parameters:
      stepName -
    • setStepId

      public void setStepId(String stepId)
      Set the parent Step Id
      Parameters:
      stepId -
    • getStepId

      public String getStepId()
      Get the parent Step Id
      Returns:
      String
    • toJsonString

      public String toJsonString()
      Serialize to JSON string
      Returns:
      String
    • toJsonDoc

      public String toJsonDoc()
      Serialize to a human readable formatted JSON string
      Specified by:
      toJsonDoc in interface TaskTideModel<WorkItem>
      Returns:
      String
    • getCollection

      public String getCollection()
      Get step
      Specified by:
      getCollection in interface TaskTideModel<WorkItem>
      Returns:
    • toString

      public String toString()
      Represent as string
      Overrides:
      toString in class Object
      Returns:
      String
    • getState

      public String getState()
      Description copied from interface: TaskTideModel
      Return current of model
      Specified by:
      getState in interface TaskTideModel<WorkItem>
      Returns:
      String
    • toJson

      public String toJson()
      Represent as JSON doc
      Specified by:
      toJson in interface TaskTideModel<WorkItem>
      Returns:
      String
    • getValueFromField

      public Object getValueFromField(String field)
      Return value of field. Must match toString() names
      Specified by:
      getValueFromField in interface TaskTideModel<WorkItem>
      Parameters:
      field -
      Returns:
      Object