Package org.ametys.core.userpref
Class UserPreference<T>
java.lang.Object
org.ametys.runtime.model.AbstractModelItem
org.ametys.runtime.model.DefaultElementDefinition<T>
org.ametys.core.userpref.UserPreference<T>
- Type Parameters:
T
- Type of the preference value
- All Implemented Interfaces:
Comparable<ModelItem>
,ElementDefinition<T>
,ModelItem
,Labelable
,ModifiableLabelable
Definition of a user preference.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected I18nizableText
the group in which to display the elementprotected String
The storage manager roleprotected long
the position in the group where the element has to be displayedprotected boolean
The private status.Fields inherited from class org.ametys.runtime.model.DefaultElementDefinition
_logger
Fields inherited from class org.ametys.runtime.model.AbstractModelItem
__context, __serviceManager
Fields inherited from interface org.ametys.runtime.model.ElementDefinition
CONFIG_DEFAULT_VALUE_TYPE
Fields inherited from interface org.ametys.runtime.model.ModelItem
ITEM_PATH_SEPARATOR
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructorUserPreference
(UserPreference<T> preferenceToCopy) Constructor by copying an existingUserPreference
. -
Method Summary
Modifier and TypeMethodDescription_toJSON
(DefinitionContext context) Converts the model item in a JSON mapRetrieves the group in which to display the preferenceGet the storage manager role.long
Retrieves the position in the group where the preference has to be displayedboolean
Get whether the preference is private, i.e.void
setDisplayGroup
(I18nizableText displayGroup) Sets the group in which to display the preferencevoid
setManagerRole
(String managerRole) Set the storage manager role.void
setPosition
(long position) Sets the position of the preference in the groupvoid
setPrivate
(boolean privateStatus) Set the private status of the preferencetoString()
Methods inherited from class org.ametys.runtime.model.DefaultElementDefinition
_defaultValueToJSON, _getDefaultValues, _widgetToJSON, _widgetToSAX, getCustomEnumerator, getCustomValidator, getDefaultValue, getEnumerator, getEnumeratorConfiguration, getParsedDefaultValues, getType, getValidator, getValidatorConfiguration, getWidget, getWidgetParameters, isMultiple, of, setCustomEnumerator, setCustomValidator, setDefaultValue, setEnumerator, setEnumeratorConfiguration, setMultiple, setParsedDefaultValues, setType, setValidator, setValidatorConfiguration, setWidget, setWidgetParameters, toSAX
Methods inherited from class org.ametys.runtime.model.AbstractModelItem
_getModelItemHelper, _shouldJSONBeEmpty, _widgetParameterToSAX, addItemChecker, compareTo, disableConditionsToJSON, equals, getDescription, getDisableConditions, getItemCheckers, getLabel, getModel, getName, getParent, getPath, getPluginName, hashCode, setContext, setDescription, setDisableConditions, setLabel, setModel, setName, setParent, setPluginName, setServiceManager, toJSON
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Comparable
compareTo
Methods inherited from interface org.ametys.runtime.model.ElementDefinition
isEditable
Methods inherited from interface org.ametys.runtime.util.Labelable
getDescription, getLabel, getName
Methods inherited from interface org.ametys.runtime.model.ModelItem
addItemChecker, getDisableConditions, getItemCheckers, getModel, getParent, getPath, getPluginName, setDisableConditions, setModel, setParent, setPluginName, toJSON
Methods inherited from interface org.ametys.runtime.util.ModifiableLabelable
setDescription, setLabel, setName
-
Field Details
-
_managerRole
The storage manager role -
_private
The private status. -
_displayGroup
the group in which to display the element -
_position
the position in the group where the element has to be displayed
-
-
Constructor Details
-
UserPreference
public UserPreference()Default constructor -
UserPreference
Constructor by copying an existingUserPreference
.- Parameters:
preferenceToCopy
- TheUserPreference
to copy
-
-
Method Details
-
getManagerRole
Get the storage manager role.- Returns:
- the manager role. Can be
null
to use the default storage manager.
-
setManagerRole
Set the storage manager role.- Parameters:
managerRole
- the manager role to set. Can benull
to use the default storage manager.
-
isPrivate
Get whether the preference is private, i.e. should not be visible by the regular user preferences interface.- Returns:
true
if the preference is private,false
if it is public.
-
setPrivate
Set the private status of the preference- Parameters:
privateStatus
-true
if the preference is private,false
if it is public.
-
getDisplayGroup
Retrieves the group in which to display the preference- Returns:
- the group
-
setDisplayGroup
Sets the group in which to display the preference- Parameters:
displayGroup
- the group to set
-
getPosition
Retrieves the position in the group where the preference has to be displayed- Returns:
- the position in the group
-
setPosition
Sets the position of the preference in the group- Parameters:
position
- the position to set
-
_toJSON
Description copied from class:AbstractModelItem
Converts the model item in a JSON map- Overrides:
_toJSON
in classDefaultElementDefinition<T>
- Parameters:
context
- the context of the definition- Returns:
- The model item as a JSON map
-
toString
- Overrides:
toString
in classAbstractModelItem
-