T - Type of object supported by this typepublic interface PropertyType<T> extends Extension
| Modifier and Type | Method and Description |
|---|---|
boolean |
canEdit(ProjectEntity entity,
SecurityService securityService)
Edition policy.
|
boolean |
canView(ProjectEntity entity,
SecurityService securityService)
Defines the authorization policy for viewing this property.
|
default boolean |
containsValue(T value,
java.lang.String propertyValue)
Checks if the property
value contains the given search token. |
default T |
copy(ProjectEntity sourceEntity,
T value,
ProjectEntity targetEntity,
java.util.function.Function<java.lang.String,java.lang.String> replacementFn)
Copy/clones the
value defined for the sourceEntity for being suitable
in the targetEntity after applying the replacement function. |
com.fasterxml.jackson.databind.JsonNode |
forStorage(T value)
Gets the JSON representation of a property value
|
T |
fromClient(com.fasterxml.jackson.databind.JsonNode node)
Parses the client JSON representation for a property value.
|
T |
fromStorage(com.fasterxml.jackson.databind.JsonNode node)
Parses the storage JSON representation for a property value.
|
java.lang.String |
getDescription()
Description for this property
|
Form |
getEditionForm(ProjectEntity entity,
T value)
Form to create/update this property.
|
java.lang.String |
getName()
Display name for this property
|
java.lang.String |
getSearchKey(T value)
Given the value of a property, computes some text that can be used as a hint to search among all
the properties when looking for a key word.
|
java.util.Set<ProjectEntityType> |
getSupportedEntityTypes()
List of entity types this property applies to.
|
default java.lang.String |
getTypeName()
Type name for this property type.
|
default Property<T> |
of(com.fasterxml.jackson.databind.JsonNode node)
Parses the JSON representation for a property value and creates the property value directly.
|
Property<T> |
of(T value)
Creation of a property value from a value.
|
default void |
onPropertyChanged(ProjectEntity entity,
T value)
This method is called when the property value changes (created or updated) for an entity
|
default void |
onPropertyDeleted(ProjectEntity entity,
T oldValue)
This method is called when the property is deleted for an entity
|
T |
replaceValue(T value,
java.util.function.Function<java.lang.String,java.lang.String> replacementFunction)
Replaces a value by another one by transforming each string of the value into another one.
|
getFeaturejava.lang.String getName()
java.lang.String getDescription()
java.util.Set<ProjectEntityType> getSupportedEntityTypes()
boolean canEdit(ProjectEntity entity, SecurityService securityService)
Can this property be directly edited by a used on the given associated entity.
entity - Entity where to edit the propertysecurityService - The access to the security layerboolean canView(ProjectEntity entity, SecurityService securityService)
entity - Entity where to view the propertysecurityService - The access to the security layerForm getEditionForm(ProjectEntity entity, T value)
entity - Entity to edit the property forvalue - Value to update if set. If not set, this means the creation of a new property.com.fasterxml.jackson.databind.JsonNode forStorage(T value)
T fromClient(com.fasterxml.jackson.databind.JsonNode node)
getEditionForm(ProjectEntity, Object)T fromStorage(com.fasterxml.jackson.databind.JsonNode node)
default Property<T> of(com.fasterxml.jackson.databind.JsonNode node)
java.lang.String getSearchKey(T value)
value - Value to indexT replaceValue(T value, java.util.function.Function<java.lang.String,java.lang.String> replacementFunction)
value - Value to replacereplacementFunction - Replacement function to used to transform each string into a new onedefault boolean containsValue(T value, java.lang.String propertyValue)
value contains the given search token.
By default, this method uses the search key.
value - Value to search intopropertyValue - Search tokentrue is founddefault java.lang.String getTypeName()
default T copy(ProjectEntity sourceEntity, T value, ProjectEntity targetEntity, java.util.function.Function<java.lang.String,java.lang.String> replacementFn)
value defined for the sourceEntity for being suitable
in the targetEntity after applying the replacement function.
By default, just applies the textual replacements.
sourceEntity - Owner of the property to copyvalue - Property value to copytargetEntity - Entity to associate the new property withreplacementFn - Replacement function for textual valuesreplaceValue(Object, Function)default void onPropertyChanged(ProjectEntity entity, T value)
entity - Entity for which the property is changedvalue - New valuedefault void onPropertyDeleted(ProjectEntity entity, T oldValue)
entity - Entity for which the property is deletedoldValue - Old value