Package com.atlassian.jira.project.type
Interface ProjectTypeUpdatedHandler
@PublicSpi
public interface ProjectTypeUpdatedHandler
Interface to be implemented by clients who wish to be notified once the project type of a project has been updated.
Implementations of this class need to be registered through ProjectTypeUpdatedRegistrar.register(ProjectTypeUpdatedHandler)
for the notifications to be triggered.
- Since:
- 7.0
-
Method Summary
Modifier and TypeMethodDescriptionReturns a unique identifier for the handler.onProjectTypeUpdated
(ApplicationUser user, Project project, ProjectTypeKey oldProjectTypeKey, ProjectTypeKey newProjectTypeKey) Method called every time the type of a project is updated.void
onProjectTypeUpdateRolledBack
(ApplicationUser user, Project project, ProjectTypeKey oldProjectTypeKey, ProjectTypeKey newProjectTypeKey, ProjectTypeUpdatedOutcome outcome) This method will only be called if the update to the project type is rolled back.
-
Method Details
-
getHandlerId
String getHandlerId()Returns a unique identifier for the handler.- Returns:
- A unique identifier for the handler.
-
onProjectTypeUpdated
ProjectTypeUpdatedOutcome onProjectTypeUpdated(ApplicationUser user, Project project, ProjectTypeKey oldProjectTypeKey, ProjectTypeKey newProjectTypeKey) Method called every time the type of a project is updated. This gives the opportunity for plugins to execute some logic once the project type has been updated. If this method returns failure, then the update will be vetoed. All other handlers that have already been called will now have their onProjectTypeUpdateRolledBack() methods called.- Parameters:
user
- The user performing the update.project
- The project for which the type has been updated.oldProjectTypeKey
- The old project type key.newProjectTypeKey
- The new project type key.- Returns:
- a
ProjectTypeUpdatedOutcome
indicating whether the operation succeeded or failed .
-
onProjectTypeUpdateRolledBack
void onProjectTypeUpdateRolledBack(ApplicationUser user, Project project, ProjectTypeKey oldProjectTypeKey, ProjectTypeKey newProjectTypeKey, ProjectTypeUpdatedOutcome outcome) This method will only be called if the update to the project type is rolled back.That could happen if one of the
ProjectTypeUpdatedHandler
returns an error on#projectTypeUpdated(Project, ProjectType, ProjectType)
.On this method, the handler should undo all of the changes made by it when
#projectTypeUpdated(Project, ProjectType, ProjectType)
was called. The parameters passed to this method will be exactly the same as the ones when#projectTypeUpdated(Project, ProjectType, ProjectType)
was called, with the addition of theProjectTypeUpdatedOutcome
returned from that call.- Parameters:
user
- The user performing the update.project
- The project type for which the project type was updated.oldProjectTypeKey
- The old project type key.newProjectTypeKey
- The new project type key.outcome
- theProjectTypeUpdatedOutcome
returned from the update operation.
-