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
public abstract class AbstractModelItem extends Object implements ModelItem
Abstract class for model items
-
-
Field Summary
Fields Modifier and Type Field Description protected static ServiceManager
__serviceManager
The service managerprivate I18nizableText
_description
private Set<ItemCheckerDescriptor>
_itemCheckers
private I18nizableText
_label
private Model
_model
private String
_name
private ModelItemGroup
_parent
-
Fields inherited from interface org.ametys.runtime.model.ModelItem
ITEM_PATH_SEPARATOR
-
-
Constructor Summary
Constructors Constructor Description AbstractModelItem()
Default constructor.AbstractModelItem(String name)
Constructor used to create simple models and itemsAbstractModelItem(AbstractModelItem modelItemToCopy)
Constructor by copying an existingAbstractModelItem
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addItemChecker(ItemCheckerDescriptor itemChecker)
Add an item checker to the groupint
compareTo(ModelItem item)
boolean
equals(Object obj)
I18nizableText
getDescription()
Retrieves the description.Set<ItemCheckerDescriptor>
getItemCheckers()
Returns theItemCheckerDescriptor
s associated with this group.I18nizableText
getLabel()
Retrieves the label.Model
getModel()
Retrieves the model of the itemString
getName()
Get the name.ModelItemGroup
getParent()
Retrieves the parent of the itemString
getPath()
Retrieves the path of the model itemint
hashCode()
void
setDescription(I18nizableText description)
Set the description.void
setLabel(I18nizableText label)
Set the label.void
setModel(Model model)
Sets the model of the elementvoid
setName(String name)
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.Map<String,Object>
toJSON()
Converts the model item in a JSON mapString
toString()
-
-
-
Field Detail
-
__serviceManager
protected static ServiceManager __serviceManager
The service manager
-
_label
private I18nizableText _label
-
_description
private I18nizableText _description
-
_itemCheckers
private Set<ItemCheckerDescriptor> _itemCheckers
-
_parent
private ModelItemGroup _parent
-
-
Constructor Detail
-
AbstractModelItem
public AbstractModelItem()
Default constructor.
-
AbstractModelItem
public AbstractModelItem(String name)
Constructor used to create simple models and items- Parameters:
name
- the name of the item
-
AbstractModelItem
public AbstractModelItem(AbstractModelItem modelItemToCopy)
Constructor by copying an existingAbstractModelItem
.- Parameters:
modelItemToCopy
- TheAbstractModelItem
to copy
-
-
Method Detail
-
setName
public void setName(String name)
Description copied from interface:ModifiableLabelable
Set the name.- Specified by:
setName
in interfaceModifiableLabelable
- Parameters:
name
- the name.
-
getLabel
public I18nizableText getLabel()
Description copied from interface:Labelable
Retrieves the label.
-
setLabel
public void setLabel(I18nizableText label)
Description copied from interface:ModifiableLabelable
Set the label.- Specified by:
setLabel
in interfaceModifiableLabelable
- Parameters:
label
- the label.
-
getDescription
public I18nizableText getDescription()
Description copied from interface:Labelable
Retrieves the description.- Specified by:
getDescription
in interfaceLabelable
- Returns:
- the description.
-
setDescription
public void setDescription(I18nizableText description)
Description copied from interface:ModifiableLabelable
Set the description.- Specified by:
setDescription
in interfaceModifiableLabelable
- Parameters:
description
- the description.
-
addItemChecker
public void addItemChecker(ItemCheckerDescriptor itemChecker)
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
public Set<ItemCheckerDescriptor> 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
public String getPath()
Description copied from interface:ModelItem
Retrieves the path of the model item
-
getModel
public Model getModel()
Description copied from interface:ModelItem
Retrieves the model of the item
-
setModel
public void setModel(Model model)
Description copied from interface:ModelItem
Sets the model of the element
-
getParent
public ModelItemGroup getParent()
Description copied from interface:ModelItem
Retrieves the parent of the item
-
setParent
public void setParent(ModelItemGroup parent)
Description copied from interface:ModelItem
Sets the parent of the item
-
toJSON
public Map<String,Object> toJSON() throws ProcessingException
Description copied from interface:ModelItem
Converts the model item in a JSON map- Specified by:
toJSON
in interfaceModelItem
- Returns:
- The model item as a JSON map
- Throws:
ProcessingException
- If an error occurs when converting the model item
-
compareTo
public int compareTo(ModelItem item)
- Specified by:
compareTo
in interfaceComparable<ModelItem>
-
setServiceManager
public static void setServiceManager(ServiceManager manager)
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
-
-