public interface

InsightAnnotationDao

com.atlassian.bitbucket.internal.codeinsights.dao.InsightAnnotationDao
Known Indirect Subclasses

Summary

Public Methods
int countForCommit(int repositoryId, String commitId)
Count the number of annotations stored for the commit.
int countForReport(long id)
Count the number of annotations stored for the report.
void create(long reportId, String externalId, int line, String link, String message, String path, AnnotationSeverity severity, AnnotationType type)
Create a new annotation.
boolean delete(long id)
Delete an annotation by its ID.
int deleteByReportAndExternalIds(long reportId, Collection<String> externalIds)
Delete all the annotations for the provided reportId filtering by externalIds if any is provided.
int deleteForReport(Long... reportId)
Delete annotations for the reportId given.
@Nonnull Optional<InternalInsightAnnotation> getByExternalId(long reportId, String externalId)
Return the annotation identified by the given reportId and externalID.
boolean hasAnnotations(long reportID, Collection<String> externalIds)
Checks the external ids are unique.
@Nonnull Page<InternalInsightAnnotation> search(int repositoryId, String commitId, Collection<String> reportKeys, Collection<String> externalIds, Collection<ModifiedFile> modifiedFiles, Collection<AnnotationSeverity> severities, Collection<AnnotationType> types, PageRequest pageRequest)
Search for annotations matching the given fields.

Public Methods

public int countForCommit (int repositoryId, String commitId)

Count the number of annotations stored for the commit.

Parameters
repositoryId id of repository the commit is in
commitId commit id to count annotations for
Returns
  • the number of annotations stored for the given commit

public int countForReport (long id)

Count the number of annotations stored for the report.

Parameters
id id of report to count for
Returns
  • the number of annotations stored

public void create (long reportId, String externalId, int line, String link, String message, String path, AnnotationSeverity severity, AnnotationType type)

Create a new annotation.

Parameters
reportId the ID of the report the annotation should be associated with
externalId the external ID for the report
line the line number on which this annotation is anchored
link a link to associate with the annotation
message the annotation's message
path a path to the file on which the annotation is anchored
severity the AnnotationSeverity severity of the annotation
type the AnnotationType type of annotation

public boolean delete (long id)

Delete an annotation by its ID.

Returns
  • whether the report was deleted (false if the report was not found)

public int deleteByReportAndExternalIds (long reportId, Collection<String> externalIds)

Delete all the annotations for the provided reportId filtering by externalIds if any is provided.

Parameters
reportId the ID for the report to use when selecting annotations to delete
externalIds if any are provided only annotations matching those external IDs will be deleted. Otherwise all annotations for the given report will be deleted
Returns
  • the number of annotations that were deleted

public int deleteForReport (Long... reportId)

Delete annotations for the reportId given.

Parameters
reportId id of the report to delete annotations for
Returns
  • number of annotations deleted

@Nonnull public Optional<InternalInsightAnnotation> getByExternalId (long reportId, String externalId)

Return the annotation identified by the given reportId and externalID.

Parameters
reportId the getID() to which this annotation belongs
externalId the getExternalId() identifying the annotation
Returns
  • the requested annotation, or empty if it doesn't exist

public boolean hasAnnotations (long reportID, Collection<String> externalIds)

Checks the external ids are unique. If any annotation has an external id in the list this will return true, but will not say which id already exists, or even if more than one id exists.

Parameters
reportID report to check for
externalIds external ids to check
Returns
  • true if at least one annotation already exists with one of the ids for the given report, false otherwise. Will also return false if the report does not exist

@Nonnull public Page<InternalInsightAnnotation> search (int repositoryId, String commitId, Collection<String> reportKeys, Collection<String> externalIds, Collection<ModifiedFile> modifiedFiles, Collection<AnnotationSeverity> severities, Collection<AnnotationType> types, PageRequest pageRequest)

Search for annotations matching the given fields. Values in each field is ORed together and the fields are ANDed together.

Parameters
repositoryId Only return annotations from this repository
commitId Only return annotations for this commit
reportKeys Only return annotations that belong to one of the given reports
externalIds Only return annotations that belong to one of the given external IDs
modifiedFiles Only return annotations that belong to one of the given paths and lines (if included)
severities Only return annotations that have one of the given severities
types Only return annotations that have one of the given types
pageRequest page request
Returns
  • page of annotations