dngferreira / open-ehr-gen-framework

Automatically exported from code.google.com/p/open-ehr-gen-framework
0 stars 0 forks source link

Problema con test de cluster obligatorio multiple con DvQuantity #36

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Tengo una observaton con un cluster obligatorio y multiple. El cluster tiene 2 
elements, cada uno con un DvQuantity:

OBSERVATION[at0000] matches {   -- test cluster obligatorio multiple struct
    data matches {
        HISTORY[at0001] matches {   -- Event Series
            events cardinality matches {1..*; unordered} matches {
                EVENT[at0002] occurrences matches {0..1} matches {  -- Cualquier evento
                    data matches {
                        ITEM_TREE[at0003] matches { -- Arbol
                            items cardinality matches {1..*; unordered} matches {
                                CLUSTER[at0004] occurrences matches {1..*} matches {    -- cluster

Al clonar el CLUSTER (como en la captura adjunta), y sin ingresar datos se hace 
"Guardar", me aparecen errores para los DvQuantity de que se necesita que 
ingrese la unidad y la magnitud.
Como los ELEMENT son opcionales, si no se ingresan datos, no debería dar error 
en los DvQuantity.
Por otro lado, los errores deberían ser para los 6 DvQuantity que hay 
ingresados, y aparecen 4 errores iguales, pero se ponen para los DvQuantity del 
primer CLUSTER (ahí debe haber algo mal con el Javascript que pone los errores 
en el EDIT).

==============================================
bindELEMENT pathValor: 
[/data[at0001]/events[at0002]/data[at0003]/items[at0004]/items[at0005]/value/mag
nitude:, /data[at0001]/events[at0002]/data[at00
03]/items[at0004]/items[at0005]/value/units:]
bondElement: rmobjectForValue=[data_types.quantity.DvQuantity@533fc3]
Element Null ERROR Count :1
rmObjectsForValue.size :1
==============================================
bindELEMENT pathValor: 
[/data[at0001]/events[at0002]/data[at0003]/items[at0004]/items[at0006]/value/mag
nitude:, /data[at0001]/events[at0002]/data[at00
03]/items[at0004]/items[at0006]/value/units:]
bondElement: rmobjectForValue=[data_types.quantity.DvQuantity@15b8e6c]
Element Null ERROR Count :1
rmObjectsForValue.size :1
==============================================
bindELEMENT pathValor: 
[/data[at0001]/events[at0002]/data[at0003]/items[at0004]/items[at0005]/value/mag
nitude:, /data[at0001]/events[at0002]/data[at00
03]/items[at0004]/items[at0005]/value/units:]
bondElement: rmobjectForValue=[data_types.quantity.DvQuantity@1279e56]
Element Null ERROR Count :1
rmObjectsForValue.size :1
==============================================
bindELEMENT pathValor: 
[/data[at0001]/events[at0002]/data[at0003]/items[at0004]/items[at0006]/value/mag
nitude:, /data[at0001]/events[at0002]/data[at00
03]/items[at0004]/items[at0006]/value/units:]
bondElement: rmobjectForValue=[data_types.quantity.DvQuantity@295593]
Element Null ERROR Count :1
rmObjectsForValue.size :1
==============================================
bindELEMENT pathValor: 
[/data[at0001]/events[at0002]/data[at0003]/items[at0004]/items[at0005]/value/mag
nitude:, /data[at0001]/events[at0002]/data[at00
03]/items[at0004]/items[at0005]/value/units:]
bondElement: rmobjectForValue=[data_types.quantity.DvQuantity@1adbf85]
Element Null ERROR Count :1
rmObjectsForValue.size :1
==============================================
bindELEMENT pathValor: 
[/data[at0001]/events[at0002]/data[at0003]/items[at0004]/items[at0006]/value/mag
nitude:, /data[at0001]/events[at0002]/data[at00
03]/items[at0004]/items[at0006]/value/units:]
bondElement: rmobjectForValue=[data_types.quantity.DvQuantity@12563c6]
Element Null ERROR Count :1
rmObjectsForValue.size :1
bindCComplexObject rmObject tiene errores: 
org.springframework.validation.BeanPropertyBindingResult: 1 errors
Field error in object 'hce.core.datastructure.itemstructure.ItemTree' on field 
'items': rejected value [[]]; codes [ITEM_TREE.error.cardinality.hce.co
re.datastructure.itemstructure.ItemTree.items,ITEM_TREE.error.cardinality.items,
ITEM_TREE.error.cardinality.java.util.List,ITEM_TREE.error.cardinality
]; arguments []; default message [null]
Template: TEST-cluster_obligatorio_multiple_struct esta en cache << 
templates.tom.Template@1fda160 >>
Template: TEST-cluster_obligatorio_multiple_struct esta en cache << 
templates.tom.Template@1fda160 >>
Hay errors en el binder (bandera errors en true)

Original issue reported on code.google.com by pablo.swp@gmail.com on 3 Sep 2011 at 3:07

Attachments:

GoogleCodeExporter commented 9 years ago
Los errores de validación que tiró el binder son:

{
    "field_634":{
        "errors":[{
                "object":"DvQuantity",
                "field":"magnitude",
                "rejected-value":null,
                "message":"Debe ingresar magnitud y unidades"
            },
            {
                "object":"DvQuantity",
                "field":"units",
                "rejected-value":null,
                "message":"Debe ingresar magnitud y unidades"
            }
        ]
    },
    "field_636":{
        "errors":[{
                "object":"DvQuantity",
                "field":"magnitude",
                "rejected-value":null,
                "message":"Debe ingresar magnitud y unidades"
            },
            {
                "object":"DvQuantity",
                "field":"units",
                "rejected-value":null,
                "message":"Debe ingresar magnitud y unidades"
            }
        ]
    },
    "field_638":{
        "errors":[{
                "object":"hce.core.datastructure.itemstructure.ItemTree",
                "field":"items",
                "rejected-value":[],
                "message":"No hay suficientes valores ingresados"
            }
        ]
    }
}

Original comment by pablo.swp@gmail.com on 3 Sep 2011 at 3:09

GoogleCodeExporter commented 9 years ago
Ya está corregido. Si no se ponen datos, se muestra un mensaje de error 
general, y si se ponen datos parciales, muestra el error correcto en cada 
campo, y muestra un solo error.

Pero...

Si tengo un solo cluster, pongo datos parciales, lo salvo, veo errores, clono 
el nodo.

Ahí el nodo clonado aparece con los mensajes de error (no debería).

Lo otro que pasa es lo de la imagen adjunta, si en el nodo clonado pongo un 
dato parcial y lo salvo, para ese campo NO aparecen errores, y debería.

Original comment by pablo.swp@gmail.com on 21 Sep 2011 at 3:51

Attachments:

GoogleCodeExporter commented 9 years ago
Este último error pasa porque para mostrar los errores en el edit se usa el 
nombre del campo, y si el error es de un campo clonado, va a tener el mismo 
nombre que el campo original, entonces los errores se van a mostrar solo para 
el primer campo.

Para solucionarlo, al clonar debería cambiar el nombre de los campos contenido 
en el nodo clonado, por ejemplo si se clona field_56, al clonado ponerle 
field_56__1, pero para que funcione bien el bind, al campo field_56__1 deberia 
asociarle la misma path que a field_56 en la asignacion de nombres de campos a 
paths de arquetipos.
Eso es facil de hacer porque los campos comparten el mismo prefijo, pero se 
debería hacer en el save porque el asignador de nombres a paths no sabe que un 
nodo fue clonado.

Este cambio de nombres debería considerarse en el create y en el edit. En el 
show hay que analizarlo.

Original comment by pablo.swp@gmail.com on 23 Sep 2011 at 4:56

GoogleCodeExporter commented 9 years ago
Lo que hice fue para cada nombre de campo, le asocio un índice a la lista de 
errores de cada campo. El índice corresponde al número de nodo múltiple 
(p.e. el original es 0 y el primer clonado es 1). Así puedo mostrar el error 
en el campo correcto.

Doy por cerrado este ticket.

Original comment by pablo.swp@gmail.com on 9 Oct 2011 at 6:06