Webuser uuid

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

Webuser uuid

Nicholas Moore

In 6.1 a WebUser uuid can end up as a large integer or a string:

WebUser>>initId

self id: (AIDASite random next * 1000000000) asInteger.

self otherValuesAt: #uuid put: (self id)

WebUser>>uuid

"unique identifier "

^self otherValuesAt: #uuid ifAbsentPut: [(AIDASite random next * 1000000000) rounded printString]

i assume that it should be a string to be consistent with Party, which also returns a string.

Nicholas


--

Nicholas Moore

Check out my Blog

"Still Running - that I may die in good health"


_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida

signature.asc (205 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Webuser uuid

Janko Mivšek
Nicholas, thanks for this note, I just changed #initId to set up a
string instead of number, as you suggested.

Best regards
Janko

On 20. 01. 2011 12:31, Nicholas Moore wrote:

> In 6.1 a WebUser uuid can end up as a large integer or a string:
>
> WebUser>>initId
>
> self id: (AIDASite random next * 1000000000) asInteger.
>
> self otherValuesAt: #uuid put: (self id)
>
> WebUser>>uuid
>
> "unique identifier "
>
> ^self otherValuesAt: #uuid ifAbsentPut: [(AIDASite random next *
> 1000000000) rounded printString]
>
> i assume that it should be a string to be consistent with Party, which
> also returns a string.
>
> Nicholas
>
> --
>
> Nicholas Moore
>
> Check out my Blog <http://nicholasmoore.eu/blog.html>
>
> "Still Running - that I may die in good health"

--
Janko Mivšek
AIDA/Web
Smalltalk Web Application Server
http://www.aidaweb.si
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: Webuser uuid

Nicholas Moore

It is possible, but unlikely, that a duplicate uuid could exist, so I have a WebUser class variable: setOfUids to hold all the uuids for my site. I test for the existence in the initid method:

initId

|newUuid|

newUuid := (AIDASite random next * 1000000000) rounded printString.

(WebUser setOfUuids contains: [:each | each = newUuid])

ifTrue:[newUuid := self initId ].

WebUser setOfUuids add: newUuid.

self id: newUuid.

self otherValuesAt: #uuid put: (self id)

I think that the WebUser id may be redundant, but I also set the Person id to be the same as the WebUser id for the moment. I hope to have time to look at the Person/Party parts soon.

On Sunday 23 Jan 2011 10:03:08 Janko Mivšek wrote:

> Nicholas, thanks for this note, I just changed #initId to set up a

> string instead of number, as you suggested.

>

> Best regards

> Janko

>

> On 20. 01. 2011 12:31, Nicholas Moore wrote:

> > In 6.1 a WebUser uuid can end up as a large integer or a string:

> >

> > WebUser>>initId

> >

> > self id: (AIDASite random next * 1000000000) asInteger.

> >

> > self otherValuesAt: #uuid put: (self id)

> >

> > WebUser>>uuid

> >

> > "unique identifier "

> >

> > ^self otherValuesAt: #uuid ifAbsentPut: [(AIDASite random next *

> > 1000000000) rounded printString]

> >

> > i assume that it should be a string to be consistent with Party, which

> > also returns a string.

> >

> > Nicholas

> >

>

>


--

Nicholas Moore


Check out my Blog

"Still Running - that I may die in good health"


_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida