Calling class method from within a simple method

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

Calling class method from within a simple method

Naveen Kumar-3
Hi All,

I am trying, following snippet in a simple method.

<set field="intervalDays" value="0" />
                <call-class-method
class-name="org.ofbiz.base.util.UtilDateTime" method-name="getMonthStart"
ret-field="invoicePaymentInfo.dueDate">
                    <field field="invoice.invoiceDate" type="Timestamp"/>
                    <field field="intervalDays" type="Long" />
                    <field field="invoiceTerm.termDays" type="Long"/>
                </call-class-method>

I am getting method not found error,

/PaymentServices.xml#getInvoicePaymentInfoList] process [Could not find
method to execute named getMonthStart: java.lang.NoSuchMethodException:
org.ofbiz.base.util.UtilDateTime.getMonthStart(java.sql.Timestamp,
java.lang.Long)]

Can anyone help me out to sort this issue.

Regards,
Naveen.
Reply | Threaded
Open this post in threaded view
|

Re: Calling class method from within a simple method

Jacques Le Roux
Administrator
Did you try with type int instead of Long?

Jacques

From: "Naveen Kumar" <[hidden email]>

> Hi All,
>
> I am trying, following snippet in a simple method.
>
> <set field="intervalDays" value="0" />
>                <call-class-method
> class-name="org.ofbiz.base.util.UtilDateTime" method-name="getMonthStart"
> ret-field="invoicePaymentInfo.dueDate">
>                    <field field="invoice.invoiceDate" type="Timestamp"/>
>                    <field field="intervalDays" type="Long" />
>                    <field field="invoiceTerm.termDays" type="Long"/>
>                </call-class-method>
>
> I am getting method not found error,
>
> /PaymentServices.xml#getInvoicePaymentInfoList] process [Could not find
> method to execute named getMonthStart: java.lang.NoSuchMethodException:
> org.ofbiz.base.util.UtilDateTime.getMonthStart(java.sql.Timestamp,
> java.lang.Long)]
>
> Can anyone help me out to sort this issue.
>
> Regards,
> Naveen.
>

Reply | Threaded
Open this post in threaded view
|

Re: Calling class method from within a simple method

yosalfa
In reply to this post by Naveen Kumar-3
I see in the trace log you are trying to call method with 2 parameters while in your sevice definition you have method with 3 parameters.

Regards,

Yosalfa
Reply | Threaded
Open this post in threaded view
|

Re: Calling class method from within a simple method

Naveen Kumar-3
In reply to this post by Jacques Le Roux
Hi Jacques,

I tried with type int, but ended up with the below mentioned error.

ERROR: Could not complete the Create a list with information on payment due
dates and amounts for the invoice
[file:/home/naveen/workspace/ofbiz.10.04/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml#getInvoicePaymentInfoList]
process [Illegal argument calling method to execute named getMonthStart:
java.lang.IllegalArgumentException: argument type mismatch] (Error getting
value from the database for display of field [invoiceItemTypeId] on form
[invoiceItems]:

Regards,
Naveen.

On Sun, Dec 5, 2010 at 1:32 AM, Jacques Le Roux <
[hidden email]> wrote:

> Did you try with type int instead of Long?
>
> Jacques
>
> From: "Naveen Kumar" <[hidden email]>
>
>  Hi All,
>>
>> I am trying, following snippet in a simple method.
>>
>> <set field="intervalDays" value="0" />
>>               <call-class-method
>> class-name="org.ofbiz.base.util.UtilDateTime" method-name="getMonthStart"
>> ret-field="invoicePaymentInfo.dueDate">
>>                   <field field="invoice.invoiceDate" type="Timestamp"/>
>>                   <field field="intervalDays" type="Long" />
>>                   <field field="invoiceTerm.termDays" type="Long"/>
>>               </call-class-method>
>>
>> I am getting method not found error,
>>
>> /PaymentServices.xml#getInvoicePaymentInfoList] process [Could not find
>> method to execute named getMonthStart: java.lang.NoSuchMethodException:
>> org.ofbiz.base.util.UtilDateTime.getMonthStart(java.sql.Timestamp,
>> java.lang.Long)]
>>
>> Can anyone help me out to sort this issue.
>>
>> Regards,
>> Naveen.
>>
>>
>
Reply | Threaded
Open this post in threaded view
|

Re: Calling class method from within a simple method

Adrian Crum-2
Try using one of the UEL functions:

http://ci.apache.org/projects/ofbiz/site/javadocs/

-Adrian

--- On Sun, 12/5/10, Naveen Kumar <[hidden email]> wrote:

> From: Naveen Kumar <[hidden email]>
> Subject: Re: Calling class method from within a simple method
> To: [hidden email], "Jacques Le Roux" <[hidden email]>
> Date: Sunday, December 5, 2010, 9:05 PM
> Hi Jacques,
>
> I tried with type int, but ended up with the below
> mentioned error.
>
> ERROR: Could not complete the Create a list with
> information on payment due
> dates and amounts for the invoice
> [file:/home/naveen/workspace/ofbiz.10.04/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml#getInvoicePaymentInfoList]
> process [Illegal argument calling method to execute named
> getMonthStart:
> java.lang.IllegalArgumentException: argument type mismatch]
> (Error getting
> value from the database for display of field
> [invoiceItemTypeId] on form
> [invoiceItems]:
>
> Regards,
> Naveen.
>
> On Sun, Dec 5, 2010 at 1:32 AM, Jacques Le Roux <
> [hidden email]>
> wrote:
>
> > Did you try with type int instead of Long?
> >
> > Jacques
> >
> > From: "Naveen Kumar" <[hidden email]>
> >
> >  Hi All,
> >>
> >> I am trying, following snippet in a simple
> method.
> >>
> >> <set field="intervalDays" value="0" />
> >>           
>    <call-class-method
> >> class-name="org.ofbiz.base.util.UtilDateTime"
> method-name="getMonthStart"
> >> ret-field="invoicePaymentInfo.dueDate">
> >>             
>      <field
> field="invoice.invoiceDate" type="Timestamp"/>
> >>             
>      <field field="intervalDays"
> type="Long" />
> >>             
>      <field
> field="invoiceTerm.termDays" type="Long"/>
> >>           
>    </call-class-method>
> >>
> >> I am getting method not found error,
> >>
> >> /PaymentServices.xml#getInvoicePaymentInfoList]
> process [Could not find
> >> method to execute named getMonthStart:
> java.lang.NoSuchMethodException:
> >>
> org.ofbiz.base.util.UtilDateTime.getMonthStart(java.sql.Timestamp,
> >> java.lang.Long)]
> >>
> >> Can anyone help me out to sort this issue.
> >>
> >> Regards,
> >> Naveen.
> >>
> >>
> >
>



Reply | Threaded
Open this post in threaded view
|

Re: Calling class method from within a simple method

Adrian Crum-2
Argh! Stupid HTML frames.

Try using one of the UEL functions:

http://ci.apache.org/projects/ofbiz/site/javadocs/org/ofbiz/base/util/string/UelFunctions.html

-Adrian

--- On Sun, 12/5/10, Adrian Crum <[hidden email]> wrote:

> Try using one of the UEL functions:
>
> http://ci.apache.org/projects/ofbiz/site/javadocs/
>
> -Adrian
>
> --- On Sun, 12/5/10, Naveen Kumar <[hidden email]>
> wrote:
>
> > From: Naveen Kumar <[hidden email]>
> > Subject: Re: Calling class method from within a simple
> method
> > To: [hidden email],
> "Jacques Le Roux" <[hidden email]>
> > Date: Sunday, December 5, 2010, 9:05 PM
> > Hi Jacques,
> >
> > I tried with type int, but ended up with the below
> > mentioned error.
> >
> > ERROR: Could not complete the Create a list with
> > information on payment due
> > dates and amounts for the invoice
> >
> [file:/home/naveen/workspace/ofbiz.10.04/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml#getInvoicePaymentInfoList]
> > process [Illegal argument calling method to execute
> named
> > getMonthStart:
> > java.lang.IllegalArgumentException: argument type
> mismatch]
> > (Error getting
> > value from the database for display of field
> > [invoiceItemTypeId] on form
> > [invoiceItems]:
> >
> > Regards,
> > Naveen.
> >
> > On Sun, Dec 5, 2010 at 1:32 AM, Jacques Le Roux <
> > [hidden email]>
> > wrote:
> >
> > > Did you try with type int instead of Long?
> > >
> > > Jacques
> > >
> > > From: "Naveen Kumar" <[hidden email]>
> > >
> > >  Hi All,
> > >>
> > >> I am trying, following snippet in a simple
> > method.
> > >>
> > >> <set field="intervalDays" value="0" />
> > >>           
> >    <call-class-method
> > >>
> class-name="org.ofbiz.base.util.UtilDateTime"
> > method-name="getMonthStart"
> > >> ret-field="invoicePaymentInfo.dueDate">
> > >>             
> >      <field
> > field="invoice.invoiceDate" type="Timestamp"/>
> > >>             
> >      <field field="intervalDays"
> > type="Long" />
> > >>             
> >      <field
> > field="invoiceTerm.termDays" type="Long"/>
> > >>           
> >    </call-class-method>
> > >>
> > >> I am getting method not found error,
> > >>
> > >>
> /PaymentServices.xml#getInvoicePaymentInfoList]
> > process [Could not find
> > >> method to execute named getMonthStart:
> > java.lang.NoSuchMethodException:
> > >>
> >
> org.ofbiz.base.util.UtilDateTime.getMonthStart(java.sql.Timestamp,
> > >> java.lang.Long)]
> > >>
> > >> Can anyone help me out to sort this issue.
> > >>
> > >> Regards,
> > >> Naveen.
> > >>
> > >>
> > >
> >
>
>
>
>



Reply | Threaded
Open this post in threaded view
|

Re: Calling class method from within a simple method

Naveen Kumar-3
Hi Adrian,

I am trying to extend the payment/due date calculation simple-method
"getPaymentInfoList" to do calculation based on month intervals instead of
days. I need to calculate dates spread across 1 month and was trying to use
getMonthStart with month interval argument.

Regards,
Naveen.

On Mon, Dec 6, 2010 at 10:49 AM, Adrian Crum <[hidden email]> wrote:

> Argh! Stupid HTML frames.
>
> Try using one of the UEL functions:
>
>
> http://ci.apache.org/projects/ofbiz/site/javadocs/org/ofbiz/base/util/string/UelFunctions.html
>
> -Adrian
>
> --- On Sun, 12/5/10, Adrian Crum <[hidden email]> wrote:
> > Try using one of the UEL functions:
> >
> > http://ci.apache.org/projects/ofbiz/site/javadocs/
> >
> > -Adrian
> >
> > --- On Sun, 12/5/10, Naveen Kumar <[hidden email]>
> > wrote:
> >
> > > From: Naveen Kumar <[hidden email]>
> > > Subject: Re: Calling class method from within a simple
> > method
> > > To: [hidden email],
> > "Jacques Le Roux" <[hidden email]>
> > > Date: Sunday, December 5, 2010, 9:05 PM
> > > Hi Jacques,
> > >
> > > I tried with type int, but ended up with the below
> > > mentioned error.
> > >
> > > ERROR: Could not complete the Create a list with
> > > information on payment due
> > > dates and amounts for the invoice
> > >
> >
> [file:/home/naveen/workspace/ofbiz.10.04/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml#getInvoicePaymentInfoList]
> > > process [Illegal argument calling method to execute
> > named
> > > getMonthStart:
> > > java.lang.IllegalArgumentException: argument type
> > mismatch]
> > > (Error getting
> > > value from the database for display of field
> > > [invoiceItemTypeId] on form
> > > [invoiceItems]:
> > >
> > > Regards,
> > > Naveen.
> > >
> > > On Sun, Dec 5, 2010 at 1:32 AM, Jacques Le Roux <
> > > [hidden email]>
> > > wrote:
> > >
> > > > Did you try with type int instead of Long?
> > > >
> > > > Jacques
> > > >
> > > > From: "Naveen Kumar" <[hidden email]>
> > > >
> > > >  Hi All,
> > > >>
> > > >> I am trying, following snippet in a simple
> > > method.
> > > >>
> > > >> <set field="intervalDays" value="0" />
> > > >>
> > >    <call-class-method
> > > >>
> > class-name="org.ofbiz.base.util.UtilDateTime"
> > > method-name="getMonthStart"
> > > >> ret-field="invoicePaymentInfo.dueDate">
> > > >>
> > >      <field
> > > field="invoice.invoiceDate" type="Timestamp"/>
> > > >>
> > >      <field field="intervalDays"
> > > type="Long" />
> > > >>
> > >      <field
> > > field="invoiceTerm.termDays" type="Long"/>
> > > >>
> > >    </call-class-method>
> > > >>
> > > >> I am getting method not found error,
> > > >>
> > > >>
> > /PaymentServices.xml#getInvoicePaymentInfoList]
> > > process [Could not find
> > > >> method to execute named getMonthStart:
> > > java.lang.NoSuchMethodException:
> > > >>
> > >
> > org.ofbiz.base.util.UtilDateTime.getMonthStart(java.sql.Timestamp,
> > > >> java.lang.Long)]
> > > >>
> > > >> Can anyone help me out to sort this issue.
> > > >>
> > > >> Regards,
> > > >> Naveen.
> > > >>
> > > >>
> > > >
> > >
> >
> >
> >
> >
>
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Calling class method from within a simple method

Naveen Kumar-3
Hi All,

It was a type casting problem as Jacques suggested. The function
"getMonthStart" expects int as parameter. But, in entity the field type was
long. I fixed it by doing casting operation. Thanks for your support.

Regards,
Naveen.

On Mon, Dec 6, 2010 at 12:01 PM, Naveen Kumar <[hidden email]>wrote:

> Hi Adrian,
>
> I am trying to extend the payment/due date calculation simple-method
> "getPaymentInfoList" to do calculation based on month intervals instead of
> days. I need to calculate dates spread across 1 month and was trying to use
> getMonthStart with month interval argument.
>
> Regards,
> Naveen.
>
> On Mon, Dec 6, 2010 at 10:49 AM, Adrian Crum <[hidden email]>wrote:
>
>> Argh! Stupid HTML frames.
>>
>> Try using one of the UEL functions:
>>
>>
>> http://ci.apache.org/projects/ofbiz/site/javadocs/org/ofbiz/base/util/string/UelFunctions.html
>>
>> -Adrian
>>
>> --- On Sun, 12/5/10, Adrian Crum <[hidden email]> wrote:
>> > Try using one of the UEL functions:
>> >
>> > http://ci.apache.org/projects/ofbiz/site/javadocs/
>> >
>> > -Adrian
>> >
>> > --- On Sun, 12/5/10, Naveen Kumar <[hidden email]>
>> > wrote:
>> >
>> > > From: Naveen Kumar <[hidden email]>
>> > > Subject: Re: Calling class method from within a simple
>> > method
>> > > To: [hidden email],
>> > "Jacques Le Roux" <[hidden email]>
>> > > Date: Sunday, December 5, 2010, 9:05 PM
>> > > Hi Jacques,
>> > >
>> > > I tried with type int, but ended up with the below
>> > > mentioned error.
>> > >
>> > > ERROR: Could not complete the Create a list with
>> > > information on payment due
>> > > dates and amounts for the invoice
>> > >
>> >
>> [file:/home/naveen/workspace/ofbiz.10.04/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml#getInvoicePaymentInfoList]
>> > > process [Illegal argument calling method to execute
>> > named
>> > > getMonthStart:
>> > > java.lang.IllegalArgumentException: argument type
>> > mismatch]
>> > > (Error getting
>> > > value from the database for display of field
>> > > [invoiceItemTypeId] on form
>> > > [invoiceItems]:
>> > >
>> > > Regards,
>> > > Naveen.
>> > >
>> > > On Sun, Dec 5, 2010 at 1:32 AM, Jacques Le Roux <
>> > > [hidden email]>
>> > > wrote:
>> > >
>> > > > Did you try with type int instead of Long?
>> > > >
>> > > > Jacques
>> > > >
>> > > > From: "Naveen Kumar" <[hidden email]>
>> > > >
>> > > >  Hi All,
>> > > >>
>> > > >> I am trying, following snippet in a simple
>> > > method.
>> > > >>
>> > > >> <set field="intervalDays" value="0" />
>> > > >>
>> > >    <call-class-method
>> > > >>
>> > class-name="org.ofbiz.base.util.UtilDateTime"
>> > > method-name="getMonthStart"
>> > > >> ret-field="invoicePaymentInfo.dueDate">
>> > > >>
>> > >      <field
>> > > field="invoice.invoiceDate" type="Timestamp"/>
>> > > >>
>> > >      <field field="intervalDays"
>> > > type="Long" />
>> > > >>
>> > >      <field
>> > > field="invoiceTerm.termDays" type="Long"/>
>> > > >>
>> > >    </call-class-method>
>> > > >>
>> > > >> I am getting method not found error,
>> > > >>
>> > > >>
>> > /PaymentServices.xml#getInvoicePaymentInfoList]
>> > > process [Could not find
>> > > >> method to execute named getMonthStart:
>> > > java.lang.NoSuchMethodException:
>> > > >>
>> > >
>> > org.ofbiz.base.util.UtilDateTime.getMonthStart(java.sql.Timestamp,
>> > > >> java.lang.Long)]
>> > > >>
>> > > >> Can anyone help me out to sort this issue.
>> > > >>
>> > > >> Regards,
>> > > >> Naveen.
>> > > >>
>> > > >>
>> > > >
>> > >
>> >
>> >
>> >
>> >
>>
>>
>>
>>
>