Class AbstractRemoteEntityLinkService
java.lang.Object
com.atlassian.jira.entity.remotelink.AbstractRemoteEntityLinkService
- Direct Known Subclasses:
RemoteVersionLinkServiceImpl
Base tools for implementing a remote entity link service that uses the
JsonEntityPropertyManager to store the link data.- Since:
- v6.1.1
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Stringprotected final JsonEntityPropertyManagerprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final String -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractRemoteEntityLinkService(String entityName, JsonEntityPropertyManager jsonEntityPropertyManager) Super-constructor for all remote entity link services that use JSON entity properties for storage. -
Method Summary
Modifier and TypeMethodDescriptionprotected StringgetEntityPropertyValue(Long entityId, String globalId) Retrieve the stored JSON for an entity link.protected StringputEntityPropertyDryRun(Long entityId, String globalId, String json) Verifies the same conditions thatputEntityPropertyValue(Long, String, String)would without actually creating or updating the property value.protected StringputEntityPropertyValue(Long entityId, String globalId, String json) Store JSON data representing an entity link.protected static voidverifyNotBlank(ErrorCollection errors, I18nHelper i18n, String field, String value) protected static voidverifyNotNull(ErrorCollection errors, I18nHelper i18n, String field, Object value)
-
Field Details
-
MSG_IS_REQUIRED
- See Also:
-
MSG_DOES_NOT_EXIST
- See Also:
-
MSG_ERROR_CREATING
- See Also:
-
MSG_ERROR_UPDATING
- See Also:
-
MSG_ERROR_REMOVING
- See Also:
-
MSG_FIELD_TOO_LONG
- See Also:
-
MSG_GLOBAL_ID
- See Also:
-
MSG_TITLE
- See Also:
-
MSG_URL
- See Also:
-
MSG_APPLICATION_TYPE
- See Also:
-
MSG_APPLICATION_NAME
- See Also:
-
MSG_INVALID_JSON
- See Also:
-
MSG_INVALID_URI
- See Also:
-
entityName
-
jsonEntityPropertyManager
-
-
Constructor Details
-
AbstractRemoteEntityLinkService
protected AbstractRemoteEntityLinkService(String entityName, JsonEntityPropertyManager jsonEntityPropertyManager) Super-constructor for all remote entity link services that use JSON entity properties for storage.- Parameters:
entityName- the entity name that should be used when storing the JSON properties for this link service. this MUST be unique to the service. To reduce the risk of collision, it SHOULD NOT be the same as the name of the entity itself. For example,RemoteVersionLinkServiceuses "RemoteVersionLink", not "Version".jsonEntityPropertyManager- the injectedJsonEntityPropertyManagercomponent
-
-
Method Details
-
getEntityPropertyValue
Retrieve the stored JSON for an entity link.- Parameters:
entityId- the ID of the specific entity that this remote entity link was stored againstglobalId- the global ID against which the entity link was stored. See the return value ofputEntityPropertyValue(Long, String, String)for more information.- Returns:
- the stored JSON, or
nullif the remote entity link does not exist
-
putEntityPropertyValue
@Nonnull protected String putEntityPropertyValue(@Nonnull Long entityId, @Nullable String globalId, @Nonnull String json) Store JSON data representing an entity link.- Parameters:
entityId- the ID of the specific entity that this remote entity link will be stored againstglobalId- the global ID against which to store the remote entity link, ornull. If it isnull, then the suppliedjsonvalue is examined to see if it is a valid JSON object with a value specified forRemoteEntityLink.GLOBAL_IDgenerate a new unique identifier to serve as the global IDjson- the content to be stored- Returns:
- the global ID used to store the link. If the supplied JSON is an an object that contains a string field called "globalId" at its top level, then that value will be extracted and used as the global ID for storage. Otherwise, a global ID will be generated by this method and returned in its place.
- Throws:
FieldTooLongJsonPropertyException- ifglobalIdorjsonexceeds the maximum allowed lengthInvalidJsonPropertyException- ifjsonis malformedIllegalArgumentException- ifentityIdorjsonisnull
-
putEntityPropertyDryRun
protected String putEntityPropertyDryRun(@Nonnull Long entityId, @Nullable String globalId, @Nonnull String json) Verifies the same conditions thatputEntityPropertyValue(Long, String, String)would without actually creating or updating the property value. This is intended for use when validating a service request.- Parameters:
entityId- as forputEntityPropertyValue(Long, String, String)globalId- as forputEntityPropertyValue(Long, String, String)json- as forputEntityPropertyValue(Long, String, String)- Returns:
- the global ID that would have been used to store the link. If this method is used to
perform validation, then this value may be passed in as the
globalIdparameter in the following call toputEntityPropertyValue(Long, String, String)to guarantee that the same value will be used even if it is a generated UUID. - Throws:
FieldTooLongJsonPropertyException- ifglobalIdorjsonexceeds the maximum allowed lengthInvalidJsonPropertyException- ifjsonis malformedIllegalArgumentException- ifentityIdorjsonisnull
-
verifyNotNull
protected static void verifyNotNull(ErrorCollection errors, I18nHelper i18n, String field, Object value) -
verifyNotBlank
protected static void verifyNotBlank(ErrorCollection errors, I18nHelper i18n, String field, String value)
-