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:
ElementDefinition
,ModelItemGroup
Abstract class for model items
-
Field Summary
Fields inherited from interface org.ametys.runtime.model.ModelItem
ITEM_PATH_SEPARATOR
-
Constructor Summary
ConstructorDescriptionDefault constructor.AbstractModelItem
(String name) Constructor used to create simple models and itemsAbstractModelItem
(AbstractModelItem modelItemToCopy) Constructor by copying an existingAbstractModelItem
. -
Method Summary
Modifier and TypeMethodDescriptionprotected 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 mapvoid
addItemChecker
(ItemCheckerDescriptor itemChecker) Add an item checker to the groupint
boolean
Retrieves the description.Returns theItemCheckerDescriptor
s 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 itemint
hashCode()
void
setDescription
(I18nizableText description) Set the description.void
setLabel
(I18nizableText label) Set the label.void
Sets the model of the elementvoid
Set the name.void
setParent
(ModelItemGroup parent) Sets the parent of the itemstatic void
setServiceManager
(ServiceManager manager) Set the service manager TheServiceManager
is used in the model items creation methods to get the model item type.toJSON
(DefinitionContext context) Converts the model item in a JSON maptoString()
-
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
- TheAbstractModelItem
to copy
-
-
Method Details
-
getName
Description copied from interface:Labelable
Get the name. -
setName
Description copied from interface:ModifiableLabelable
Set the name.- Specified by:
setName
in interfaceModifiableLabelable
- Parameters:
name
- the name.
-
getLabel
Description copied from interface:Labelable
Retrieves the label. -
setLabel
Description copied from interface:ModifiableLabelable
Set the label.- Specified by:
setLabel
in interfaceModifiableLabelable
- Parameters:
label
- the label.
-
getDescription
Description copied from interface:Labelable
Retrieves the description.- Specified by:
getDescription
in interfaceLabelable
- Returns:
- the description.
-
setDescription
Description copied from interface:ModifiableLabelable
Set the description.- Specified by:
setDescription
in interfaceModifiableLabelable
- Parameters:
description
- the description.
-
addItemChecker
Description copied from interface:ModelItem
Add an item checker to the group- Specified by:
addItemChecker
in interfaceModelItem
- Parameters:
itemChecker
- the item checker to add
-
getItemCheckers
Description copied from interface:ModelItem
Returns theItemCheckerDescriptor
s associated with this group.- Specified by:
getItemCheckers
in interfaceModelItem
- Returns:
- the
ItemCheckerDescriptor
s associated with this group.
-
getPath
Description copied from interface:ModelItem
Retrieves the path of the model item -
getModel
Description copied from interface:ModelItem
Retrieves the model of the item -
setModel
Description copied from interface:ModelItem
Sets the model of the element -
getParent
Description copied from interface:ModelItem
Retrieves the parent of the item -
setParent
Description copied from interface:ModelItem
Sets the parent of the item -
toJSON
Description copied from interface:ModelItem
Converts the model item in a JSON map- Specified by:
toJSON
in 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
-
_shouldJSONBeEmpty
Checks if the current definition JSON conversion should return an empty map- Parameters:
context
- the context of the definition- Returns:
true
if the JSON conversion should return an empty map,false
otherwise
-
compareTo
- Specified by:
compareTo
in interfaceComparable<ModelItem>
-
equals
-
hashCode
-
toString
-
setServiceManager
Set the service manager TheServiceManager
is used in the model items creation methods to get the model item type.ModelItem
is not aComponent
and can't have aServiceManager
itself. AnotherComponent
has to set it- Parameters:
manager
- the service manager to set
-