Class CoreEffects

Object
CoreEffects

@PublicApi public final class CoreEffects extends Object
Produces effect descriptions for common effects provided by Structure.
  • Method Details

    • emitWarning

      @NotNull public static StoredEffect emitWarning(@NotNull I18nText i18nText, @NotNull List<ItemIdentity> itemIdentities)
      Returns a description of an effect that can't be deserialized successfully but used to describe a specific problem.
      Parameters:
      i18nText - The warning message.
      itemIdentities - An ID list of items to which the warning message is related.
      Returns:
      The effect description.
    • assignIssue

      @NotNull public static StoredEffect assignIssue(@NotNull Issue issue, @Nullable ApplicationUser assignee)
      Returns a description of an effect that would assign an issue to the given user. The reverse effect would restore the assignee value that the issue had when the effect was applied. The returned effect would deserialize successfully only if the given user has the permission to the given issue, and the assignee is assignable.
      Parameters:
      issue - The issue.
      assignee - The user to set. Passing null will make the issue unassigned.
      Returns:
      The effect description.
    • setIssueReporter

      @NotNull public static StoredEffect setIssueReporter(@NotNull Issue issue, @Nullable ApplicationUser reporter)
      Returns a description of an effect that would set an issue reporter to the given user. The reverse effect would restore the reporter that the issue had when the effect was applied.
      Parameters:
      issue - The issue.
      reporter - The user to set. Passing null will clear the reporter value.
      Returns:
      The effect description.
    • setIssuePriority

      @NotNull public static StoredEffect setIssuePriority(@NotNull Issue issue, @Nullable Priority priority)
      Returns a description of an effect that would change an issue priority to the given value. The reverse effect would restore the priority that the issue had when the effect was applied.
      Parameters:
      issue - The issue.
      priority - The priority to set. Passing null will clear the priority value.
      Returns:
      the effect description.
    • setIssueDescription

      @NotNull public static StoredEffect setIssueDescription(@NotNull Issue issue, @Nullable String description)
      Returns a description of an effect that would change an issue Description field to the given value. The reverse effect would restore the Description field value that the issue had when the effect was applied.
      Parameters:
      issue - The issue.
      description - The description value to set. Passing null will clear an issue description.
      Returns:
      the effect description.
    • setIssueEnvironment

      @NotNull public static StoredEffect setIssueEnvironment(@NotNull Issue issue, @Nullable String environment)
      Returns a description of an effect that would change an issue Environment field to the given value. The reverse effect would restore the environment that the issue had when the effect was applied.
      Parameters:
      issue - The issue.
      environment - The environment value to set. Passing null will clear the Environment field value.
      Returns:
      the effect description.
    • setIssueResolution

      @NotNull public static StoredEffect setIssueResolution(@NotNull Issue issue, @Nullable Resolution resolution)
      Returns a description of an effect that would change an issue Resolution field to the given value. The reverse effect would restore the resolution that the issue had when the effect was applied.
      Parameters:
      issue - The issue.
      resolution - The resolution to set. Passing null will clear the Resolution field value.
      Returns:
      the effect description.
    • setIssueSummary

      @NotNull public static StoredEffect setIssueSummary(@NotNull Issue issue, @Nullable String summary)
      Returns a description of an effect that would change an issue summary to the given value. The reverse effect would restore the summary that the issue had when the effect was applied.
      Parameters:
      issue - The issue.
      summary - The summary value to set. Passing null will clear the issue summary.
      Returns:
      the effect description.
    • setIssueDueDate

      @NotNull public static StoredEffect setIssueDueDate(@NotNull Issue issue, @Nullable Date date)
      Returns a description of an effect that would change an issue due date to the given value. The reverse effect would restore the due date value that the issue had when the effect was applied.
      Parameters:
      issue - The issue.
      date - The due date to set. Passing null will clear the issue due date.
      Returns:
      the effect description.
    • setIssueResolutionDate

      @NotNull @Deprecated public static StoredEffect setIssueResolutionDate(@NotNull Issue issue, @Nullable Date date)
      Deprecated.
      The "Resolved" field in Jira is not editable, and this method should not be used. There is no corresponding effect provider in Structure.
      Returns a description of an effect that would change an issue resolution date to the given value.
      Parameters:
      issue - The issue.
      date - The resolution date to set. Passing null will clear the issue resolution date.
      Returns:
      the effect description.
    • setIssueStatus

      @NotNull public static StoredEffect setIssueStatus(@NotNull Issue issue, @Nullable Status status)
      Returns a description of an effect that would transition an issue to the given status. The reverse effect would transition the issue to the status it had when the effect was applied. The returned effect would deserialize successfully only if there's exactly one direct transition from the issue's current status to the given status, and that transition has no associated screen.
      Parameters:
      issue - The issue.
      status - The status. Passing null is allowed, but would produce an effect that would always deserialize with an error.
      Returns:
      The effect description.
    • setOriginalEstimate

      @NotNull public static StoredEffect setOriginalEstimate(@NotNull Issue issue, @Nullable Long originalEstimate)
      Returns a description of an effect that would change an issue original estimate to the given value. The reverse effect would restore the original estimate value that the issue had when the effect was applied.
      Parameters:
      issue - The issue.
      originalEstimate - The original estimate to set. Passing null will clear the issue original estimate.
      Returns:
      the effect description.
    • setRemainingEstimate

      @NotNull public static StoredEffect setRemainingEstimate(@NotNull Issue issue, @Nullable Long remainingEstimate)
      Returns a description of an effect that would change an issue remaining estimate to the given value. The reverse effect would restore the remaining estimate value that the issue had when the effect was applied.
      Parameters:
      issue - The issue.
      remainingEstimate - The remaining estimate to set. Passing null will clear the issue remaining estimate.
      Returns:
      the effect description.
    • setSprint

      @NotNull public static StoredEffect setSprint(@NotNull Issue issue, @Nullable Long sprintId)
      Returns a description of an effect that would move an issue to the sprint with the given id. The reverse effect would move the issue back to the sprint that the issue had when the effect was applied. The returned effect would deserialize successfully if the sprint with the given id exists and is not closed.
      Parameters:
      issue - The issue.
      sprintId - The id of the sprint to move issue to. Passing null will remove the issue from its current sprint.
      Returns:
      the effect description.
    • setSingleSelectCustomField

      @NotNull public static StoredEffect setSingleSelectCustomField(@NotNull Issue issue, @NotNull CustomField customField, @Nullable Option value)
      Returns a description of an effect that would set a single select custom field to the given option. The inverse effect would restore the value that the given issue had when the effect was applied.
      Parameters:
      issue - The issue.
      customField - The custom field, must be a single select custom field.
      value - The option to set. Passing null will clear the field value.
      Returns:
      The effect description.
      Throws:
      IllegalArgumentException - if the given custom field is not a single select field.
    • setProjectPickerCustomField

      @NotNull public static StoredEffect setProjectPickerCustomField(@NotNull Issue issue, @NotNull CustomField customField, @Nullable Project value)
      Returns a description of an effect that would set a project picker custom field to the given value. The inverse effect would restore the value that the given issue had when the effect was applied.
      Parameters:
      issue - The issue.
      customField - The custom field, must be a project picker custom field.
      value - The project value to set. Passing null will clear the field value.
      Returns:
      The effect description.
      Throws:
      IllegalArgumentException - if the given custom field is not a project picker field.
    • setSingleUserCustomField

      @NotNull public static StoredEffect setSingleUserCustomField(@NotNull Issue issue, @NotNull CustomField customField, @Nullable ApplicationUser value)
      Returns a description of an effect that would set a single user custom field to the given value. The inverse effect would restore the value that the given issue had when the effect was applied.
      Parameters:
      issue - The issue.
      customField - The custom field, must be a single user custom field.
      value - The user to set. Passing null will clear the field value.
      Returns:
      The effect description.
      Throws:
      IllegalArgumentException - if the given custom field is not a single user field.
    • setSingleVersionCustomField

      @NotNull public static StoredEffect setSingleVersionCustomField(@NotNull Issue issue, @NotNull CustomField customField, @Nullable Version value)
      Returns a description of an effect that would set a single version custom field to the given value. The inverse effect would restore the value that the given issue had when the effect was applied. The returned effect would deserialize successfully only if the given version is not archived and belongs to the same project as the given issue.
      Parameters:
      issue - The issue.
      customField - The custom field, must be a single version custom field.
      value - The version to set. Passing null will clear the field value.
      Returns:
      The effect description.
      Throws:
      IllegalArgumentException - if the given custom field is not a single version field.
    • setTextCustomField

      @NotNull public static StoredEffect setTextCustomField(@NotNull Issue issue, @NotNull CustomField customField, @Nullable String value)
      Returns a description of an effect that would set a text custom field to the given value. The inverse effect would restore the value that the given issue had when the effect was applied.
      Parameters:
      issue - The issue.
      customField - The custom field, must be a text custom field.
      value - The text value to set. Passing null will clear the field value.
      Returns:
      The effect description.
      Throws:
      IllegalArgumentException - if the given custom field is not a text field.
    • setNumberCustomField

      @NotNull public static StoredEffect setNumberCustomField(@NotNull Issue issue, @NotNull CustomField customField, @Nullable Number value)
      Returns a description of an effect that would set a number custom field to the given value. The inverse effect would restore the value that the given issue had when the effect was applied.
      Parameters:
      issue - The issue.
      customField - The custom field, must be a number custom field.
      value - The number value to set. Passing null will clear the field value.
      Returns:
      The effect description.
      Throws:
      IllegalArgumentException - if the given custom field is not a number field.
    • setDateCustomField

      @NotNull public static StoredEffect setDateCustomField(@NotNull Issue issue, @NotNull CustomField customField, @Nullable Date value)
      Returns a description of an effect that would set a date custom field to the given value. The inverse effect would restore the value that the given issue had when the effect was applied.
      Parameters:
      issue - The issue.
      customField - The custom field, must be a date custom field.
      value - The date value to set. Passing null will clear the field value.
      Returns:
      The effect description.
      Throws:
      IllegalArgumentException - if the given custom field is not a date field.
    • setDateTimeCustomField

      @NotNull public static StoredEffect setDateTimeCustomField(@NotNull Issue issue, @NotNull CustomField customField, @Nullable Date value)
      Returns a description of an effect that would set a date time custom field to the given value. The inverse effect would restore the value that the given issue had when the effect was applied.
      Parameters:
      issue - The issue.
      customField - The custom field, must be a date time custom field.
      value - The date time value to set. Passing null will clear the field value.
      Returns:
      The effect description.
      Throws:
      IllegalArgumentException - if the given custom field is not a date time field.
    • setSingleGroupCustomField

      @NotNull public static StoredEffect setSingleGroupCustomField(@NotNull Issue issue, @NotNull CustomField customField, @Nullable Group value)
      Returns a description of an effect that would set a single group custom field to the given value. The inverse effect would restore the value that the given issue had when the effect was applied.
      Parameters:
      issue - The issue.
      customField - The custom field, must be a single group custom field.
      value - The group value to set. Passing null will clear the field value.
      Returns:
      The effect description.
      Throws:
      IllegalArgumentException - if the given custom field is not a single group field.
    • setCascadeCustomField

      @NotNull public static StoredEffect setCascadeCustomField(@NotNull Issue issue, @NotNull CustomField customField, @Nullable Option value)
      Returns a description of an effect that would set a cascading select custom field to the given option. The inverse effect would restore the value that the given issue had when the effect was applied.
      Parameters:
      issue - The issue.
      customField - The custom field, must be a cascading select custom field.
      value - The option to set. Can be a parent or a child option. Passing null will clear the field value.
      Returns:
      The effect description.
      Throws:
      IllegalArgumentException - if the given custom field is not a cascading select field.
    • setIssueLabels

      public static StoredEffect setIssueLabels(Issue issue, Collection<String> labels)
      Returns a description of an effect that would replace issue labels with the given values. The inverse effect would restore the value that the issue labels had when the effect was applied.
      Parameters:
      issue - The issue.
      labels - The labels to set.
      Returns:
      The effect description.
    • addIssueLabels

      public static StoredEffect addIssueLabels(Issue issue, Collection<String> labels)
      Returns a description of an effect that would add labels to the issue. The inverse effect would remove the added labels from the issue.
      Parameters:
      issue - The issue.
      labels - The labels to add.
      Returns:
      The effect description.
    • removeIssueLabels

      public static StoredEffect removeIssueLabels(Issue issue, Collection<String> labels)
      Returns a description of an effect that would remove labels from the issue. The inverse effect would add the removed labels back to the issue.
      Parameters:
      issue - The issue.
      labels - The labels to remove.
      Returns:
      The effect description.
    • setIssueComponents

      @NotNull public static StoredEffect setIssueComponents(@NotNull Issue issue, @NotNull Collection<ProjectComponent> components)
      Returns a description of an effect that would replace issue components with the given values. The inverse effect would restore the value that the issue components had when the effect was applied.
      Parameters:
      issue - The issue.
      components - The components to set.
      Returns:
      The effect description.
    • addIssueComponents

      @NotNull public static StoredEffect addIssueComponents(@NotNull Issue issue, @NotNull Collection<ProjectComponent> components)
      Returns a description of an effect that would add components to the issue. The inverse effect would remove the added components from the issue.
      Parameters:
      issue - The issue.
      components - The components to add.
      Returns:
      The effect description.
    • removeIssueComponents

      @NotNull public static StoredEffect removeIssueComponents(@NotNull Issue issue, @NotNull Collection<ProjectComponent> components)
      Returns a description of an effect that would remove components from the issue. The inverse effect would add the removed components back to the issue.
      Parameters:
      issue - The issue.
      components - The components to remove.
      Returns:
      The effect description.
    • setIssueAffectedVersions

      @NotNull public static StoredEffect setIssueAffectedVersions(@NotNull Issue issue, @NotNull Collection<Version> versions)
      Returns a description of an effect that would replace issue affected versions with the given values. The inverse effect would restore the value that the issue affected versions had when the effect was applied.
      Parameters:
      issue - The issue.
      versions - The versions to set.
      Returns:
      The effect description.
    • addIssueAffectedVersions

      @NotNull public static StoredEffect addIssueAffectedVersions(@NotNull Issue issue, @NotNull Collection<Version> versions)
      Returns a description of an effect that would add affected versions to the issue. The inverse effect would remove the added affected versions from the issue.
      Parameters:
      issue - The issue.
      versions - The versions to add.
      Returns:
      The effect description.
    • removeIssueAffectedVersions

      @NotNull public static StoredEffect removeIssueAffectedVersions(@NotNull Issue issue, @NotNull Collection<Version> versions)
      Returns a description of an effect that would remove affected versions from the issue. The inverse effect would add the removed affected versions back to the issue.
      Parameters:
      issue - The issue.
      versions - The versions to remove.
      Returns:
      The effect description.
    • setIssueFixVersions

      @NotNull public static StoredEffect setIssueFixVersions(@NotNull Issue issue, @NotNull Collection<Version> versions)
      Returns a description of an effect that would replace issue fix versions with the given values. The inverse effect would restore the value that the issue fix versions had when the effect was applied.
      Parameters:
      issue - The issue.
      versions - The versions to set.
      Returns:
      The effect description.
    • addIssueFixVersions

      @NotNull public static StoredEffect addIssueFixVersions(@NotNull Issue issue, @NotNull Collection<Version> versions)
      Returns a description of an effect that would add fix versions to the issue. The inverse effect would remove the added fix versions from the issue.
      Parameters:
      issue - The issue.
      versions - The versions to add.
      Returns:
      The effect description.
    • removeIssueFixVersions

      @NotNull public static StoredEffect removeIssueFixVersions(@NotNull Issue issue, @NotNull Collection<Version> versions)
      Returns a description of an effect that would remove fix versions from the issue. The inverse effect would add the removed fix versions back to the issue.
      Parameters:
      issue - The issue.
      versions - The versions to remove.
      Returns:
      The effect description.
    • setCustomFieldVersions

      @NotNull public static StoredEffect setCustomFieldVersions(@NotNull Issue issue, @NotNull CustomField customField, @NotNull Collection<Version> versions)
      Returns a description of an effect that would set a multi version custom field to the given versions. The inverse effect would restore the value that the given issue had when the effect was applied.
      Parameters:
      issue - The issue.
      customField - The custom field, must be a multi version custom field.
      versions - The versions to set.
      Returns:
      The effect description.
      Throws:
      IllegalArgumentException - if the given custom field is not a multi version field.
    • addCustomFieldVersions

      @NotNull public static StoredEffect addCustomFieldVersions(@NotNull Issue issue, @NotNull CustomField customField, @NotNull Collection<Version> versions)
      Returns a description of an effect that would add the given versions to a multi version custom field. The inverse effect would remove the added versions from the custom field.
      Parameters:
      issue - The issue.
      customField - The custom field, must be a multi version custom field.
      versions - The versions to add.
      Returns:
      The effect description.
      Throws:
      IllegalArgumentException - if the given custom field is not a multi version field.
    • removeCustomFieldVersions

      @NotNull public static StoredEffect removeCustomFieldVersions(@NotNull Issue issue, @NotNull CustomField customField, @NotNull Collection<Version> versions)
      Returns a description of an effect that would remove the given versions from a multi version custom field. The inverse effect would add the removed versions back to the custom field.
      Parameters:
      issue - The issue.
      customField - The custom field, must be a multi version custom field.
      versions - The versions to remove.
      Returns:
      The effect description.
      Throws:
      IllegalArgumentException - if the given custom field is not a multi version field.
    • setCustomFieldOptions

      @NotNull public static StoredEffect setCustomFieldOptions(@NotNull Issue issue, @NotNull CustomField customField, @NotNull Collection<Option> options)
      Returns a description of an effect that would set a multi select custom field to the given options. The inverse effect would restore the value that the given issue had when the effect was applied.
      Parameters:
      issue - The issue.
      customField - The custom field, must be a multi select custom field.
      options - The options to set.
      Returns:
      The effect description.
      Throws:
      IllegalArgumentException - if the given custom field is not a multi select field.
    • addCustomFieldOptions

      @NotNull public static StoredEffect addCustomFieldOptions(@NotNull Issue issue, @NotNull CustomField customField, @NotNull Collection<Option> options)
      Returns a description of an effect that would add the given options to a multi select custom field. The inverse effect would remove the added options from the custom field.
      Parameters:
      issue - The issue.
      customField - The custom field, must be a multi select custom field.
      options - The options to add.
      Returns:
      The effect description.
      Throws:
      IllegalArgumentException - if the given custom field is not a multi select field.
    • removeCustomFieldOptions

      @NotNull public static StoredEffect removeCustomFieldOptions(@NotNull Issue issue, @NotNull CustomField customField, @NotNull Collection<Option> options)
      Returns a description of an effect that would remove the given options from a multi select custom field. The inverse effect would add the removed options back to the custom field.
      Parameters:
      issue - The issue.
      customField - The custom field, must be a multi select custom field.
      options - The options to remove.
      Returns:
      The effect description.
      Throws:
      IllegalArgumentException - if the given custom field is not a multi select field.
    • setCustomFieldUsers

      @NotNull public static StoredEffect setCustomFieldUsers(@NotNull Issue issue, @NotNull CustomField customField, @NotNull Collection<ApplicationUser> users)
      Returns a description of an effect that would set a multi user custom field to the given users. The inverse effect would restore the value that the given issue had when the effect was applied.
      Parameters:
      issue - The issue.
      customField - The custom field, must be a multi user custom field.
      users - The users to set.
      Returns:
      The effect description.
      Throws:
      IllegalArgumentException - if the given custom field is not a multi user field.
    • addCustomFieldUsers

      @NotNull public static StoredEffect addCustomFieldUsers(@NotNull Issue issue, @NotNull CustomField customField, @NotNull Collection<ApplicationUser> users)
      Returns a description of an effect that would add the given users to a multi user custom field. The inverse effect would remove the added users from the custom field.
      Parameters:
      issue - The issue.
      customField - The custom field, must be a multi user custom field.
      users - The users to add.
      Returns:
      The effect description.
      Throws:
      IllegalArgumentException - if the given custom field is not a multi user field.
    • removeCustomFieldUsers

      @NotNull public static StoredEffect removeCustomFieldUsers(@NotNull Issue issue, @NotNull CustomField customField, @NotNull Collection<ApplicationUser> users)
      Returns a description of an effect that would remove the given users from a multi user custom field. The inverse effect would add the removed users back to the custom field.
      Parameters:
      issue - The issue.
      customField - The custom field, must be a multi user custom field.
      users - The users to remove.
      Returns:
      The effect description.
      Throws:
      IllegalArgumentException - if the given custom field is not a multi user field.
    • setCustomFieldGroups

      @NotNull public static StoredEffect setCustomFieldGroups(@NotNull Issue issue, @NotNull CustomField customField, @NotNull Collection<Group> groups)
      Returns a description of an effect that would set a multi group custom field to the given groups. The inverse effect would restore the value that the given issue had when the effect was applied.
      Parameters:
      issue - The issue.
      customField - The custom field, must be a multi group custom field.
      groups - The groups to set.
      Returns:
      The effect description.
      Throws:
      IllegalArgumentException - if the given custom field is not a multi group field.
    • addCustomFieldGroups

      @NotNull public static StoredEffect addCustomFieldGroups(@NotNull Issue issue, @NotNull CustomField customField, @NotNull Collection<Group> groups)
      Returns a description of an effect that would add the given groups to a multi group custom field. The inverse effect would remove the added groups from the custom field.
      Parameters:
      issue - The issue.
      customField - The custom field, must be a multi group custom field.
      groups - The groups to add.
      Returns:
      The effect description.
      Throws:
      IllegalArgumentException - if the given custom field is not a multi group field.
    • removeCustomFieldGroups

      @NotNull public static StoredEffect removeCustomFieldGroups(@NotNull Issue issue, @NotNull CustomField customField, @NotNull Collection<Group> groups)
      Returns a description of an effect that would remove the given groups from a multi group custom field. The inverse effect would add the removed groups back to the custom field.
      Parameters:
      issue - The issue.
      customField - The custom field, must be a multi group custom field.
      groups - The groups to remove.
      Returns:
      The effect description.
      Throws:
      IllegalArgumentException - if the given custom field is not a multi group field.
    • setCustomFieldLabels

      @NotNull public static StoredEffect setCustomFieldLabels(@NotNull Issue issue, @NotNull CustomField customField, @NotNull Collection<String> labels)
      Returns a description of an effect that would set a labels custom field to the given labels. The inverse effect would restore the value that the given issue had when the effect was applied.
      Parameters:
      issue - The issue.
      customField - The custom field, must be a labels custom field.
      labels - The labels to set.
      Returns:
      The effect description.
      Throws:
      IllegalArgumentException - if the given custom field is not a labels field.
    • addCustomFieldLabels

      @NotNull public static StoredEffect addCustomFieldLabels(@NotNull Issue issue, @NotNull CustomField customField, @NotNull Collection<String> labels)
      Returns a description of an effect that would add the given labels to a labels custom field. The inverse effect would remove the added labels from the custom field.
      Parameters:
      issue - The issue.
      customField - The custom field, must be a labels custom field.
      labels - The labels to add.
      Returns:
      The effect description.
      Throws:
      IllegalArgumentException - if the given custom field is not a labels field.
    • removeCustomFieldLabels

      @NotNull public static StoredEffect removeCustomFieldLabels(@NotNull Issue issue, @NotNull CustomField customField, @NotNull Collection<String> labels)
      Returns a description of an effect that would remove the given labels from a labels custom field. The inverse effect would add the removed labels back to the custom field.
      Parameters:
      issue - The issue.
      customField - The custom field, must be a labels custom field.
      labels - The labels to remove.
      Returns:
      The effect description.
      Throws:
      IllegalArgumentException - if the given custom field is not a labels field.
    • addIssueComment

      @NotNull public static StoredEffect addIssueComment(@NotNull Issue issue, @Nullable String commentBody)
      Returns a description of an effect that would add a comment. The inverse effect would delete added comment.
      Parameters:
      issue - The issue.
      commentBody - The comment body.
      Returns:
      The effect description.
    • deleteIssueComment

      @NotNull public static StoredEffect deleteIssueComment(@NotNull Issue issue, @NotNull Comment comment)
      Returns a description of an effect that would delete a comment. The inverse effect would add the deleted comment.
      Parameters:
      issue - The issue.
      comment - The comment to be deleted.
      Returns:
      The effect description.