Curiosity about findByPrimaryKey fromDate ignore millisec & minilang handling

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

Curiosity about findByPrimaryKey fromDate ignore millisec & minilang handling

justin.g.robinson
I'm debugging the projectmgr for our use & came accross this situation.

 <service name="removeWorkEffortAssoc" engine="simple"
default-entity-name="WorkEffortAssoc"
            location="component://workeffort/script/org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml"
invoke="removeWorkEffortAssoc">

 <simple-method method-name="removeWorkEffortAssoc"
short-description="Remove a WorkEffort association">
        <entity-one entity-name="WorkEffortAssoc" value-field="lookedUpValue"/>
        <remove-value value-field="lookedUpValue"/>
    </simple-method>

On trying to delete a WorkEffortAssoc it throws an exception
lookedUpValue missing or some such, not wanting to spend to much time
trying to figure out the how and why of the ever cryptic
'simple-method' involved, I wrote a replacement service to do the same
thing & found I couldn't findByPrimaryKey as WorkEffortAssoc pk
includes fromDate and the hidden field in the form doesn't have
millisecs for the fromDate:

 uneq: db fromDate: 2011-06-09 15:45:55.873. form fromDate2:
2011-06-09 15:45:55.0

I got around the problem with some verbosity in my replacement service
implementation, but writing replacement services instead of fixing
existing is kinda bad form.
I assume projectmgr works or has worked & am really curious how this
sort of problem is over come by the simple method above that I don't
understand.

Can anyone who works with minilang explain this one to me?

--
Regards,
Justin
Venture-Net Research & Development
Reply | Threaded
Open this post in threaded view
|

Re: Curiosity about findByPrimaryKey fromDate ignore millisec & minilang handling

Scott Gray-2
Hi Justin,

It's probably a newly introduced issue with how timestamps are being rendered in the input field or possibly some bug specific to the project manager app.  This is definitely not a common problem or if it is then it's recently introduced.

By the way, the simple method is pretty straightforward, entity-one is analogous to findByPrimaryKey except that minilang automatically maps the variables in the context to the primary key of the entity being searched for.  So it's just a lookup then delete, the error is complaining that the call to remove-value is providing a null value for removal.  The easiest way to debug minilang is to use <log> statements to inspect variables and throw in a <transaction-rollback/> afterwards, rolling back the transaction means you can keep hitting refresh on the browser while debugging and nothing gets saved, nice for easy repeatability.

Regards
Scott

HotWax Media
http://www.hotwaxmedia.com

On 13/06/2011, at 9:25 PM, Justin Robinson wrote:

> I'm debugging the projectmgr for our use & came accross this situation.
>
> <service name="removeWorkEffortAssoc" engine="simple"
> default-entity-name="WorkEffortAssoc"
>            location="component://workeffort/script/org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml"
> invoke="removeWorkEffortAssoc">
>
> <simple-method method-name="removeWorkEffortAssoc"
> short-description="Remove a WorkEffort association">
>        <entity-one entity-name="WorkEffortAssoc" value-field="lookedUpValue"/>
>        <remove-value value-field="lookedUpValue"/>
>    </simple-method>
>
> On trying to delete a WorkEffortAssoc it throws an exception
> lookedUpValue missing or some such, not wanting to spend to much time
> trying to figure out the how and why of the ever cryptic
> 'simple-method' involved, I wrote a replacement service to do the same
> thing & found I couldn't findByPrimaryKey as WorkEffortAssoc pk
> includes fromDate and the hidden field in the form doesn't have
> millisecs for the fromDate:
>
> uneq: db fromDate: 2011-06-09 15:45:55.873. form fromDate2:
> 2011-06-09 15:45:55.0
>
> I got around the problem with some verbosity in my replacement service
> implementation, but writing replacement services instead of fixing
> existing is kinda bad form.
> I assume projectmgr works or has worked & am really curious how this
> sort of problem is over come by the simple method above that I don't
> understand.
>
> Can anyone who works with minilang explain this one to me?
>
> --
> Regards,
> Justin
> Venture-Net Research & Development


smime.p7s (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Curiosity about findByPrimaryKey fromDate ignore millisec & minilang handling

justin.g.robinson
Thanks Scott, it looks like the simple-method fails for the same
reason in that case, I'll have a look for were it is placed in the
hidden field and see if the millsec can be included then there'd be no
issue with the look up.

Whenever I ask about minilang I am surprised at how simple it actually
is, I just wish there was a cheat sheet somewhere, have tried looking
in http://ofbiz.apache.org/dtds/simple-methods.xsd for clues but a one
liner explanation of each tag or just the less obvious ones would be a
big help. I'll keep looking there must be one somewhere.



--
Regards,
Justin
Venture-Net Research & Development

On Mon, Jun 13, 2011 at 2:00 PM, Scott Gray <[hidden email]> wrote:

> Hi Justin,
>
> It's probably a newly introduced issue with how timestamps are being rendered in the input field or possibly some bug specific to the project manager app.  This is definitely not a common problem or if it is then it's recently introduced.
>
> By the way, the simple method is pretty straightforward, entity-one is analogous to findByPrimaryKey except that minilang automatically maps the variables in the context to the primary key of the entity being searched for.  So it's just a lookup then delete, the error is complaining that the call to remove-value is providing a null value for removal.  The easiest way to debug minilang is to use <log> statements to inspect variables and throw in a <transaction-rollback/> afterwards, rolling back the transaction means you can keep hitting refresh on the browser while debugging and nothing gets saved, nice for easy repeatability.
>
> Regards
> Scott
>
> HotWax Media
> http://www.hotwaxmedia.com
>
> On 13/06/2011, at 9:25 PM, Justin Robinson wrote:
>
>> I'm debugging the projectmgr for our use & came accross this situation.
>>
>> <service name="removeWorkEffortAssoc" engine="simple"
>> default-entity-name="WorkEffortAssoc"
>>            location="component://workeffort/script/org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml"
>> invoke="removeWorkEffortAssoc">
>>
>> <simple-method method-name="removeWorkEffortAssoc"
>> short-description="Remove a WorkEffort association">
>>        <entity-one entity-name="WorkEffortAssoc" value-field="lookedUpValue"/>
>>        <remove-value value-field="lookedUpValue"/>
>>    </simple-method>
>>
>> On trying to delete a WorkEffortAssoc it throws an exception
>> lookedUpValue missing or some such, not wanting to spend to much time
>> trying to figure out the how and why of the ever cryptic
>> 'simple-method' involved, I wrote a replacement service to do the same
>> thing & found I couldn't findByPrimaryKey as WorkEffortAssoc pk
>> includes fromDate and the hidden field in the form doesn't have
>> millisecs for the fromDate:
>>
>> uneq: db fromDate: 2011-06-09 15:45:55.873. form fromDate2:
>> 2011-06-09 15:45:55.0
>>
>> I got around the problem with some verbosity in my replacement service
>> implementation, but writing replacement services instead of fixing
>> existing is kinda bad form.
>> I assume projectmgr works or has worked & am really curious how this
>> sort of problem is over come by the simple method above that I don't
>> understand.
>>
>> Can anyone who works with minilang explain this one to me?
>>
>> --
>> Regards,
>> Justin
>> Venture-Net Research & Development
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Curiosity about findByPrimaryKey fromDate ignore millisec & minilang handling

Jacques Le Roux
Administrator
https://cwiki.apache.org/confluence/display/OFBIZ/Mini-Language+Guide

Jacques

From: "Justin Robinson" <[hidden email]>

> Thanks Scott, it looks like the simple-method fails for the same
> reason in that case, I'll have a look for were it is placed in the
> hidden field and see if the millsec can be included then there'd be no
> issue with the look up.
>
> Whenever I ask about minilang I am surprised at how simple it actually
> is, I just wish there was a cheat sheet somewhere, have tried looking
> in http://ofbiz.apache.org/dtds/simple-methods.xsd for clues but a one
> liner explanation of each tag or just the less obvious ones would be a
> big help. I'll keep looking there must be one somewhere.
>
>
>
> --
> Regards,
> Justin
> Venture-Net Research & Development
>
> On Mon, Jun 13, 2011 at 2:00 PM, Scott Gray <[hidden email]> wrote:
>> Hi Justin,
>>
>> It's probably a newly introduced issue with how timestamps are being rendered in the input field or possibly some bug specific to
>> the project manager app. This is definitely not a common problem or if it is then it's recently introduced.
>>
>> By the way, the simple method is pretty straightforward, entity-one is analogous to findByPrimaryKey except that minilang
>> automatically maps the variables in the context to the primary key of the entity being searched for. So it's just a lookup then
>> delete, the error is complaining that the call to remove-value is providing a null value for removal. The easiest way to debug
>> minilang is to use <log> statements to inspect variables and throw in a <transaction-rollback/> afterwards, rolling back the
>> transaction means you can keep hitting refresh on the browser while debugging and nothing gets saved, nice for easy
>> repeatability.
>>
>> Regards
>> Scott
>>
>> HotWax Media
>> http://www.hotwaxmedia.com
>>
>> On 13/06/2011, at 9:25 PM, Justin Robinson wrote:
>>
>>> I'm debugging the projectmgr for our use & came accross this situation.
>>>
>>> <service name="removeWorkEffortAssoc" engine="simple"
>>> default-entity-name="WorkEffortAssoc"
>>> location="component://workeffort/script/org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml"
>>> invoke="removeWorkEffortAssoc">
>>>
>>> <simple-method method-name="removeWorkEffortAssoc"
>>> short-description="Remove a WorkEffort association">
>>> <entity-one entity-name="WorkEffortAssoc" value-field="lookedUpValue"/>
>>> <remove-value value-field="lookedUpValue"/>
>>> </simple-method>
>>>
>>> On trying to delete a WorkEffortAssoc it throws an exception
>>> lookedUpValue missing or some such, not wanting to spend to much time
>>> trying to figure out the how and why of the ever cryptic
>>> 'simple-method' involved, I wrote a replacement service to do the same
>>> thing & found I couldn't findByPrimaryKey as WorkEffortAssoc pk
>>> includes fromDate and the hidden field in the form doesn't have
>>> millisecs for the fromDate:
>>>
>>> uneq: db fromDate: 2011-06-09 15:45:55.873. form fromDate2:
>>> 2011-06-09 15:45:55.0
>>>
>>> I got around the problem with some verbosity in my replacement service
>>> implementation, but writing replacement services instead of fixing
>>> existing is kinda bad form.
>>> I assume projectmgr works or has worked & am really curious how this
>>> sort of problem is over come by the simple method above that I don't
>>> understand.
>>>
>>> Can anyone who works with minilang explain this one to me?
>>>
>>> --
>>> Regards,
>>> Justin
>>> Venture-Net Research & Development
>>
>>
>