Class RemoteVersionLinkServiceImpl
java.lang.Object
com.atlassian.jira.entity.remotelink.AbstractRemoteEntityLinkService
com.atlassian.jira.bc.project.version.remotelink.RemoteVersionLinkServiceImpl
- All Implemented Interfaces:
RemoteVersionLinkService
public class RemoteVersionLinkServiceImpl
extends AbstractRemoteEntityLinkService
implements RemoteVersionLinkService
- Since:
- v6.1.1
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.atlassian.jira.bc.project.version.remotelink.RemoteVersionLinkService
RemoteVersionLinkService.DeleteValidationResult, RemoteVersionLinkService.PutValidationResult, RemoteVersionLinkService.RemoteVersionLinkListResult, RemoteVersionLinkService.RemoteVersionLinkResult
-
Field Summary
FieldsFields inherited from class com.atlassian.jira.entity.remotelink.AbstractRemoteEntityLinkService
entityName, jsonEntityPropertyManager, MSG_APPLICATION_NAME, MSG_APPLICATION_TYPE, MSG_DOES_NOT_EXIST, MSG_ERROR_CREATING, MSG_ERROR_REMOVING, MSG_ERROR_UPDATING, MSG_FIELD_TOO_LONG, MSG_GLOBAL_ID, MSG_INVALID_JSON, MSG_INVALID_URI, MSG_IS_REQUIRED, MSG_TITLE, MSG_URL
-
Constructor Summary
ConstructorsConstructorDescriptionRemoteVersionLinkServiceImpl
(JsonEntityPropertyManager jsonEntityPropertyManager, PermissionManager permissionManager, VersionManager versionManager, com.atlassian.event.api.EventPublisher eventPublisher, I18nHelper.BeanFactory i18nFactory) -
Method Summary
Modifier and TypeMethodDescriptionvoid
delete
(ApplicationUser user, RemoteVersionLinkService.DeleteValidationResult deleteValidationResult) Deletes the remote version link that links with the given JIRA version and has the given global id, if the current user has permission to do so.getRemoteVersionLinkByVersionIdAndGlobalId
(ApplicationUser user, Long versionId, String globalId) Retrieves the remote version link that links with the given JIRA version and has the given globalId.getRemoteVersionLinkCountByGlobalId
(String globalId) Retrieves the count of remote version links that are associated with the given remote resource.getRemoteVersionLinksByGlobalId
(ApplicationUser user, String globalId) Retrieves the remote version links that are associated with the given remote resource.getRemoteVersionLinksByVersionId
(ApplicationUser user, Long versionId) Retrieves all of the remote version links that link with the given JIRA version.void
put
(ApplicationUser user, RemoteVersionLinkService.PutValidationResult putValidationResult) Creates a remote version link using the validated request returned by a prior call toRemoteVersionLinkService.validatePut(ApplicationUser, Long, String, String)
validateDelete
(ApplicationUser user, Long versionId, String globalId) Validates parameters and checks permissions, and if all checks pass it will create aRemoteVersionLinkService.DeleteValidationResult
that can be passed to theRemoteVersionLinkService.delete(ApplicationUser, DeleteValidationResult)
method to delete the specified remote version link.validateDeleteByVersionId
(ApplicationUser user, Long versionId) Validates parameters and checks permissions, and if all checks pass it will create aRemoteVersionLinkService.DeleteValidationResult
that can be passed to theRemoteVersionLinkService.delete(ApplicationUser, DeleteValidationResult)
method to delete all remote version links for the specified version.validatePut
(ApplicationUser user, Long versionId, String globalId, String json) Validates parameters and checks permissions, and if all checks pass it will create aRemoteVersionLinkService.PutValidationResult
that can be passed to theRemoteVersionLinkService.put(ApplicationUser, PutValidationResult)
method.Methods inherited from class com.atlassian.jira.entity.remotelink.AbstractRemoteEntityLinkService
getEntityPropertyValue, putEntityPropertyDryRun, putEntityPropertyValue, verifyNotBlank, verifyNotNull
-
Field Details
-
REMOTE_VERSION_LINK
Entity name- See Also:
-
-
Constructor Details
-
RemoteVersionLinkServiceImpl
public RemoteVersionLinkServiceImpl(JsonEntityPropertyManager jsonEntityPropertyManager, PermissionManager permissionManager, VersionManager versionManager, com.atlassian.event.api.EventPublisher eventPublisher, I18nHelper.BeanFactory i18nFactory)
-
-
Method Details
-
getRemoteVersionLinksByVersionId
public RemoteVersionLinkService.RemoteVersionLinkListResult getRemoteVersionLinksByVersionId(ApplicationUser user, Long versionId) Description copied from interface:RemoteVersionLinkService
Retrieves all of the remote version links that link with the given JIRA version.- Specified by:
getRemoteVersionLinksByVersionId
in interfaceRemoteVersionLinkService
- Parameters:
user
- user who the permission checks will be run against (may benull
, indicating an anonymous user).versionId
- the ID of the version to get the remote version links for- Returns:
- a result object containing a
List
ofRemoteVersionLink
s if all went well. If no remote version links are stored against the version, then the list will be empty. If there was an error, the remote version links list will benull
and the error collection will contain details of what went wrong. Some possible error cases include the given version not existing, or the user not havingPermissions.BROWSE
permission for the version's project.
-
getRemoteVersionLinksByGlobalId
public RemoteVersionLinkService.RemoteVersionLinkListResult getRemoteVersionLinksByGlobalId(ApplicationUser user, String globalId) Description copied from interface:RemoteVersionLinkService
Retrieves the remote version links that are associated with the given remote resource.- Specified by:
getRemoteVersionLinksByGlobalId
in interfaceRemoteVersionLinkService
- Parameters:
user
- user who the permission checks will be run against (may benull
, indicating an anonymous user).globalId
- the globalId to get the remote version links for- Returns:
- a result object containing a
List
ofRemoteVersionLink
s if all went well. If no remote version links are stored against the global ID, then the list will be empty. If there was an error, the remote version links list will benull
and the error collection will contain details of what went wrong.
-
getRemoteVersionLinkCountByGlobalId
Description copied from interface:RemoteVersionLinkService
Retrieves the count of remote version links that are associated with the given remote resource. This method does not perform a permission check.- Specified by:
getRemoteVersionLinkCountByGlobalId
in interfaceRemoteVersionLinkService
- Parameters:
globalId
- the globalId to get the remote version links for- Returns:
- The count of
RemoteVersionLink
s associated with the given remote resource global id.
-
getRemoteVersionLinkByVersionIdAndGlobalId
public RemoteVersionLinkService.RemoteVersionLinkResult getRemoteVersionLinkByVersionIdAndGlobalId(ApplicationUser user, Long versionId, String globalId) Description copied from interface:RemoteVersionLinkService
Retrieves the remote version link that links with the given JIRA version and has the given globalId.- Specified by:
getRemoteVersionLinkByVersionIdAndGlobalId
in interfaceRemoteVersionLinkService
- Parameters:
user
- user who the permission checks will be run against (may benull
, indicating an anonymous user).versionId
- the ID of the version to get the remote version link forglobalId
- the globalId to get the remote version link for- Returns:
- a result object containing a
RemoteVersionLink
if all went well. If there was an error the remote version link will benull
and the error collection will contain details of what went wrong. Some possible error cases include a remote version link with the givenglobalId
not existing or the user not havingPermissions.BROWSE
permission for the version's project.
-
validatePut
public RemoteVersionLinkService.PutValidationResult validatePut(ApplicationUser user, Long versionId, String globalId, String json) Description copied from interface:RemoteVersionLinkService
Validates parameters and checks permissions, and if all checks pass it will create aRemoteVersionLinkService.PutValidationResult
that can be passed to theRemoteVersionLinkService.put(ApplicationUser, PutValidationResult)
method.If any validation fails the result will contain a
null
String
.- Specified by:
validatePut
in interfaceRemoteVersionLinkService
- Parameters:
user
- user who the permission checks will be run against (may benull
, indicating an anonymous user).versionId
- the ID of the version for which to create/update this remote version linkglobalId
- the global id to associate with the remote version link. If this isnull
, then the JSON value will be checked for a field withRemoteEntityLink.GLOBAL_ID
as the key. If that does not exist, then a new global ID is generated. After a successful call toRemoteVersionLinkService.put(ApplicationUser, PutValidationResult)
, theRemoteVersionLinkService.RemoteVersionLinkResult
that it returns can be used to obtain the newly createdRemoteVersionLink
json
- the JSON representation of the remote version link- Returns:
- a
RemoteVersionLinkService.PutValidationResult
. If all validation and permission checks pass, then it will contain the information required to create the link; otherwise, the result will contain an error collection with any error messages that may have been generated when performing the operation.
-
put
public RemoteVersionLinkService.RemoteVersionLinkResult put(ApplicationUser user, RemoteVersionLinkService.PutValidationResult putValidationResult) Description copied from interface:RemoteVersionLinkService
Creates a remote version link using the validated request returned by a prior call toRemoteVersionLinkService.validatePut(ApplicationUser, Long, String, String)
- Specified by:
put
in interfaceRemoteVersionLinkService
- Parameters:
user
- user who the permission checks will be run against (may benull
, indicating an anonymous user).putValidationResult
- contains the remote version link to store. This should have been created by theRemoteVersionLinkService.validatePut(ApplicationUser, Long, String, String)
method. The result must bevalid
.- Returns:
- a result object containing the persisted
String
if all went well. If there was an error creating the remote version link then the remote version link will benull
and the error collection will contain details of what went wrong.
-
validateDelete
public RemoteVersionLinkService.DeleteValidationResult validateDelete(ApplicationUser user, Long versionId, String globalId) Description copied from interface:RemoteVersionLinkService
Validates parameters and checks permissions, and if all checks pass it will create aRemoteVersionLinkService.DeleteValidationResult
that can be passed to theRemoteVersionLinkService.delete(ApplicationUser, DeleteValidationResult)
method to delete the specified remote version link.- Specified by:
validateDelete
in interfaceRemoteVersionLinkService
- Parameters:
user
- who the permission checks will be run against (can be null, indicating an anonymous user).versionId
- the ID of the version associated with the remote version link to be deletedglobalId
- the global id associated with the remote version link to be deleted- Returns:
- a DeleteValidationResult, if all validation and permission passes it will contain the information relevant to the deletion; otherwise, the error collection will contain the errors generated during validation.
-
validateDeleteByVersionId
public RemoteVersionLinkService.DeleteValidationResult validateDeleteByVersionId(ApplicationUser user, Long versionId) Description copied from interface:RemoteVersionLinkService
Validates parameters and checks permissions, and if all checks pass it will create aRemoteVersionLinkService.DeleteValidationResult
that can be passed to theRemoteVersionLinkService.delete(ApplicationUser, DeleteValidationResult)
method to delete all remote version links for the specified version.- Specified by:
validateDeleteByVersionId
in interfaceRemoteVersionLinkService
- Parameters:
user
- who the permission checks will be run against (can be null, indicating an anonymous user).versionId
- the version associated with the remote version links to be deleted- Returns:
- a DeleteValidationResult, if all validation and permission passes it will contain the information relevant to the deletion; otherwise, the error collection will contain the errors generated during validation.
-
delete
public void delete(ApplicationUser user, RemoteVersionLinkService.DeleteValidationResult deleteValidationResult) Description copied from interface:RemoteVersionLinkService
Deletes the remote version link that links with the given JIRA version and has the given global id, if the current user has permission to do so.- Specified by:
delete
in interfaceRemoteVersionLinkService
- Parameters:
user
- user user who the permission checks will be run against (can be null, indicating an anonymous user).deleteValidationResult
- contains the remote version link id to delete. This should have been created by one of thevalidateDeleteBy...
methods. The result must bevalid
.
-
onVersionDeleted
-