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__serviceManagerThe service managerprivate I18nizableText_descriptionprivate Set<ItemCheckerDescriptor>_itemCheckersprivate I18nizableText_labelprivate Model_modelprivate String_nameprivate 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 voidaddItemChecker(ItemCheckerDescriptor itemChecker)Add an item checker to the groupintcompareTo(ModelItem item)booleanequals(Object obj)I18nizableTextgetDescription()Retrieves the description.Set<ItemCheckerDescriptor>getItemCheckers()Returns theItemCheckerDescriptors associated with this group.I18nizableTextgetLabel()Retrieves the label.ModelgetModel()Retrieves the model of the itemStringgetName()Get the name.ModelItemGroupgetParent()Retrieves the parent of the itemStringgetPath()Retrieves the path of the model iteminthashCode()voidsetDescription(I18nizableText description)Set the description.voidsetLabel(I18nizableText label)Set the label.voidsetModel(Model model)Sets the model of the elementvoidsetName(String name)Set the name.voidsetParent(ModelItemGroup parent)Sets the parent of the itemstatic voidsetServiceManager(ServiceManager manager)Set the service manager TheServiceManageris used in the model items creation methods to get the model item type.Map<String,Object>toJSON()Converts the model item in a JSON mapStringtoString()
-
-
-
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- TheAbstractModelItemto copy
-
-
Method Detail
-
setName
public void setName(String name)
Description copied from interface:ModifiableLabelableSet the name.- Specified by:
setNamein interfaceModifiableLabelable- Parameters:
name- the name.
-
getLabel
public I18nizableText getLabel()
Description copied from interface:LabelableRetrieves the label.
-
setLabel
public void setLabel(I18nizableText label)
Description copied from interface:ModifiableLabelableSet the label.- Specified by:
setLabelin interfaceModifiableLabelable- Parameters:
label- the label.
-
getDescription
public I18nizableText getDescription()
Description copied from interface:LabelableRetrieves the description.- Specified by:
getDescriptionin interfaceLabelable- Returns:
- the description.
-
setDescription
public void setDescription(I18nizableText description)
Description copied from interface:ModifiableLabelableSet the description.- Specified by:
setDescriptionin interfaceModifiableLabelable- Parameters:
description- the description.
-
addItemChecker
public void addItemChecker(ItemCheckerDescriptor itemChecker)
Description copied from interface:ModelItemAdd an item checker to the group- Specified by:
addItemCheckerin interfaceModelItem- Parameters:
itemChecker- the item checker to add
-
getItemCheckers
public Set<ItemCheckerDescriptor> getItemCheckers()
Description copied from interface:ModelItemReturns theItemCheckerDescriptors associated with this group.- Specified by:
getItemCheckersin interfaceModelItem- Returns:
- the
ItemCheckerDescriptors associated with this group.
-
getPath
public String getPath()
Description copied from interface:ModelItemRetrieves the path of the model item
-
getModel
public Model getModel()
Description copied from interface:ModelItemRetrieves the model of the item
-
setModel
public void setModel(Model model)
Description copied from interface:ModelItemSets the model of the element
-
getParent
public ModelItemGroup getParent()
Description copied from interface:ModelItemRetrieves the parent of the item
-
setParent
public void setParent(ModelItemGroup parent)
Description copied from interface:ModelItemSets the parent of the item
-
toJSON
public Map<String,Object> toJSON() throws ProcessingException
Description copied from interface:ModelItemConverts the model item in a JSON map- Specified by:
toJSONin 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:
compareToin interfaceComparable<ModelItem>
-
setServiceManager
public static void setServiceManager(ServiceManager manager)
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
-
-