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:
tchemit <chemit@codelutin.com>
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addToList(P parent, E e)
    Add a erntity to his parent
    getChild(P parent, String topiaId)
    Obtain a child from the entity given his id.
    getChilds(P parent)
    Obtain the collection of childs from the entity.
    Obtain the name of the property containing childs.
    boolean
    isEmpty(P parent)
    Tests if the given entity has some childs.
    void
    removeAll(P parent)
    Remove all childs of the given parent.
    void
    removeFromList(P parent, E e)
    Remove from a prent entity a given child.
    void
    setChilds(P parent, Collection<E> childs)
    Set the childs of an entity
    int
    size(P parent)
    Obtain 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

      E getChild(P parent, 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

      Collection<E> getChilds(P parent)
      Obtain the collection of childs from the entity.
      Parameters:
      parent - the entity to query.
      Returns:
      the collection of childs
    • size

      int size(P parent)
      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

      boolean isEmpty(P parent)
      Tests if the given entity has some childs.
      Parameters:
      parent - the entity to query
      Returns:
      true is the given parent has no child.
    • setChilds

      void setChilds(P parent, 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 entity to modifiy
      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 entity to modifiy
      e - the child to remove.
      Throws:
      TopiaException - if any pb while operation.
    • removeAll

      void removeAll(P parent)
      Remove all childs of the given parent.
      Parameters:
      parent - the entity to modify