Hi all,
I guess this is more a hibernate query than an Xwiki one, but here is what I'm trying to do:
We use a simple project management class currently to keep track of projects/engineer assignments/etc - currently managers type in freeform names… as you could imagine this is a bit of a problem with adding some more active content relating to the user (we're adding a 'workdesk' feature on login so that engineers/managers can see what projects/tasks/etc are assigned to them, without having to browse around and search).
What I thought of doing was adding a dropdown with the user details - allowing me to create a solid link between user and project.
Now here's the problem…
I need to associate the firstname+lastname in the query - so that the manager/etc will pick a name they recognise immediately, instead of relying on them to know login names.
Initially, I had thought to use a Map or List to request multiple fields - but this does not seem to be understood by the renderer when it creates a list dropdown - I get immediate errors
Getting first name, no problem:
select prop.value from BaseObject obj, StringProperty prop where obj.className='XWiki.XWikiUsers' and prop.id.id=obj.id and prop.name='first_name'
EG output in the list:
'Brandon'
'UserXFirstName'
Getting Last name, also no problem:
select prop.value from BaseObject obj, StringProperty prop where obj.className='XWiki.XWikiUsers' and prop.id.id=obj.id and prop.name='last_name'
EG output:
'Esbach'
'UserXLastName'
Now it gets sticky. Join the two fields with a space between them, so that instead of 'Brandon' or 'Esbach' I get 'Brandon Esbach'.. This I cannot seem to figure out using Hibernate, so any hints/tips/suggestions would be appreciated.
Problem number 2:
Another small catch I have is mapping this entry so that I can query on it. Normally with data representation one would have a 'display' value and a 'link' value - kind of like the 'pretty name' and 'real name' facility of class objects; only the 'pretty name' gets shown when using automatic rendering - but the field is updated based on 'real name'. Erm. Hope that makes sense.
eg if my Xwiki name is braesb, firstname Brandon, lastname Esbach I could have a list looking like this:
'Brandon Esbach'
'UserXFirstName UserXLastName'
Selecting 'Brandon Esbach' would then look to my 'link' value of Xwiki.braesb, and store this with the record. Querying on this then becomes no problem - but can this be done in Xwiki?
Brandon Esbach
Software Engineer
M/A-Com Eurotec Operations
LoughMahon Technology Park,
Skehard Road,
Blackrock,
Cork, Ireland
Tel +353 21 4808305