Class CustomFieldBulkDeleteManager

java.lang.Object
com.atlassian.jira.issue.managers.CustomFieldBulkDeleteManager

public class CustomFieldBulkDeleteManager extends Object
Validates the DELETE request sent to @CustomFieldResource for custom fields' single and bulk deletion. Checks if the custom fields can be deleted and either deletes them or provides information why they cannot be deleted. since 8.16
  • Field Details

    • MAX_NUMBER_OF_CUSTOM_FIELDS_TO_DELETE

      public static final int MAX_NUMBER_OF_CUSTOM_FIELDS_TO_DELETE
      See Also:
    • BULK_DELETE_FEATURE_FLAG

      public static final String BULK_DELETE_FEATURE_FLAG
    • BULK_DELETE_LOCK_NAME

      public static final String BULK_DELETE_LOCK_NAME
    • LOCK_NOT_ACQUIRED_MESSAGE

      public static final String LOCK_NOT_ACQUIRED_MESSAGE
      See Also:
    • VALIDATION_FOR_CUSTOM_FIELD_DELETION_FAILED_MESSAGE

      public static final String VALIDATION_FOR_CUSTOM_FIELD_DELETION_FAILED_MESSAGE
      See Also:
  • Constructor Details

  • Method Details

    • isDCAndFeatureFlagOn

      public boolean isDCAndFeatureFlagOn()
      Feature is available since 8.16 for DC instances and can be turned off with jira.customfields.bulk.delete flag.
      Returns:
      true if instance is DC and feature flag is on, false otherwise
    • validateNumberOfArguments

      public boolean validateNumberOfArguments(List<String> customFields)
      We allow a maximum of 50 custom fields in delete request as this is the number of custom fields per page on custom field view.
      Parameters:
      customFields - list of custom fields selected for deletion
      Returns:
      true if customFields is a list with at least 1 and no more than 50 values, false otherwise
    • validateAndDeleteCustomFields

      public Map<String,String> validateAndDeleteCustomFields(JiraAuthenticationContext jiraAuthenticationContext, List<String> customFieldsIds, Long bulkOperationStartTime)
      For each custom field in the list validates if the custom field can be deleted. If the validation passes the custom field is deleted. If the validation fails we provide the information about why the custom field cannot be deleted.
      Parameters:
      jiraAuthenticationContext - context
      customFieldsIds - ids of custom fields to be deleted
      bulkOperationStartTime - timestamp of when the bulk delete request was sent (for analytics events' purpose)
      Returns:
      a map of custom fields that were not deleted, where the key is custom field's id and the value the reason for failed validation
    • onLicenseChanged

      @EventListener public void onLicenseChanged(LicenseChangedEvent event)