Package org.ametys.runtime.model
Class AbstractModelItem
java.lang.Object
org.ametys.runtime.model.AbstractModelItem
- All Implemented Interfaces:
Comparable<ModelItem>,ModelItem,Labelable,ModifiableLabelable
- Direct Known Subclasses:
DefaultElementDefinition,ModelItemGroup
Abstract class for model items
-
Field Summary
FieldsFields inherited from interface org.ametys.runtime.model.ModelItem
ITEM_PATH_SEPARATOR -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.AbstractModelItem(String name) Constructor used to create simple models and itemsAbstractModelItem(ModelItem modelItemToCopy) Constructor by copying an existingAbstractModelItem. -
Method Summary
Modifier and TypeMethodDescriptionprotected ModelItemHelperRetrieves theModelItemHelperprotected boolean_shouldJSONBeEmpty(DefinitionContext context) Checks if the current definition JSON conversion should return an empty map_toJSON(DefinitionContext context) Converts the model item in a JSON mapprotected void_widgetParameterToSAX(ContentHandler contentHandler, String parameterName, I18nizableText parameterValue, DefinitionContext context) Generates SAX events for the given widget parameter_widgetToJSON(DefinitionContext context) Converts the model item's widget in a JSON mapprotected void_widgetToSAX(ContentHandler contentHandler, DefinitionContext context) Generates SAX events for the model item's widgetvoidaddItemChecker(ItemCheckerDescriptor itemChecker) Add an item checker to the groupintConverts the definition's disable conditions in a JSON mapbooleanRetrieves the description.Retrieves the disable condition.Returns theItemCheckerDescriptors associated with this group.getLabel()Retrieves the label.getModel()Retrieves the model of the itemgetName()Get the name.Retrieves the parent of the itemgetPath()Retrieves the path of the model itemRetrieves the name of the plugin declaring this element.Retrieves the widget to use for rendering.Get the widget's parametersinthashCode()voidsetDescription(I18nizableText description) Set the description.voidsetDisableConditions(DisableConditions disableConditions) Sets the disable condition.voidsetLabel(I18nizableText label) Set the label.voidSets the model of the elementvoidSet the name.voidsetParent(ModelItemGroup parent) Sets the parent of the itemvoidsetPluginName(String pluginName) Set the name of the plugin declaring this element.static voidsetServiceManager(ServiceManager manager) Set the service manager TheServiceManageris used in the model items creation methods to get the model item type.voidSet the widget.voidsetWidgetParameters(Map<String, I18nizableText> params) Set the widget's parameterstoJSON(DefinitionContext context) Converts the model item in a JSON mapvoidtoSAX(ContentHandler contentHandler, DefinitionContext context) Generates SAX events for the model itemtoString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.ametys.runtime.model.ModelItem
getCriterionWidget, getCriterionWidgetParameters, getType, setType
-
Field Details
-
__serviceManager
The service manager
-
-
Constructor Details
-
AbstractModelItem
public AbstractModelItem()Default constructor. -
AbstractModelItem
Constructor used to create simple models and items- Parameters:
name- the name of the item
-
AbstractModelItem
Constructor by copying an existingAbstractModelItem.- Parameters:
modelItemToCopy- TheAbstractModelItemto copy
-
-
Method Details
-
getName
Description copied from interface:LabelableGet the name. -
setName
Description copied from interface:ModifiableLabelableSet the name.- Specified by:
setNamein interfaceModifiableLabelable- Parameters:
name- the name.
-
getPluginName
Description copied from interface:ModelItemRetrieves the name of the plugin declaring this element.- Specified by:
getPluginNamein interfaceModelItem- Returns:
- the plugin name.
-
setPluginName
Description copied from interface:ModelItemSet the name of the plugin declaring this element.- Specified by:
setPluginNamein interfaceModelItem- Parameters:
pluginName- the plugin name.
-
getLabel
Description copied from interface:LabelableRetrieves the label. -
setLabel
Description copied from interface:ModifiableLabelableSet the label.- Specified by:
setLabelin interfaceModifiableLabelable- Parameters:
label- the label.
-
getDescription
Description copied from interface:LabelableRetrieves the description.- Specified by:
getDescriptionin interfaceLabelable- Returns:
- the description.
-
setDescription
Description copied from interface:ModifiableLabelableSet the description.- Specified by:
setDescriptionin interfaceModifiableLabelable- Parameters:
description- the description.
-
addItemChecker
Description copied from interface:ModelItemAdd an item checker to the group- Specified by:
addItemCheckerin interfaceModelItem- Parameters:
itemChecker- the item checker to add
-
getItemCheckers
Description copied from interface:ModelItemReturns theItemCheckerDescriptors associated with this group.- Specified by:
getItemCheckersin interfaceModelItem- Returns:
- the
ItemCheckerDescriptors associated with this group.
-
getWidget
Description copied from interface:ModelItemRetrieves the widget to use for rendering. -
setWidget
Description copied from interface:ModelItemSet the widget. -
getWidgetParameters
Description copied from interface:ModelItemGet the widget's parameters- Specified by:
getWidgetParametersin interfaceModelItem- Returns:
- the widget's parameters
-
setWidgetParameters
Description copied from interface:ModelItemSet the widget's parameters- Specified by:
setWidgetParametersin interfaceModelItem- Parameters:
params- the parameters to set
-
getDisableConditions
Description copied from interface:ModelItemRetrieves the disable condition.- Specified by:
getDisableConditionsin interfaceModelItem- Returns:
- the disable condition or
nullif none is defined.
-
setDisableConditions
Description copied from interface:ModelItemSets the disable condition.- Specified by:
setDisableConditionsin interfaceModelItem- Parameters:
disableConditions- the disable condition.
-
getPath
Description copied from interface:ModelItemRetrieves the path of the model item -
getModel
Description copied from interface:ModelItemRetrieves the model of the item -
setModel
Description copied from interface:ModelItemSets the model of the element -
getParent
Description copied from interface:ModelItemRetrieves the parent of the item -
setParent
Description copied from interface:ModelItemSets the parent of the item -
toJSON
Description copied from interface:ModelItemConverts the model item in a JSON map- Specified by:
toJSONin interfaceModelItem- Parameters:
context- the context of the definition- Returns:
- The model item as a JSON map, or an empty map
- Throws:
ProcessingException- If an error occurs when converting the model item
-
_toJSON
Converts the model item in a JSON map- Parameters:
context- the context of the definition- Returns:
- The model item as a JSON map
- Throws:
ProcessingException- If an error occurs when converting the model item
-
_widgetToJSON
Converts the model item's widget in a JSON map- Parameters:
context- the context of the definition- Returns:
- The model item's widget as a JSON map
- Throws:
ProcessingException- If an error occurs when converting the model item
-
disableConditionsToJSON
Converts the definition's disable conditions in a JSON map- Returns:
- The definition's disable conditions as a JSON map
-
_shouldJSONBeEmpty
Checks if the current definition JSON conversion should return an empty map- Parameters:
context- the context of the definition- Returns:
trueif the JSON conversion should return an empty map,falseotherwise
-
toSAX
Description copied from interface:ModelItemGenerates SAX events for the model item- Specified by:
toSAXin interfaceModelItem- Parameters:
contentHandler- theContentHandlerthat will receive the SAX eventscontext- the context of the definition- Throws:
SAXException- if an error occurs during the SAX events generation
-
_widgetToSAX
protected void _widgetToSAX(ContentHandler contentHandler, DefinitionContext context) throws SAXException Generates SAX events for the model item's widget- Parameters:
contentHandler- theContentHandlerthat will receive the SAX eventscontext- the context of the definition- Throws:
SAXException- if an error occurs during the SAX events generation
-
_widgetParameterToSAX
protected void _widgetParameterToSAX(ContentHandler contentHandler, String parameterName, I18nizableText parameterValue, DefinitionContext context) throws SAXException Generates SAX events for the given widget parameter- Parameters:
contentHandler- theContentHandlerthat will receive the SAX eventsparameterName- the name of the parameterparameterValue- the value of the parametercontext- the context of the definition- Throws:
SAXException- if an error occurs during the SAX events generation
-
compareTo
- Specified by:
compareToin interfaceComparable<ModelItem>
-
equals
-
hashCode
-
toString
-
_getModelItemHelper
Retrieves theModelItemHelper- Returns:
- the
ModelItemHelper
-
setServiceManager
Set the service manager TheServiceManageris used in the model items creation methods to get the model item type.ModelItemis not aComponentand can't have aServiceManageritself. AnotherComponenthas to set it- Parameters:
manager- the service manager to set
-