how to use entitylabels somewhere else

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

how to use entitylabels somewhere else

Matthieu Bollot-4
Hi,
Is there a way to use entitylabels in a groovy ?
I've got a genericValue that contains a result, for example a workEffort
with workEffortTypeId:ROUTING that I can get with
myRow['workEffortTypeId']
And I want to get the string of WorkEffortType.description.ROUTING from
workEffortEntityLabels which will be 'routing' in english, 'routage' in
french and so on.

any idea ?

--
Matthieu BOLLOT
www.nereide.biz

Reply | Threaded
Open this post in threaded view
|

Re: how to use entitylabels somewhere else

Matthieu Bollot-4
Le jeudi 17 juin 2010 à 18:05 +0200, Matthieu Bollot a écrit :

> Hi,
> Is there a way to use entitylabels in a groovy ?
> I've got a genericValue that contains a result, for example a workEffort
> with workEffortTypeId:ROUTING that I can get with
> myRow['workEffortTypeId']
> And I want to get the string of WorkEffortType.description.ROUTING from
> workEffortEntityLabels which will be 'routing' in english, 'routage' in
> french and so on.
>
> any idea ?
>
Obviously, it's always when we ask for help after searching for hours
that we find the solution alone -_-'

btw, here is a solution, may be not the best one :
e.g. : in screen.xml
<property-map resource="CommonEntityLabels" map-name="uiLabelMap"
global="true"/>


in groovy :
uiLabelMap.get('StatusItem.description.'+key)

where key is my status, such as ROUTING

--
Matthieu BOLLOT
www.nereide.biz

Reply | Threaded
Open this post in threaded view
|

Re: how to use entitylabels somewhere else

Adam Heath-2
In reply to this post by Matthieu Bollot-4
Matthieu Bollot wrote:
> Hi,
> Is there a way to use entitylabels in a groovy ?
> I've got a genericValue that contains a result, for example a workEffort
> with workEffortTypeId:ROUTING that I can get with
> myRow['workEffortTypeId']

myRow.workEffortTypeId is better.

> And I want to get the string of WorkEffortType.description.ROUTING from
> workEffortEntityLabels which will be 'routing' in english, 'routage' in
> french and so on.

I'm thinking about something groovy-ish; brainstorming...

In GenericEntity.java:

public Map<String, String> getLabels(Locale locale) {
}

In groovy, or any other type of language:

myRow.getLabels('fr').workEffortTypeId

--

Of course, none of this is actually implemented yet.  And, for speed,
the returned map should do a lazy lookup.  Ie, the returned map should
not attempt to find all the translated values when the getLabels()
method is called.
Reply | Threaded
Open this post in threaded view
|

Re: how to use entitylabels somewhere else

Scott Gray-2
GenericValues implement LocalizedMap, simply using value.get("description", locale) should return the localized description.

Regards
Scott

On 18/06/2010, at 4:30 AM, Adam Heath wrote:

> Matthieu Bollot wrote:
>> Hi,
>> Is there a way to use entitylabels in a groovy ?
>> I've got a genericValue that contains a result, for example a workEffort
>> with workEffortTypeId:ROUTING that I can get with
>> myRow['workEffortTypeId']
>
> myRow.workEffortTypeId is better.
>
>> And I want to get the string of WorkEffortType.description.ROUTING from
>> workEffortEntityLabels which will be 'routing' in english, 'routage' in
>> french and so on.
>
> I'm thinking about something groovy-ish; brainstorming...
>
> In GenericEntity.java:
>
> public Map<String, String> getLabels(Locale locale) {
> }
>
> In groovy, or any other type of language:
>
> myRow.getLabels('fr').workEffortTypeId
>
> --
>
> Of course, none of this is actually implemented yet.  And, for speed,
> the returned map should do a lazy lookup.  Ie, the returned map should
> not attempt to find all the translated values when the getLabels()
> method is called.


smime.p7s (3K) Download Attachment