@ExperimentalApi public abstract class AbstractRemoteEntityLinkService extends Object
JsonEntityPropertyManager
to store the link data.Modifier and Type | Field and Description |
---|---|
protected String |
entityName |
protected JsonEntityPropertyManager |
jsonEntityPropertyManager |
protected static String |
MSG_APPLICATION_NAME |
protected static String |
MSG_APPLICATION_TYPE |
protected static String |
MSG_DOES_NOT_EXIST |
protected static String |
MSG_ERROR_CREATING |
protected static String |
MSG_ERROR_REMOVING |
protected static String |
MSG_ERROR_UPDATING |
protected static String |
MSG_FIELD_TOO_LONG |
protected static String |
MSG_GLOBAL_ID |
protected static String |
MSG_INVALID_JSON |
protected static String |
MSG_INVALID_URI |
protected static String |
MSG_IS_REQUIRED |
protected static String |
MSG_TITLE |
protected static String |
MSG_URL |
Modifier | Constructor and Description |
---|---|
protected |
AbstractRemoteEntityLinkService(String entityName,
JsonEntityPropertyManager jsonEntityPropertyManager)
Super-constructor for all remote entity link services that use JSON entity properties for storage.
|
Modifier and Type | Method and Description |
---|---|
protected String |
getEntityPropertyValue(Long entityId,
String globalId)
Retrieve the stored JSON for an entity link.
|
protected String |
putEntityPropertyDryRun(Long entityId,
String globalId,
String json)
Verifies the same conditions that
putEntityPropertyValue(Long, String, String) would without actually
creating or updating the property value. |
protected String |
putEntityPropertyValue(Long entityId,
String globalId,
String json)
Store JSON data representing an entity link.
|
protected static void |
verifyNotBlank(ErrorCollection errors,
I18nHelper i18n,
String field,
String value) |
protected static void |
verifyNotNull(ErrorCollection errors,
I18nHelper i18n,
String field,
Object value) |
protected static final String MSG_IS_REQUIRED
protected static final String MSG_DOES_NOT_EXIST
protected static final String MSG_ERROR_CREATING
protected static final String MSG_ERROR_UPDATING
protected static final String MSG_ERROR_REMOVING
protected static final String MSG_FIELD_TOO_LONG
protected static final String MSG_GLOBAL_ID
protected static final String MSG_TITLE
protected static final String MSG_URL
protected static final String MSG_APPLICATION_TYPE
protected static final String MSG_APPLICATION_NAME
protected static final String MSG_INVALID_JSON
protected static final String MSG_INVALID_URI
protected final String entityName
protected final JsonEntityPropertyManager jsonEntityPropertyManager
protected AbstractRemoteEntityLinkService(String entityName, JsonEntityPropertyManager jsonEntityPropertyManager)
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,
RemoteVersionLinkService
uses "RemoteVersionLink", not "Version".jsonEntityPropertyManager
- the injected JsonEntityPropertyManager
component@Nullable protected String getEntityPropertyValue(@Nonnull Long entityId, @Nonnull String globalId)
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 of
putEntityPropertyValue(Long, String, String)
for more information.null
if the remote entity link does not exist@Nonnull protected String putEntityPropertyValue(@Nonnull Long entityId, @Nullable String globalId, @Nonnull String json)
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, or null
. If
it is null
, then the supplied json
value is examined to see if it is a
valid JSON object with a value specified for RemoteEntityLink.GLOBAL_ID
generate a new unique identifier to serve as the global IDjson
- the content to be storedFieldTooLongJsonPropertyException
- if globalId
or json
exceeds the maximum allowed lengthInvalidJsonPropertyException
- if json
is malformedIllegalArgumentException
- if entityId
or json
is null
protected String putEntityPropertyDryRun(@Nonnull Long entityId, @Nullable String globalId, @Nonnull String json)
putEntityPropertyValue(Long, String, String)
would without actually
creating or updating the property value. This is intended for use when validating a service request.entityId
- as for putEntityPropertyValue(Long, String, String)
globalId
- as for putEntityPropertyValue(Long, String, String)
json
- as for putEntityPropertyValue(Long, String, String)
globalId
parameter in
the following call to putEntityPropertyValue(Long, String, String)
to guarantee
that the same value will be used even if it is a generated UUID.FieldTooLongJsonPropertyException
- if globalId
or json
exceeds the maximum allowed lengthInvalidJsonPropertyException
- if json
is malformedIllegalArgumentException
- if entityId
or json
is null
protected static void verifyNotNull(ErrorCollection errors, I18nHelper i18n, String field, Object value)
protected static void verifyNotBlank(ErrorCollection errors, I18nHelper i18n, String field, String value)
Copyright © 2002-2022 Atlassian. All Rights Reserved.