public interface

LabelService

com.atlassian.bitbucket.label.LabelService

Class Overview

Describes a service for interacting with labels.

Summary

Public Methods
@Nonnull Label apply(ApplyLabelRequest request)
Add a Label to a Labelable.
@Nonnull Label create(String labelName)
Creates a new label based on the given labelName.
@Nonnull Page<Label> findAll(PageRequest pageRequest)
Retrieves a Page of Label for all the labels in the system.
@Nonnull Page<Label> findByLabelable(Labelable labelable, PageRequest pageRequest)
returns a Page of labels related to this Labelable
@Nonnull Optional<Label> findByName(String labelName)
Returns an Optional containing a Label based on the name.
@Nonnull Page<Label> findByPrefix(String labelPref, PageRequest pageRequest)
returns a Page of labels based on a prefix.
@Nonnull Label getByName(String labelName)
Returns a Label based on the name.
void remove(RemoveLabelRequest request)
Removes a Label from a Labelable.
@Nonnull Page<Labelable> searchLabelables(LabelableSearchRequest searchRequest, PageRequest pageRequest)
Returns Page of labelables for a given LabelableSearchRequest.

Public Methods

@Nonnull public Label apply (ApplyLabelRequest request)

Add a Label to a Labelable.

Parameters
request request containing the Label and Labelable
Returns
  • the Label that was added.

@Nonnull public Label create (String labelName)

Creates a new label based on the given labelName.

The labelName has to be at least 3 characters and cannot exceed 50 characters, the labelName also has to be a lowercase string consisting out of alpanumeric characters, "-" is also allowed.

Parameters
labelName the name for the newly created label.
Returns

@Nonnull public Page<Label> findAll (PageRequest pageRequest)

Retrieves a Page of Label for all the labels in the system.

Parameters
pageRequest the PageRequest
Returns

@Nonnull public Page<Label> findByLabelable (Labelable labelable, PageRequest pageRequest)

returns a Page of labels related to this Labelable

Parameters
labelable the Labelable that will have it's related labels returned
pageRequest the PageRequest
Returns

@Nonnull public Optional<Label> findByName (String labelName)

Returns an Optional containing a Label based on the name.

Parameters
labelName name of the Label
Returns
  • Optional containing a Label

@Nonnull public Page<Label> findByPrefix (String labelPref, PageRequest pageRequest)

returns a Page of labels based on a prefix.

Parameters
labelPref the prefix the labels have to start with
pageRequest the PageRequest
Returns

@Nonnull public Label getByName (String labelName)

Returns a Label based on the name.

Parameters
labelName name of the Label
Returns

public void remove (RemoveLabelRequest request)

Removes a Label from a Labelable.

Parameters
request request containing the Label and Labelable

@Nonnull public Page<Labelable> searchLabelables (LabelableSearchRequest searchRequest, PageRequest pageRequest)

Returns Page of labelables for a given LabelableSearchRequest.

Parameters
searchRequest a LabelableSearchRequest
pageRequest the PageRequest
Returns