[
http://jira.jboss.com/jira/browse/JBRULES-647?page=comments#action_12360993 ]
Edson Tirelli commented on JBRULES-647:
---------------------------------------
My suggestion is the obvious one: lets start simple and build over it.
What about date literals? Dates are also kind of a special case I
think. On the LHS in drl dates are pretty easy, we just slap quotes around them and the
compiler takes care of it. But on the RHS we need to new java.util.Date() - although MVEL
may take care of it.
Yes, the old java Date issue. I think what we need to do is to
define a general (maybe configurable) mask for dates and automatically parse strings into
dates in the input fields. This can be based on the field type, as we already do
manipulations for strings (adding quotes) and formulas (removing the = sign).
Do we allow a field to be set to a bound variable?
Sure. From a
code generation perspective, it is already supported. Just a matter of allowing users to
chose or type variables in the Web GUI.
We can deal with string/number literals, but what about dates?
See above.
Say we want to set a field to a calculation, for a non String, this
should work as it is now right? so we have a "value" of "x *3.0 -
someVar", then that will be: boundVariable.setSomeField(x * 3.0 - someVar), UNLESS it
is a string, in which case it will try to wrap quotes around it (which is not really a
problem, as you generall don't do calculations with a string).
The way it is
now, from code generation perspective, it is already working. The key thing is that if the
field type is String and you want to do manipulations, you MUST use the '=' sign
prefixing the expression so that the engine knows it is a formula. If it is not a String,
that the '=' is optional. It will work both with and without it.
I guess my original question remains: shoudl we ask the user to
classify if they are doing a literal, a formula or choosing from a list of variables? or
is that overkill and unhelpful?
Lets do something similar to what Excel does... if
it is a literal, variable, etc, the user simply types/selects it. If it is a formula, user
can start the expression with '=' (exactly like excel) or maybe use a wizard when
we build one. Only thing is not there yet, but easy to implement as soon as we define how
it will work is Date parsing.
Regarding the "type" field in ActionSetField, I think it is a useful declarative
information for the model and it is good to have it there, independent of the
SuggestionCompletionEngine. I think we may not have the SCE always available everywhere to
use and having the field type information makes it kind of "self-contained".
So, what we do regarding Dates? Does JodaTime has anything useful we can use here?
RuleModel to populate Descr for rendering to DRL
------------------------------------------------
Key: JBRULES-647
URL:
http://jira.jboss.com/jira/browse/JBRULES-647
Project: JBoss Rules
Issue Type: Sub-task
Security Level: Public(Everyone can see)
Reporter: Michael Neale
Assigned To: Edson Tirelli
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira