org.nuiton.topia.persistence.util
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:
chemit

Method Summary
 void addToList(P parent, E e)
          Add a erntity to his parent
 E getChild(P parent, java.lang.String topiaId)
          Obtain a child from the entity given his id.
 java.util.Collection<E> getChilds(P parent)
          Obtain the collection of childs from the entity.
 void removeFromList(P parent, E e)
          Remove from a prent entity a given child.
 void setChilds(P parent, java.util.Collection<E> childs)
          Set the childs of an entity
 

Method Detail

getChild

E getChild(P parent,
           java.lang.String topiaId)
Obtain a child from the entity given his id.

Parameters:
parent - the entity to query
topiaId - the id of the researched child entity.
Returns:
the child entity or null, if not found.

getChilds

java.util.Collection<E> getChilds(P parent)
Obtain the collection of childs from the entity.

Parameters:
parent - the entity to query.
Returns:
the collection of childs

setChilds

void setChilds(P parent,
               java.util.Collection<E> childs)
Set the childs of an entity

Parameters:
parent - the entity to be setted
childs - the collection of childs to set.

addToList

void addToList(P parent,
               E e)
               throws TopiaException
Add a erntity to his parent

Parameters:
parent - the parent entity
e - the entity to add in parent.
Throws:
TopiaException - if any db problem while operation

removeFromList

void removeFromList(P parent,
                    E e)
                    throws TopiaException
Remove from a prent entity a given child.

Parameters:
parent - the parent entity
e - the child to remove.
Throws:
TopiaException - if any pb while operation.


Copyright © 2004-2010 CodeLutin. All Rights Reserved.