Problem with ICcStandAloneExtension using double and integer

Posted by afaayfab on 24-Jan-2014 06:22

Hi all,

Hi all, I'm new using Corticon and I am having problems using ICcStandAloneExtension. I have created some very very easy examples and I am not able to make some of them work. Below, you can find the Java Class. Each method has as a comment whether it works or not when I call it from a rule.

So, when I  use for instance, test2:

public static Integer test2(Integer param1) {
              return Integer.valueOf(param1 * 12);
}

in the rulesheet file would be:

   currentLoan.duration =LoanOperators.test2(2)

where currentLoan.duration is an Integer, the input parameter is also an Integer and the method output is an Integer.

it shows an Error type: Invalid parameters.

But if I use for instance test7:

currentLoan.duration=LoanOperators.test7(1,5) where currentLoan.duration is an Integer, the output method is an Integer and the input parameter is a BigDecimal, it works perfectly. 

About my environment:

- Windows 7, locale configuration: spanish (castilian)

- Progress Corticon 5.3

package loan.operators;

import java.math.BigDecimal;

import com.corticon.services.extensions.ICcStandAloneExtension;

public class LoanOperators implements ICcStandAloneExtension {

	// Does not work
	public static Integer computeYearlyRepayment(BigDecimal yearlyInterestRate,	Integer amount, Integer duration) {
		
		return Integer.valueOf(1);
	}

	// Does not work
	public static Integer test0(BigDecimal yearlyInterestRate, Integer amount) {
		return 1;
	}

	// Does not work
	public static Integer test1(Integer param1, Integer param2) {
		return Integer.valueOf(12);
	}

	// Does not work
	public static Integer test2(Integer param1) {
		return Integer.valueOf(param1 * 12);
	}

	// Works
	public static Integer test3(int param1) {
		return Integer.valueOf(param1 * 12);
	}

	// Works
	public static Integer test4(int param1, int param2, int param3) {
		return Integer.valueOf(param1 * 12);
	}

	// Does not work
	public static Integer test5(double param1, int param2, int param3) {
		return Integer.valueOf(param2 * 12);
	}

	// Does not work
	public static Integer test6(BigDecimal param1, int param2, int param3) {
		return Integer.valueOf(param2 * 12);
	}

	// Works
	public static Integer test7(BigDecimal param1) {
		return Integer.valueOf(1);
	}

	// Works
	public static BigDecimal test8(BigDecimal param1) {
		return BigDecimal.ONE;
	}

}


Thanks to everyone in advance.


Best Regards


Posted by mcicel on 24-Jan-2014 06:56

The documentation for the Stand-alone extended operators says that the parameters and return types must be limited to these types:
 
java.math.BigInteger, java.math.BigDecimal, java.lang.Boolean, java.util.Date, java.lang.String
 
Try to modify your methods to use the above types.
 
Marian
 
[collapse]
From: afaayfab [mailto:bounce-afaayfab@community.progress.com]
Sent: Friday, January 24, 2014 7:22 AM
To: TU.Corticon@community.progress.com
Subject: Problem with ICcStandAloneExtension using double and integer types as method parameters
 
Thread created by afaayfab

Hi all,

Hi all, I'm new using Corticon and I am having problems using ICcStandAloneExtension. I have created some very very easy examples and I am not able to make some of them work. Below, you can find the Java Class. Each method has as a comment whether it works or not when I call it from a rule.

So, when I  use for instance, test2:

public static Integer test2(Integer param1) {
              return Integer.valueOf(param1 * 12);
}

in the rulesheet file would be:

   currentLoan.duration =LoanOperators.test2(2)

where currentLoan.duration is an Integer, the input parameter is also an Integer and the method output is an Integer.

it shows an Error type: Invalid parameters.

But if I use for instance test7:

currentLoan.duration=LoanOperators.test7(1,5) where currentLoan.duration is an Integer, the output method is an Integer and the input parameter is a BigDecimal, it works perfectly. 

About my environment:

- Windows 7, locale configuration: spanish (castilian)

- Progress Corticon 5.3

package loan.operators;
 
import java.math.BigDecimal;
 
import com.corticon.services.extensions.ICcStandAloneExtension;
 
public class LoanOperators implements ICcStandAloneExtension {
 
        // Does not work
        public static Integer computeYearlyRepayment(BigDecimal yearlyInterestRate, Integer amount, Integer duration) {
               
               return Integer.valueOf(1);
        }
 
        // Does not work
        public static Integer test0(BigDecimal yearlyInterestRate, Integer amount) {
               return 1;
        }
 
        // Does not work
        public static Integer test1(Integer param1, Integer param2) {
               return Integer.valueOf(12);
        }
 
        // Does not work
        public static Integer test2(Integer param1) {
               return Integer.valueOf(param1 * 12);
        }
 
        // Works
        public static Integer test3(int param1) {
               return Integer.valueOf(param1 * 12);
        }
 
        // Works
        public static Integer test4(int param1, int param2, int param3) {
               return Integer.valueOf(param1 * 12);
        }
 
        // Does not work
        public static Integer test5(double param1, int param2, int param3) {
               return Integer.valueOf(param2 * 12);
        }
 
        // Does not work
        public static Integer test6(BigDecimal param1, int param2, int param3) {
               return Integer.valueOf(param2 * 12);
        }
 
        // Works
        public static Integer test7(BigDecimal param1) {
               return Integer.valueOf(1);
        }
 
        // Works
        public static BigDecimal test8(BigDecimal param1) {
               return BigDecimal.ONE;
        }
 
}

Thanks to everyone in advance.


Best Regards

 
Stop receiving emails on this subject.

Flag this post as spam/abuse.

[/collapse]

All Replies

Posted by mcicel on 24-Jan-2014 06:56

The documentation for the Stand-alone extended operators says that the parameters and return types must be limited to these types:
 
java.math.BigInteger, java.math.BigDecimal, java.lang.Boolean, java.util.Date, java.lang.String
 
Try to modify your methods to use the above types.
 
Marian
 
[collapse]
From: afaayfab [mailto:bounce-afaayfab@community.progress.com]
Sent: Friday, January 24, 2014 7:22 AM
To: TU.Corticon@community.progress.com
Subject: Problem with ICcStandAloneExtension using double and integer types as method parameters
 
Thread created by afaayfab

Hi all,

Hi all, I'm new using Corticon and I am having problems using ICcStandAloneExtension. I have created some very very easy examples and I am not able to make some of them work. Below, you can find the Java Class. Each method has as a comment whether it works or not when I call it from a rule.

So, when I  use for instance, test2:

public static Integer test2(Integer param1) {
              return Integer.valueOf(param1 * 12);
}

in the rulesheet file would be:

   currentLoan.duration =LoanOperators.test2(2)

where currentLoan.duration is an Integer, the input parameter is also an Integer and the method output is an Integer.

it shows an Error type: Invalid parameters.

But if I use for instance test7:

currentLoan.duration=LoanOperators.test7(1,5) where currentLoan.duration is an Integer, the output method is an Integer and the input parameter is a BigDecimal, it works perfectly. 

About my environment:

- Windows 7, locale configuration: spanish (castilian)

- Progress Corticon 5.3

package loan.operators;
 
import java.math.BigDecimal;
 
import com.corticon.services.extensions.ICcStandAloneExtension;
 
public class LoanOperators implements ICcStandAloneExtension {
 
        // Does not work
        public static Integer computeYearlyRepayment(BigDecimal yearlyInterestRate, Integer amount, Integer duration) {
               
               return Integer.valueOf(1);
        }
 
        // Does not work
        public static Integer test0(BigDecimal yearlyInterestRate, Integer amount) {
               return 1;
        }
 
        // Does not work
        public static Integer test1(Integer param1, Integer param2) {
               return Integer.valueOf(12);
        }
 
        // Does not work
        public static Integer test2(Integer param1) {
               return Integer.valueOf(param1 * 12);
        }
 
        // Works
        public static Integer test3(int param1) {
               return Integer.valueOf(param1 * 12);
        }
 
        // Works
        public static Integer test4(int param1, int param2, int param3) {
               return Integer.valueOf(param1 * 12);
        }
 
        // Does not work
        public static Integer test5(double param1, int param2, int param3) {
               return Integer.valueOf(param2 * 12);
        }
 
        // Does not work
        public static Integer test6(BigDecimal param1, int param2, int param3) {
               return Integer.valueOf(param2 * 12);
        }
 
        // Works
        public static Integer test7(BigDecimal param1) {
               return Integer.valueOf(1);
        }
 
        // Works
        public static BigDecimal test8(BigDecimal param1) {
               return BigDecimal.ONE;
        }
 
}

Thanks to everyone in advance.


Best Regards

 
Stop receiving emails on this subject.

Flag this post as spam/abuse.

[/collapse]

Posted by afaayfab on 24-Jan-2014 07:45

It worked!!!! Thanks :)

This thread is closed