[aida] Webuser uuid

Nicholas Moore nicholas.moore at tsr-i.com
Sun Jan 23 14:33:17 CET 2011


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" 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.aidaweb.si/pipermail/aida/attachments/20110123/11155a69/attachment.htm 


More information about the Aida mailing list