Interface ListUpdator<P,E>
- Type Parameters:
P- the type of the entity which contains the collection to update.E- the type of entities in the collection.
- All Known Implementing Classes:
EntityListUpdator
public interface ListUpdator<P,E>
A simple contract to allow you to update some collections of an entity.
The purpose of the contract is to make possible (via a StorageService for example) some
automatic and generic behaviour when you want to set a collection of childs into a entity.
- Author:
- Tony Chemit - chemit@codelutin.com
-
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a erntity to his parentObtain a child from the entity given his id.Obtain the collection of childs from the entity.Obtain the name of the property containing childs.booleanTests if the given entity has some childs.voidRemove all childs of the given parent.voidremoveFromList(P parent, E e) Remove from a prent entity a given child.voidsetChilds(P parent, Collection<E> childs) Set the childs of an entityintObtain the number of childs for the given parent.
-
Method Details
-
getPropertyName
String getPropertyName()Obtain the name of the property containing childs.- Returns:
- the name of the property containing childs.
-
getChild
Obtain a child from the entity given his id.- Parameters:
parent- the entity to querytopiaId- the id of the researched child entity.- Returns:
- the child entity or
null, if not found.
-
getChilds
Obtain the collection of childs from the entity.- Parameters:
parent- the entity to query.- Returns:
- the collection of childs
-
size
Obtain the number of childs for the given parent.- Parameters:
parent- the entity to query- Returns:
- the number of childs for the given entity
-
isEmpty
Tests if the given entity has some childs.- Parameters:
parent- the entity to query- Returns:
trueis the given parent has no child.
-
setChilds
Set the childs of an entity- Parameters:
parent- the entity to be settedchilds- the collection of childs to set.
-
addToList
Add a erntity to his parent- Parameters:
parent- the entity to modifiye- the entity to add in parent.- Throws:
TopiaException- if any db problem while operation
-
removeFromList
Remove from a prent entity a given child.- Parameters:
parent- the entity to modifiye- the child to remove.- Throws:
TopiaException- if any pb while operation.
-
removeAll
Remove all childs of the given parent.- Parameters:
parent- the entity to modify
-