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 I18nizableTextthe group in which to display the elementprotected StringThe storage manager roleprotected longthe position in the group where the element has to be displayedprotected booleanThe private status.Fields inherited from class org.ametys.runtime.model.DefaultElementDefinition
_loggerFields inherited from class org.ametys.runtime.model.AbstractModelItem
__context, __serviceManagerFields inherited from interface org.ametys.runtime.model.ElementDefinition
CONFIG_DEFAULT_VALUE_TYPEFields 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.longRetrieves the position in the group where the preference has to be displayedbooleanGet whether the preference is private, i.e.voidsetDisplayGroup(I18nizableText displayGroup) Sets the group in which to display the preferencevoidsetManagerRole(String managerRole) Set the storage manager role.voidsetPosition(long position) Sets the position of the preference in the groupvoidsetPrivate(boolean privateStatus) Set the private status of the preferencetoString()Methods inherited from class org.ametys.runtime.model.DefaultElementDefinition
_defaultValueToJSON, _getDefaultValues, _getSimpleDefaultValue, _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, toSAXMethods 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, toJSONMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Comparable
compareToMethods inherited from interface org.ametys.runtime.model.ElementDefinition
isEditableMethods inherited from interface org.ametys.runtime.util.Labelable
getDescription, getLabel, getNameMethods inherited from interface org.ametys.runtime.model.ModelItem
addItemChecker, getDisableConditions, getItemCheckers, getModel, getParent, getPath, getPluginName, setDisableConditions, setModel, setParent, setPluginName, toJSONMethods 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- TheUserPreferenceto copy
-
-
Method Details
-
getManagerRole
Get the storage manager role.- Returns:
- the manager role. Can be
nullto use the default storage manager.
-
setManagerRole
Set the storage manager role.- Parameters:
managerRole- the manager role to set. Can benullto 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:
trueif the preference is private,falseif it is public.
-
setPrivate
Set the private status of the preference- Parameters:
privateStatus-trueif the preference is private,falseif 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:AbstractModelItemConverts the model item in a JSON map- Overrides:
_toJSONin classDefaultElementDefinition<T>- Parameters:
context- the context of the definition- Returns:
- The model item as a JSON map
-
toString
- Overrides:
toStringin classAbstractModelItem
-