|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.nuiton.topia.persistence.util.EntityOperator<B>
B - type de l'entitepublic class EntityOperator<B extends TopiaEntity>
Un objet qui permet d'effecuter des operations de manipulation des donnees dans les entites du type donne.
L'objet connait la liste des proprietes et des associations du type donne et permet de modifier ces valeurs :get(String, TopiaEntity)
set(String, TopiaEntity, Object)
copy(String, TopiaEntity, TopiaEntity)
getChild(String, TopiaEntity, String)
addChild(String, TopiaEntity, Object)
removeChild(String, TopiaEntity, Object)
...
D'autres methodes permettent d'effectuer des operations en lot (sur plusieurs
proprietes en meme temps) sur les proprietes :
copyProperties(TopiaEntity, TopiaEntity, boolean, String...)
obtainProperties(TopiaEntity, String...)
clearProperties(TopiaEntity, String...)
Note : cet objet ne permet pas d'operation vers les bases.
| Field Summary | |
|---|---|
protected List<String> |
associationProperties
list of association names available on the entity. |
protected Method[] |
childAddAllMethods
cache of assocation addAll methods. |
protected Method[] |
childAddMethods
cache of assocation add methods. |
protected Method[] |
childClearMethods
cache of assocation clearmethods. |
protected Method[] |
childGetMethods
cache of assocation get methods. |
protected Method[] |
childIsEmptyMethods
cache of assocation isEmpty methods. |
protected Method[] |
childRemoveMethods
cache of assocation remove methods. |
protected Method[] |
childSizeMethods
cache of assocation size methods. |
protected TopiaEntityEnum |
contract
the constant of the entity |
protected Method[] |
getMethods
cache of getter methods. |
protected Set<String> |
naturalIdsOnNotNullsProperties
list of property names available on the entity used in a natural ids or marked as not-null. |
protected List<String> |
properties
list of property names available on the entity. |
protected Method[] |
setMethods
cache of setter methods. |
| Constructor Summary | |
|---|---|
protected |
EntityOperator(TopiaEntityEnum contract)
|
| Method Summary | ||
|---|---|---|
void |
addAllChild(String name,
B bean,
Collection<?> childs)
Ajoute toutes les entites d'association. |
|
void |
addChild(String name,
B bean,
Object child)
Ajoute une entite d'association. |
|
void |
clearChild(String name,
B bean)
Retire toutes les entites d'association. |
|
void |
clearProperties(B from,
String... properties)
Met a null toutes les proprietes donnees. |
|
Object |
clone()
|
|
void |
copy(String name,
B from,
B dst)
Copie une propriete de src vers dst. |
|
void |
copyProperties(B from,
B dst,
boolean tech,
String... properties)
Recopie toutes les proprietes donnes depuis src vers dst. |
|
boolean |
equals(Object obj)
|
|
protected void |
finalize()
|
|
Object |
get(String name,
B bean)
Recupere la valeur de la propriete donnee. |
|
List<String> |
getAssociationProperties()
|
|
protected Class<?> |
getAssociationPropertyType(int index)
|
|
Class<?> |
getAssociationPropertyType(String name)
|
|
Object |
getChild(String name,
B bean,
String topiaId)
Recupere une entite d'association a partir de son id. |
|
Class<B> |
getClazz()
|
|
Map<String,Object> |
getNaturalId(B bean)
Pour obtenir un dictionnaire de la clef naturelle (clef métier) du bean
donne. |
|
String[] |
getNaturalIdsOnNotNullsProperties()
Get all properties from a natural id or marked as not-null. |
|
Map<String,Object> |
getNaturalIsdAndNotNulls(B bean)
Pour obtenir un dictionnaire des propriétés marqués not-null et la clef naturelle du bean donne. |
|
Map<String,Object> |
getNotNull(B bean)
Pour obtenir un dictionnaire des propriétés marqués not-null du bean donne. |
|
List<String> |
getProperties()
|
|
protected Collection<String> |
getProperties(String[] properties)
|
|
protected Class<?> |
getPropertyType(int index)
|
|
Class<?> |
getPropertyType(String name)
|
|
int |
hashCode()
|
|
protected void |
init()
|
|
protected void |
init(Class<?> entityClass,
Set<Class<?>> explored,
List<String> properties,
List<String> associationProperties,
List<Method> getters,
List<Method> setters,
List<Method> childGetters,
List<Method> childAdders,
List<Method> childAddersAll,
List<Method> childRemovers,
List<Method> childSize,
List<Method> childClearers,
List<Method> childIsEmpty)
|
|
protected static void |
invoke(Method m,
Object bean,
Object... args)
|
|
protected static
|
invokeWithResult(Method m,
Object bean,
Object... args)
|
|
boolean |
isChildEmpty(String name,
B bean)
Test s'il existe des entites d'association pour la propriete donnee. |
|
protected B |
newInstance()
|
|
Map<String,Object> |
obtainProperties(B from,
String... properties)
Obtenir dans un dictionnaire, les valeurs des proprietes donnees. |
|
void |
removeChild(String name,
B bean,
Object child)
Retire une entite d'association. |
|
void |
set(String name,
B bean,
Object value)
Positionner la valeur donne de la propriete donnee. |
|
void |
setNull(String name,
B bean)
Positionner la valeur nulle de la propriete donnee. |
|
int |
sizeChild(String name,
B bean)
Retourne le nombre d'entite d'association. |
|
String |
toString()
|
|
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected final TopiaEntityEnum contract
protected List<String> properties
protected Set<String> naturalIdsOnNotNullsProperties
protected List<String> associationProperties
protected Method[] getMethods
protected Method[] setMethods
protected Method[] childGetMethods
get methods.
protected Method[] childAddMethods
add methods.
protected Method[] childAddAllMethods
addAll methods.
protected Method[] childRemoveMethods
remove methods.
protected Method[] childSizeMethods
size methods.
protected Method[] childIsEmptyMethods
isEmpty methods.
protected Method[] childClearMethods
clearmethods.
| Constructor Detail |
|---|
protected EntityOperator(TopiaEntityEnum contract)
| Method Detail |
|---|
public Object get(String name,
B bean)
getXXX().
name - le nom de la proprietebean - l'instance a interroger
public void set(String name,
B bean,
Object value)
setXXX(value).
name - le nom de la proprietebean - l'instance a mettre a jourvalue - la valeur a positionnerpublic Map<String,Object> getNaturalId(B bean)
bean
donne.
bean - le bean a inspecter
TopiaEntityEnum.getNaturalIds()public Map<String,Object> getNotNull(B bean)
bean donne.
bean - le bean a inspecter
TopiaEntityEnum.getNotNulls()public String[] getNaturalIdsOnNotNullsProperties()
public Map<String,Object> getNaturalIsdAndNotNulls(B bean)
bean donne.
Cette methode est utilisée pour faire un dao.create, pour s'assurer que
tout ce qui ne doit pas pas être à null est bien fourni à la création de
l'objet, sinon on obtient des erreurs.
bean - le bean a inspecter
TopiaEntityEnum.getNotNulls(),
TopiaEntityEnum.getNaturalIds()
public void copy(String name,
B from,
B dst)
setXXX(value).
name - le nom de la proprietefrom - l'instance a interrogerdst - l'instance a mettre a jour
public void setNull(String name,
B bean)
setXXX(nullValue).
name - le nom de la proprietebean - l'instance a mettre a jour
public Object getChild(String name,
B bean,
String topiaId)
getXXXByTopiaId(topiaId).
name - le nom de la propriete d'associationbean - l'instance a interrogertopiaId - l'id de l'entite recherchee
public boolean isChildEmpty(String name,
B bean)
isXXXEmpty().
name - le nom de la propriete d'associationbean - l'instance a interroger
true si pas d'entite d'association
public void addChild(String name,
B bean,
Object child)
addXXX(child).
name - le nom de la propriete d'associationbean - l'instance a mettre a jourchild - l'entite a ajouter
public void addAllChild(String name,
B bean,
Collection<?> childs)
addXXX(child).
name - le nom de la propriete d'associationbean - l'instance a mettre a jourchilds - les entites a ajouter
public void removeChild(String name,
B bean,
Object child)
removeXXX(child).
name - le nom de la propriete d'associationbean - l'instance a mettre a jourchild - l'entite a retirer
public int sizeChild(String name,
B bean)
sizeXXX(childs).
name - le nom de la propriete d'associationbean - l'instance a mettre a jour
public void clearChild(String name,
B bean)
clearXXX(childs).
name - le nom de la propriete d'associationbean - l'instance a mettre a jour
public void copyProperties(B from,
B dst,
boolean tech,
String... properties)
from - l'entite a interrogerdst - l'entite a mettre a jourtech - un drapeau pour recopier aussi les infos techniquesproperties - les proprietes a recopier
public Map<String,Object> obtainProperties(B from,
String... properties)
from - l'object a scanneproperties - les proprietes a retenir (vide si on les veut toutes)
public void clearProperties(B from,
String... properties)
from - l'object a scanneproperties - les proprietes a retenir (vide si on les veut toutes)public List<String> getProperties()
public List<String> getAssociationProperties()
public Class<?> getPropertyType(String name)
public Class<?> getAssociationPropertyType(String name)
public Class<B> getClazz()
public boolean equals(Object obj)
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic Object clone()
clone in class Object
protected void finalize()
throws Throwable
finalize in class ObjectThrowablepublic String toString()
toString in class Objectprotected Collection<String> getProperties(String[] properties)
protected Class<?> getPropertyType(int index)
protected Class<?> getAssociationPropertyType(int index)
protected B newInstance()
protected void init()
protected static void invoke(Method m,
Object bean,
Object... args)
protected static <V> V invokeWithResult(Method m,
Object bean,
Object... args)
protected void init(Class<?> entityClass,
Set<Class<?>> explored,
List<String> properties,
List<String> associationProperties,
List<Method> getters,
List<Method> setters,
List<Method> childGetters,
List<Method> childAdders,
List<Method> childAddersAll,
List<Method> childRemovers,
List<Method> childSize,
List<Method> childClearers,
List<Method> childIsEmpty)
throws IntrospectionException
IntrospectionException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||