Interface EntityPropertyService<T extends WithId>
- All Known Subinterfaces:
ChangeHistoryPropertyService
,CommentPropertyService
,DashboardItemPropertyService
,EntityWithKeyPropertyService<T>
,IssuePropertyService
,IssueTypePropertyService
,ProjectPropertyService
,UserPropertyService
- All Known Implementing Classes:
BaseEntityPropertyService
,BaseEntityWithKeyPropertyService
,DefaultChangeHistoryPropertyService
,DefaultCommentPropertyService
,DefaultDashboardItemPropertyService
,DefaultIssueEntityWithKeyPropertyService
,DefaultIssueTypePropertyService
,DefaultProjectEntityWithKeyPropertyService
,DefaultUserPropertyService
,DelegatingEntityPropertyService
,DelegatingEntityWithKeyPropertyService
- Since:
- v6.2
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic class
static class
Tuple with property value, property key, entity id and entity name, which will be persisted by the service.static class
The key-value pair associated to the entity.static class
static class
static class
static class
-
Method Summary
Modifier and TypeMethodDescriptionvoid
deleteProperty
(ApplicationUser user, EntityPropertyService.DeletePropertyValidationResult validationResult) Removes the entity property with specified entity's id and entity's property key.getProperties
(ApplicationUser user, Long entityId) Returns all properties.getProperties
(ApplicationUser user, Long entityId, List<String> propertyKeys) Returns properties with specified keys.getPropertiesKeys
(ApplicationUser user, Long entityId) Returns the properties keys associated with the specified entity.getPropertiesKeys
(ApplicationUser user, Long entityId, EntityPropertyOptions options) Returns the properties keys associated with the specified entity.getProperty
(ApplicationUser user, Long entityId, String propertyKey) Returns the JSON property with the specified key from specified entity.getProperty
(ApplicationUser user, Long entityId, String propertyKey, EntityPropertyOptions options) Returns the JSON property with the specified key from specified entity.getProperty
(ApplicationUser user, T entity, String propertyKey, EntityPropertyOptions options) Returns the JSON property with the specified key from specified entity.setProperty
(ApplicationUser user, EntityPropertyService.SetPropertyValidationResult propertyValidationResult) Associates validated property with the entity.validateDeleteProperty
(ApplicationUser user, Long entityId, String propertyKey) Check if it is possible to remove the entity property with specified entity's id and entity's property key.validateDeleteProperty
(ApplicationUser user, Long entityId, String propertyKey, EntityPropertyOptions options) Check if it is possible to remove the entity property with specified entity's id and entity's property key.validatePropertyInput
(EntityPropertyService.PropertyInput propertyInput) Validates the property's key and property's value without permission checking.validateSetProperty
(ApplicationUser user, Long entityId, EntityPropertyService.PropertyInput propertyInput) Checks if the provided entity's property is valid.validateSetProperty
(ApplicationUser user, Long entityId, EntityPropertyService.PropertyInput propertyInput, EntityPropertyOptions options) Checks if the provided entity's property is valid.
-
Method Details
-
validatePropertyInput
Validates the property's key and property's value without permission checking.- Parameters:
propertyInput
- the key and value of the property.- Returns:
- all validation errors or empty error collection.
-
validateSetProperty
EntityPropertyService.SetPropertyValidationResult validateSetProperty(ApplicationUser user, @Nonnull Long entityId, @Nonnull EntityPropertyService.PropertyInput propertyInput) Checks if the provided entity's property is valid.This method checks if the entity with which the property will be associated exists and if the calling user has permissions to edit the entity. It validates if the property's key length is less then
255
characters. It also checks if the length of the property's value is less then32,768
.- Parameters:
user
- who the permission checks will be run against (can be null, indicating anonymous user).entityId
- the id of the entity with which the property will be associated.propertyInput
- the pair of key and value which will be associated with the entity.- Returns:
- either entity ready to be persisted in DB or collection of errors.
-
validateSetProperty
EntityPropertyService.SetPropertyValidationResult validateSetProperty(ApplicationUser user, @Nonnull Long entityId, @Nonnull EntityPropertyService.PropertyInput propertyInput, @Nonnull EntityPropertyOptions options) Checks if the provided entity's property is valid.This method checks if the entity with which the property will be associated exists. It validates if the property's key length is less then
255
characters. It also checks if the length of the property's value is less then32,768
.- Parameters:
user
- who the permission checks will be run against (can be null, indicating anonymous user).entityId
- the id of the entity with which the property will be associated.propertyInput
- the pair of key and value which will be associated with the entity.options
- options to skip permission while performing the validation.- Returns:
- either entity ready to be persisted in DB or collection of errors.
-
setProperty
EntityPropertyService.PropertyResult setProperty(ApplicationUser user, @Nonnull EntityPropertyService.SetPropertyValidationResult propertyValidationResult) Associates validated property with the entity. Upon successful set an instance ofEntityPropertySetEvent
is published.- Parameters:
user
- who the permission checks will be run against (can be null, indicating anonymous user).propertyValidationResult
- validated entity property.- Returns:
- the persisted entity property or the error collection.
-
validateDeleteProperty
EntityPropertyService.DeletePropertyValidationResult validateDeleteProperty(ApplicationUser user, @Nonnull Long entityId, @Nonnull String propertyKey) Check if it is possible to remove the entity property with specified entity's id and entity's property key.This method checks if the calling user has permissions to edit the selected entity and if the property for given entity id and property key exists.
- Parameters:
user
- who the permission checks will be run against (can be null, indicating anonymous user).entityId
- the id of the entity with which the property is associated.propertyKey
- the key of the entity's property.- Returns:
- either entity ready to be removed or collection of errors.
-
validateDeleteProperty
EntityPropertyService.DeletePropertyValidationResult validateDeleteProperty(ApplicationUser user, @Nonnull Long entityId, @Nonnull String propertyKey, @Nonnull EntityPropertyOptions options) Check if it is possible to remove the entity property with specified entity's id and entity's property key.This method checks if the property for given entity id and property key exists.
- Parameters:
user
- who the permission checks will be run against (can be null, indicating anonymous user).entityId
- the id of the entity with which the property is associated.propertyKey
- the key of the entity's property.options
- options to skip permission while performing the validation.- Returns:
- either entity ready to be removed or collection of errors.
-
deleteProperty
void deleteProperty(ApplicationUser user, @Nonnull EntityPropertyService.DeletePropertyValidationResult validationResult) Removes the entity property with specified entity's id and entity's property key. Upon successful removal,EntityPropertyDeletedEvent
is published.- Parameters:
user
- who the permission checks will be run against (can be null, indicating anonymous user).validationResult
- validation results of entity's property removal.
-
getProperty
EntityPropertyService.PropertyResult getProperty(ApplicationUser user, @Nonnull Long entityId, @Nonnull String propertyKey) Returns the JSON property with the specified key from specified entity.This method checks if the calling user has permissions to browse the entities and if the entity with given id exists.
- Parameters:
user
- who the permission checks will be run against (can be null, indicating anonymous user).entityId
- the id of the entity with which the property is associated.propertyKey
- the key of the entity's property.- Returns:
- the chosen property of the entity if found or the error collection.
-
getProperty
EntityPropertyService.PropertyResult getProperty(ApplicationUser user, @Nonnull Long entityId, @Nonnull String propertyKey, @Nonnull EntityPropertyOptions options) Returns the JSON property with the specified key from specified entity.This method checks if the entity with given id exists.
- Parameters:
user
- who the permission checks will be run against (can be null, indicating anonymous user).entityId
- the id of the entity with which the property is associated.propertyKey
- the key of the entity's property.options
- options to skip permission while performing the validation.- Returns:
- the chosen property of the entity if found or the error collection.
-
getProperty
EntityPropertyService.PropertyResult getProperty(ApplicationUser user, @Nonnull T entity, @Nonnull String propertyKey, @Nonnull EntityPropertyOptions options) Returns the JSON property with the specified key from specified entity.- Parameters:
user
- who the permission checks will be run against (can be null, indicating anonymous user).entity
- the entity with which the property is associated.propertyKey
- the key of the entity's property.options
- options to skip permission while performing the validation.- Returns:
- the chosen property of the entity if found or the error collection.
-
getProperties
Returns properties with specified keys. Only properties that exist will be returned, non-existent keys are ignored. If the user does not have permissions to read properties of the entity, empty list will be returned.- Parameters:
user
- who the permission checks will be run against (can be null, indicating anonymous user).entityId
- the id of the entity with which the properties are associated.propertyKeys
- the keys of the requested properties- Returns:
- a list of entity properties
-
getProperties
Returns all properties. If the user does not have permissions to read properties of the entity, empty list will be returned.- Parameters:
user
- who the permission checks will be run against (can be null, indicating anonymous user).entityId
- the id of the entity with which the properties are associated.- Returns:
- a list of entity properties
-
getPropertiesKeys
EntityPropertyService.PropertyKeys<T> getPropertiesKeys(ApplicationUser user, @Nonnull Long entityId) Returns the properties keys associated with the specified entity.This method checks if the calling user has permissions to browse the entities and if the entity with given id exists.
- Parameters:
user
- who the permission checks will be run against (can be null, indicating anonymous user).entityId
- the id of the entity with which the property is associated.- Returns:
- the list of properties keys and associated entity or a collection with errors.
-
getPropertiesKeys
EntityPropertyService.PropertyKeys<T> getPropertiesKeys(ApplicationUser user, @Nonnull Long entityId, @Nonnull EntityPropertyOptions options) Returns the properties keys associated with the specified entity.This method checks if the entity with given id exists.
- Parameters:
user
- who the permission checks will be run against (can be null, indicating anonymous user).entityId
- the id of the entity with which the property is associated.options
- options to skip permission while performing the validation.- Returns:
- the list of properties keys and associated entity or a collection with errors.
-