"Maps.properties" is just a name I choose for the enumeration. You can use
whatever identifier you want, but..... The identifier has to be of the form
<string>.<string>. It has to have a dot (.). I think this is because
enumeration were created for bind a fact type attribute to a list of values.
Best Regards,
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Esteban Aliverti
- Developer @
I don't think that enums needs to be linked to a Pojo attribute.
To me it
is just an identifier used in ENUM DSL constraints. The 'properties' is not
an attribute of a Map. I think you could set it to whatever you like
(something more linked to your problem).
For making that dynamic, it is explained in the guvnor
doc<http://drools.herod.net/drools-guvnor/html_single/index.html>(c...
"1.4.2.4.8. Data enumerations (drop down list configurations)" )
'Person.age' : (new com.yourco.DataHelper()).getListOfAges()
But I never tried that.
Le 02/03/2011 14:06, ioda100 a écrit :
Really thank you, it's working fine. I will see if it's working for my more
difficult case.
On Tue, Mar 1, 2011 at 11:28 PM, Esteban [via Drools - Java Rules Engine]
<[hidden
email]<http://user/SendEmail.jtp?type=node&node=2613230&i=0&by-user=t>
> wrote:
> You need to create the DSL first.
> Follow these steps:
> 1.- Add java.util.Map to package imports (I think you already did this)
> 2.- Create a new Enumeration with the following content:
> *'Map.properties': ['prop1', 'prop2', 'prop3']*
> 3.- Create a new DSL with this content:
> *[when]The property {key:ENUM:Map.properties} of the map is
> {value}=Map((this["{key}"] == "{value}"))*
> 4.- Create a new Rule and add the DSL sentence to the WHEN part. You
> should see the drop down.
>
> Note the name of the enumeration and how the variable {key} is defined in
> the DSL. I think you can also read the enumerations from a Java Enum present
> on your model, but I'm not sure about it. Does anyone know about this?
>
> Best Regards,
>
> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
>
> Esteban Aliverti
> - Developer @
http://www.plugtree.com
> - Blog @
http://ilesteban.wordpress.com
>
>
> 2011/3/1 ioda100 <[hidden
email]<http://user/SendEmail.jtp?type=node&node=2607065&i=0>
> >
>
>> Yes but for this i will be obliged to create a POJO of an object. And for
>> attributes of that object in DSL i can define values that can take this
>> attribute?
>>
>> Maybe i don't understand but i don't see how to do with this.
>>
>> My case :
>> I have Maps in the session. Each Map has for example 5 properties
>> ("prop1", "prop2", "prop3", "prop4",
"prop51") and the value is a string.
>> The Map is Map<String, Object> but generally Object is a String.
>> So in the When clause i have something like that :
>> $m : Map((this["prop1"] == "test1"))
>> I have included java.utils.Map in Guvnor. So when i add a when clause i
>> can choose Map in the list but impossible to have "prop1" to
"prop5" in a
>> drop down list for attributes of the Map.
>> Would it be possible to create a Pojo for Map or would it be in conflict
>> with the Map of Java?
>>
>> Thank you for your time
>>
>>
>> Le 1/03/2011 17:55, Vincent Legendre [via Drools - Java Rules Engine] a
>> écrit :
>>
>> Le 01/03/2011 15:39, ioda100 a écrit :
>>
>> Thanks for your quick answer Esteban.
>>
>> 1) Ok i will have a look at DSL. In fact in my map i know all the
>> properties (about 200). It would be cool to be able to have a drop down list
>> with all these attributes as when we do it with objects for which we gave
>> Pojo to Guvnor.
>>
>> You can define enumerations for a particular attribute.
>> Inside a DSL you can constrain a placeholder with that enumeration.
>> And finally, enums can be static, or dynamic (a interface to implement
>> that returns a list of values).
>>
>> search the Guvnor's doc in these chapters
>> 1.4.2.4.8. Data enumerations (drop down list configurations)
>>
>> _______________________________________________
>> rules-users mailing list
>> [hidden
email]<http://user/SendEmail.jtp?type=node&node=2604255&i=0&by-user=t>
>>
https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>> ------------------------------
>> If you reply to this email, your message will be added to the
>> discussion below:
>>
>>
http://drools-java-rules-engine.46999.n3.nabble.com/Guvnor-and-drools-imp...
>> To unsubscribe from Guvnor and drools implementation - questions, click
>>
here<http://drools-java-rules-engine.46999.n3.nabble.com/template/Naml...;.
>>
>>
>>
>> ------------------------------
>> View this message in context: Re: Guvnor and drools implementation -
>>
questions<http://drools-java-rules-engine.46999.n3.nabble.com/Guvnor-a...
>>
>> Sent from the Drools - User mailing list
archive<http://drools-java-rules-engine.46999.n3.nabble.com/Drools-Use...
Nabble.com.
>>
>> _______________________________________________
>>
>> rules-users mailing list
>> [hidden email]
<
http://user/SendEmail.jtp?type=node&node=2607065&i=1>
>>
https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>
> _______________________________________________
> rules-users mailing list
> [hidden email] <
http://user/SendEmail.jtp?type=node&node=2607065&i=2>
>
https://lists.jboss.org/mailman/listinfo/rules-users
>
>
> ------------------------------
> If you reply to this email, your message will be added to the
> discussion below:
>
>
http://drools-java-rules-engine.46999.n3.nabble.com/Guvnor-and-drools-imp...
>
------------------------------
View this message in context: Re: Guvnor and drools implementation -
questions<http://drools-java-rules-engine.46999.n3.nabble.com/Guvnor-a...
Sent from the Drools - User mailing list
archive<http://drools-java-rules-engine.46999.n3.nabble.com/Drools-Use...
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Vincent LEGENDRE
*Consultant Sénior*
EURODECISION
9A rue de la Porte de Buc 78000 VERSAILLES
Tél. : +33 (0)1 39 07 12 40
Direct : +33 (0)1 39 07 26 16
www.eurodecision.com
[image: EURODECISION] <
http://www.eurodecision.com/>
<
http://www.eurodecision.com/>
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users