Class DatabaseWorklogStore

java.lang.Object
com.atlassian.jira.issue.worklog.DatabaseWorklogStore
All Implemented Interfaces:
WorklogStore

public class DatabaseWorklogStore extends Object implements WorklogStore
QueryDSL based implementation of WorklogStore.
  • Field Details

  • Constructor Details

  • Method Details

    • update

      public Worklog update(Worklog worklog)
      Description copied from interface: WorklogStore
      Updates fields of an existing worklog in the datastore (identified by its id) with the supplied worklog.
      Specified by:
      update in interface WorklogStore
      Parameters:
      worklog - identifies the worklog to update and provides the updated values.
      Returns:
      the updated worklog.
    • create

      public Worklog create(Worklog worklog)
      Description copied from interface: WorklogStore
      Creates a new worklog in the data store based on the values in the passed in Worklog object.
      Specified by:
      create in interface WorklogStore
      Parameters:
      worklog - specifies the values to create the worklog with.
      Returns:
      the representation of the created worklog, including the id.
    • delete

      public boolean delete(Long worklogId)
      Description copied from interface: WorklogStore
      Deletes a worklog from the data store based on the passed in id.
      Specified by:
      delete in interface WorklogStore
      Parameters:
      worklogId - specifies which worklog to delete (not null)
      Returns:
      true if the worklog was deleted, false otherwise
    • deleteWorklogsForIssue

      public long deleteWorklogsForIssue(Issue issue)
      Description copied from interface: WorklogStore
      Deletes all worklogs which are related to the given Issue.
      Specified by:
      deleteWorklogsForIssue in interface WorklogStore
      Parameters:
      issue - issue for which worklogs will be removed
      Returns:
      the number of worklogs deleted
    • getById

      public Worklog getById(Long id)
      Description copied from interface: WorklogStore
      Returns a worklog specified by it's id
      Specified by:
      getById in interface WorklogStore
      Parameters:
      id - the specified id (not null)
      Returns:
      the specified worklog, or null if not found
    • getByIssue

      public List<Worklog> getByIssue(Issue issue)
      Description copied from interface: WorklogStore
      Returns all child worklogs of a specified issue
      Specified by:
      getByIssue in interface WorklogStore
      Parameters:
      issue - the specified parent issue (not null)
      Returns:
      a List of Worklogs, ordered by creation date. An empty List will be returned if none are found
    • swapWorklogGroupRestriction

      public int swapWorklogGroupRestriction(String groupName, String swapGroup)
      Description copied from interface: WorklogStore
      Updates Worklog's such that worklogs that have a visibility restriction of the provided groupName will be changed to have a visibility restriction of the provided swapGroup.

      Note: There is no validation performed by this method to determine if the provided swapGroup is a valid group with JIRA. This validation must be done by the caller.

      Specified by:
      swapWorklogGroupRestriction in interface WorklogStore
      Parameters:
      groupName - identifies the group the worklogs are restricted by, this must not be null.
      swapGroup - identifies the group the worklogs will be changed to be restricted by, this must not be null.
      Returns:
      tbe number of worklogs affected by the update.
    • getCountForWorklogsRestrictedByGroup

      public long getCountForWorklogsRestrictedByGroup(String groupName)
      Description copied from interface: WorklogStore
      Returns the count of all Worklog's that have a visibility restriction of the provided group.
      Specified by:
      getCountForWorklogsRestrictedByGroup in interface WorklogStore
      Parameters:
      groupName - identifies the group the worklogs are restricted by, this must not be null.
      Returns:
      the count of restricted groups
    • getCountForWorklogsRestrictedByRole

      public long getCountForWorklogsRestrictedByRole(Long roleId)
      Description copied from interface: WorklogStore
      Returns the count of all Worklog's that have a visibility restriction of the provided role.
      Specified by:
      getCountForWorklogsRestrictedByRole in interface WorklogStore
      Parameters:
      roleId - identifies the role the worklogs are restricted by, this must not be null.
      Returns:
      the count of restricted worklogs
    • swapWorklogRoleRestriction

      public int swapWorklogRoleRestriction(Long roleId, Long swapRoleId)
      Description copied from interface: WorklogStore
      Updates Worklog's such that worklogs that have a visibility restriction of the provided role will be changed to have a visibility restriction to the provided swapRole.

      Note: There is no validation performed by this method to determine if the provided swapRoleId is a valid group with JIRA. This validation must be done by the caller.

      Specified by:
      swapWorklogRoleRestriction in interface WorklogStore
      Parameters:
      roleId - identifies the role the worklogs are restricted by, this must not be null.
      swapRoleId - identifies the role the worklogs will be changed to be restricted by, this must not be null.
      Returns:
      the number of worklogs affected by the update.
    • getWorklogsUpdateSince

      public List<Worklog> getWorklogsUpdateSince(Long sinceInMiliseconds, int maxResults)
      Description copied from interface: WorklogStore
      Returns of worklogs, which were updated or created after (inclusive) provided time in milliseconds. Returned worklogs are ordered by the update time.
      Specified by:
      getWorklogsUpdateSince in interface WorklogStore
      Parameters:
      sinceInMiliseconds - the time (measured as a difference between the timestamp and midnight, January 1, 1970 UTC) since which the modified worklogs will be returned.
      maxResults - the maximum number of worklogs to return.
      Returns:
      the list of worklogs updated after provided time.
    • getWorklogsDeletedSince

      public List<DeletedWorklog> getWorklogsDeletedSince(Long sinceInMilliseconds, int maxResults)
      Description copied from interface: WorklogStore
      Returns WorklogManager.WORKLOG_UPDATE_DATA_PAGE_SIZE of worklog ids and removal dates, which were removed after (inclusive) provided time in milliseconds.
      Specified by:
      getWorklogsDeletedSince in interface WorklogStore
      Parameters:
      sinceInMilliseconds - the time (measured as a difference between the timestamp and midnight, January 1, 1970 UTC) since which the modified worklogs will be returned.
      maxResults - the maximum number of DeletedWorklog to return.
      Returns:
      ids and removal dates of worklogs which were deleted since provided time.
    • getWorklogsForIds

      public Set<Worklog> getWorklogsForIds(Set<Long> worklogIds, int maxResults)
      Description copied from interface: WorklogStore
      Returns a set of worklogs for provided ids.
      Specified by:
      getWorklogsForIds in interface WorklogStore
      Parameters:
      worklogIds - set of worklog ids.
      maxResults - the maximu number of Worklog to return.
      Returns:
      a list of worklogs for provided ids.