Class AbstractRemoteEntityLinkResource<S,T extends RemoteEntityLink<S>>
java.lang.Object
com.atlassian.jira.rest.v2.entity.AbstractRemoteEntityLinkResource<S,T>
- Type Parameters:
S- the target entity (likeVersion)T- the entity link type (likeRemoteVersionLink)
- Direct Known Subclasses:
RemoteVersionLinkResource
public abstract class AbstractRemoteEntityLinkResource<S,T extends RemoteEntityLink<S>>
extends Object
Common toolkit for implementing remote entity link services.
- Since:
- Jira REST v6.5.1 (in Jira 6.1.1)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final jakarta.ws.rs.core.UriInfoprotected final I18nHelperprotected final JiraAuthenticationContextprotected final JsonEntityPropertyManager -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractRemoteEntityLinkResource(I18nHelper i18n, JiraAuthenticationContext jiraAuthenticationContext, JsonEntityPropertyManager jsonEntityPropertyManager, jakarta.ws.rs.core.UriInfo contextUriInfo) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract URIcreateSelfLink(T link) Forms theselfURI for a link.protected ApplicationUsergetUser()Returns the currently logged in user.protected RemoteEntityLinksJsonBeantoBean(Collection<? extends T> links) Creates a list of JSON beans for the provided remote entity links.protected RemoteEntityLinkJsonBeanCreates a JSON bean for the provided remote entity link.protected jakarta.ws.rs.core.ResponsetoResponse(Object entity) Turns a bean into an normal response object.protected jakarta.ws.rs.core.ResponsetoResponse(Collection<? extends T> links) Responds with a list of remote entity links.protected jakarta.ws.rs.core.ResponsetoResponse(T link) Responds with a single remote entity link.protected jakarta.ws.rs.core.ResponseForms a204response with no content to acknowledge the successful deletion.protected jakarta.ws.rs.core.ResponsetoSuccessfulPostResponse(T link) Forms a201response with aLocation:header pointing tolink's self URI.protected <T extends ServiceResult>
Tvalid(T result) Verifies that the provided service result is error-free.
-
Field Details
-
i18n
-
jiraAuthenticationContext
-
jsonEntityPropertyManager
-
contextUriInfo
protected final jakarta.ws.rs.core.UriInfo contextUriInfo
-
-
Constructor Details
-
AbstractRemoteEntityLinkResource
protected AbstractRemoteEntityLinkResource(I18nHelper i18n, JiraAuthenticationContext jiraAuthenticationContext, JsonEntityPropertyManager jsonEntityPropertyManager, jakarta.ws.rs.core.UriInfo contextUriInfo)
-
-
Method Details
-
toBean
Creates a JSON bean for the provided remote entity link.- Parameters:
link- the remote entity link to be written out- Returns:
- the corresponding bean
-
toBean
Creates a list of JSON beans for the provided remote entity links.- Parameters:
links- the remote entity links to be written out- Returns:
- the corresponding bean
-
toResponse
Responds with a single remote entity link. This convenience method is equivalent totoResponse(toBean(link)).- Parameters:
link- the remote entity link to write- Returns:
- a response containing the link
-
toResponse
Responds with a list of remote entity links. This convenience method is equivalent totoResponse(toBean(links)).- Parameters:
links- the remote entity links to be written out- Returns:
- the response containing the links
-
toResponse
Turns a bean into an normal response object.- Parameters:
entity- the object to respond with- Returns:
- the response
-
toSuccessfulPostResponse
Forms a201response with aLocation:header pointing tolink's self URI.- Parameters:
link- the newly created link- Returns:
- the successful response
-
toSuccessfulDeleteResponse
protected jakarta.ws.rs.core.Response toSuccessfulDeleteResponse()Forms a204response with no content to acknowledge the successful deletion.- Returns:
- the successful response
-
createSelfLink
Forms theselfURI for a link.- Parameters:
link- the link to be rendered as a URI- Returns:
- the self URI for the link
-
valid
Verifies that the provided service result is error-free. If it is invalid, then we throw the appropriateRESTExceptioncontaining the error collection instead of returning the result.- Type Parameters:
T- the inferred service result class- Parameters:
result- the service result to validate- Returns:
resultitself
-
getUser
Returns the currently logged in user.- Returns:
- the currently logged in user.
-