validation of referenced objects

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

validation of referenced objects

NorbertHartl
Hi,

I have an image object which references a user. For
the user there is a descriptionContainer which adds
conditions for the user (checks equality of password).
In a component dealing with the image there appears
something strange. If I do a validate on that component
it complains abaut value cache being unknown. And this
is coming from the descriptionContainer of the user
object. Is it normal for the referenced objects to be
checked as well? Or do I misunderstand something?

thanks,

Norbert




_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: validation of referenced objects

NorbertHartl
On Wed, 2007-05-09 at 12:14 +0200, Norbert Hartl wrote:

> Hi,
>
> I have an image object which references a user. For
> the user there is a descriptionContainer which adds
> conditions for the user (checks equality of password).
> In a component dealing with the image there appears
> something strange. If I do a validate on that component
> it complains abaut value cache being unknown. And this
> is coming from the descriptionContainer of the user
> object. Is it normal for the referenced objects to be
> checked as well? Or do I misunderstand something?
>
I narrowed the problem a bit.

I have

User class>>descriptionContainer
   | user |
   ^ super descriptionContainer
      addCondition: [
         :value |
         (
            (value cache at: self descriptionPassword ifAbsent: []) =
            (value original at: self descriptionPassword ifAbsent: []))
ifFalse: [
                (value cache at: self descriptionPassword ifAbsent: []) =
                (value cache at: self descriptionPasswordMatch ifAbsent: [])
                                ] ifTrue: [
                                        true
                                ]
                ]

I have objects which reference an Image. The image itself references
a user. If I edit the user object I get a MACheckedMemento for the
value in the condition. If I edit an object which references the
image there are two possibilities. If I upload a new image (which
creates a new image and assigns it a user) everything is fine. If I
leave the image upload field empty I get a "User DNU cache". Looking
at the value in the condition it is of type User.

Is Magritte always checking the complete tree of referenced objects.
This is often undesirable, e.g. if I assign an object which is an
existing one and therefor has been checked already.

How can it happen that that condition gets the real object as a value
instead of the memento? In the failure case I do not invoke self value:
at all. So I'm sure not to store anything strange.

Norbert


_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: validation of referenced objects

Lukas Renggli-2
> Is Magritte always checking the complete tree of referenced objects.
> This is often undesirable, e.g. if I assign an object which is an
> existing one and therefor has been checked already.

I don't remember, I think I changed something in there recently. You  
have to check in MAValidatorVisitor.

> How can it happen that that condition gets the real object as a value
> instead of the memento? In the failure case I do not invoke self  
> value: at all. So I'm sure not to store anything strange.

I personally never used the MAToOneRelationDescription and  
MAToManyRelationDescription. The design of how Magritte handles those  
is simply wrong, therefor many people run into problems when using them.

I suggest that somebody that really needs them gives a try and  
implements them cleanly. I have some ideas about that, but  
unfortunately I don't have the time to do it myself.

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch



_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: validation of referenced objects

NorbertHartl
On Thu, 2007-05-10 at 15:45 +0200, Lukas Renggli wrote:
> > Is Magritte always checking the complete tree of referenced objects.
> > This is often undesirable, e.g. if I assign an object which is an
> > existing one and therefor has been checked already.
>
> I don't remember, I think I changed something in there recently. You  
> have to check in MAValidatorVisitor.
>
I'll have a look at it.
> > How can it happen that that condition gets the real object as a value
> > instead of the memento? In the failure case I do not invoke self  
> > value: at all. So I'm sure not to store anything strange.
>
> I personally never used the MAToOneRelationDescription and  
> MAToManyRelationDescription. The design of how Magritte handles those  
> is simply wrong, therefor many people run into problems when using them.
>
How do you model a reference between objects? I think it is quite
common to interconnect objects ;)

> I suggest that somebody that really needs them gives a try and  
> implements them cleanly. I have some ideas about that, but  
> unfortunately I don't have the time to do it myself.

Me neither. Maybe I have to do it soon because I use references
a lot and I don't think I can rip them out now.

Norbert


_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: validation of referenced objects

Lukas Renggli-2
>>> How can it happen that that condition gets the real object as a  
>>> value
>>> instead of the memento? In the failure case I do not invoke self
>>> value: at all. So I'm sure not to store anything strange.
>>
>> I personally never used the MAToOneRelationDescription and
>> MAToManyRelationDescription. The design of how Magritte handles those
>> is simply wrong, therefor many people run into problems when using  
>> them.
>
> How do you model a reference between objects? I think it is quite
> common to interconnect objects ;)

Well, the MARelationDescriptions were ment for that. They work well  
for some cases I encountered in industrial applications and to  
describe Magritte in itself, however they fail to describe relations  
in general.

One of the problems is that you have a description on every end of  
the relation. Sometimes they are the same, sometimes not. Mostly the  
framework assumes that this is a MAContainerDescription, but  
sometimes it is not. When validating the framework has to decide  
which one to use and if it should recurse the validation into the  
referenced description.

What I would prefer is to have a multiplicity for all the  
descriptions. It would probably make the form generation more  
difficult, but it would cleanly solve the above problems.

>> I suggest that somebody that really needs them gives a try and
>> implements them cleanly. I have some ideas about that, but
>> unfortunately I don't have the time to do it myself.
>
> Me neither. Maybe I have to do it soon because I use references
> a lot and I don't think I can rip them out now.

Yes please.

Cheers,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch



_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: validation of referenced objects

NorbertHartl
On Thu, 2007-05-10 at 16:42 +0200, Lukas Renggli wrote:

> >>> How can it happen that that condition gets the real object as a  
> >>> value
> >>> instead of the memento? In the failure case I do not invoke self
> >>> value: at all. So I'm sure not to store anything strange.
> >>
> >> I personally never used the MAToOneRelationDescription and
> >> MAToManyRelationDescription. The design of how Magritte handles those
> >> is simply wrong, therefor many people run into problems when using  
> >> them.
> >
> > How do you model a reference between objects? I think it is quite
> > common to interconnect objects ;)
>
> Well, the MARelationDescriptions were ment for that. They work well  
> for some cases I encountered in industrial applications and to  
> describe Magritte in itself, however they fail to describe relations  
> in general.
>
> One of the problems is that you have a description on every end of  
> the relation. Sometimes they are the same, sometimes not. Mostly the  
> framework assumes that this is a MAContainerDescription, but  
> sometimes it is not. When validating the framework has to decide  
> which one to use and if it should recurse the validation into the  
> referenced description.
>
> What I would prefer is to have a multiplicity for all the  
> descriptions. It would probably make the form generation more  
> difficult, but it would cleanly solve the above problems.
>
> >> I suggest that somebody that really needs them gives a try and
> >> implements them cleanly. I have some ideas about that, but
> >> unfortunately I don't have the time to do it myself.
> >
> > Me neither. Maybe I have to do it soon because I use references
> > a lot and I don't think I can rip them out now.
>
> Yes please.

Could you please provide some experience about your modeling with
Magritte? If you use automatic form generation you need to model
relationships, right? How do you model cases where objects reference
each other?

Norbert


_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: validation of referenced objects

Lukas Renggli-2
>>>> I suggest that somebody that really needs them gives a try and
>>>> implements them cleanly. I have some ideas about that, but
>>>> unfortunately I don't have the time to do it myself.
>>>
>>> Me neither. Maybe I have to do it soon because I use references
>>> a lot and I don't think I can rip them out now.
>>
>> Yes please.
>
> Could you please provide some experience about your modeling with
> Magritte? If you use automatic form generation you need to model
> relationships, right? How do you model cases where objects reference
> each other?

I rarely use relationships with Magritte. Pier, for example, doesn't  
use a relationships, except maybe for the PRStructureDescription that  
represents a link to a different page in the system.

For most (if not all) applications editors mostly consisted of a  
bunch of basic input fields representing properties of one or more  
domain objects. Relationships are mostly hand-coded in Smalltalk as  
they require sophisticated navigation facilities that cannot be  
modeled using a generic approach easily.

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch



_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki