forgot to delete the signature (large image), so I forward this email...
Still waiting for an answer... I need to put this rule logic IN the
Rule, not in the Bean.
I tested this changing all attributes to Long and happens the same
error:
s: Solicitud( sumaLCG: sumaMontoLCG < max, sumaGTIA:
sumaMontoGarantia >= ( new Long( sumaLCG.intValue() - min.intValue
() )) )
public class Solicitud implements Serializable {
private Long sumaMontoLCG; // suma de los montos contenidos en
cada LineaCredito contenida en la lista LCG
private int resolucion; // se guarda el RES_PUEDE_APROVAR o el
RES_DEBE_RECOMENDAR
private boolean aprovada; //si esta finalmente aprovada o no.
private Long sumaMontoGarantia;//suma de montos de garantias
de todos los productos del LCG
public Solicitud(){
this.LCG = new ArrayList<LineaCredito>();
this.sumaMontoLCG = new Long(0);
this.resolucion = Solicitud.RES_SIN_RESOLUCION;
this.aprovada = false;
this.sumaMontoGarantia = new Long(0);
}
public Long getSumaMontoLCG() {
recalculaSumaMontoLCG();
return sumaMontoLCG;
}
public void setSumaMontoLCG(int sumaMontoLCG) {
this.sumaMontoLCG = new Long(sumaMontoLCG);
}
public void setSumaMontoLCG(long sumaMontoLCG) {
this.sumaMontoLCG = new Long(sumaMontoLCG);
}
public void setSumaMontoLCG(Long sumaMontoLCG) {
this.sumaMontoLCG =sumaMontoLCG;
}
....
org.drools.RuntimeDroolsException:
java.lang.ArrayIndexOutOfBoundsException: 1
at org.drools.rule.ReturnValueConstraint.isAllowed(Unknown Source)
at org.drools.common.BetaNodeBinder.isAllowed(Unknown Source)
at org.drools.reteoo.TupleSource.attemptJoin(Unknown Source)
at org.drools.reteoo.JoinNode.assertTuple(Unknown Source)
at org.drools.reteoo.LeftInputAdapterNode.createAndAssertTuple
(Unknown Source)
at org.drools.reteoo.LeftInputAdapterNode.assertObject(Unknown
Source)
at org.drools.reteoo.ObjectSource.propagateAssertObject(Unknown
Source)
at org.drools.reteoo.AlphaNode.assertObject(Unknown Source)
at org.drools.reteoo.ObjectSource.propagateAssertObject(Unknown
Source)
at org.drools.reteoo.ObjectTypeNode.assertObject(Unknown Source)
at org.drools.reteoo.Rete.assertObject(Unknown Source)
at org.drools.reteoo.ReteooRuleBase.assertObject(Unknown Source)
at org.drools.reteoo.ReteooWorkingMemory.doAssertObject(Unknown
Source)
at org.drools.common.AbstractWorkingMemory.assertObject(Unknown
Source)
at org.drools.common.AbstractWorkingMemory.assertObject(Unknown
Source)
at
cl.bluesoft.jbrules.loader.solcred.SolcredRulesPoC.fireRulesSOLCRED
(SolcredRulesPoC.java:83)
at cl.bluesoft.jbrules.loader.solcred.SolcredRulesPoC.main
(SolcredRulesPoC.java:38)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
at org.drools.reteoo.FactHandleList.get(Unknown Source)
at org.drools.reteoo.TupleKey.get(Unknown Source)
at org.drools.reteoo.ReteTuple.get(Unknown Source)
at org.drools.reteoo.ReteTuple.get(Unknown Source)
at
cl.bluesoft.jbrules.rules.solcred.Rule_montos_maximos_y_minimos_0Retur
nValue0Invoker.evaluate
(Rule_montos_maximos_y_minimos_0ReturnValue0Invoker.java:12)
... 17 more
On 11-04-2007, at 11:59, Felipe Piccolini wrote:
> The Solicitud object has sumaMontoLCG and sumaMontoGarantia atts
> as int (primitives).
>
> Im using 3.0.6 and java 1.5
>
> I have this simple rule:
>
> rule "montos maximos y minimos"
> salience 888
> when
> a: Actor(tipo :tipoActor == Actor.JefeOficina, max:
> limiteMaximo, min: limiteMinimo)
> s: Solicitud( sumaLCG: sumaMontoLCG < max, sumaGTIA:
> sumaMontoGarantia -> ( (sumaLCG.intValue() - sumaGTIA.intValue())
> < min.intValue()) )
> then
> System.out.println("Suma LCG:"+sumaLCG);
> System.out.println("Actor lim max:"+max);
> System.out.println("Actor tipo:"+tipo);
> end
>
> Fire the rule shows me this error:
> org.drools.RuntimeDroolsException:
> java.lang.ArrayIndexOutOfBoundsException: 1
> at org.drools.rule.PredicateConstraint.isAllowed(Unknown Source)
> at org.drools.common.BetaNodeBinder.isAllowed(Unknown Source)
> at org.drools.reteoo.TupleSource.attemptJoin(Unknown Source)
> at org.drools.reteoo.JoinNode.assertTuple(Unknown Source)
> at org.drools.reteoo.LeftInputAdapterNode.createAndAssertTuple
> (Unknown Source)
> at org.drools.reteoo.LeftInputAdapterNode.assertObject(Unknown
> Source)
> at org.drools.reteoo.ObjectSource.propagateAssertObject(Unknown
> Source)
> at org.drools.reteoo.AlphaNode.assertObject(Unknown Source)
> at org.drools.reteoo.ObjectSource.propagateAssertObject(Unknown
> Source)
> at org.drools.reteoo.ObjectTypeNode.assertObject(Unknown Source)
> at org.drools.reteoo.Rete.assertObject(Unknown Source)
> at org.drools.reteoo.ReteooRuleBase.assertObject(Unknown Source)
> at org.drools.reteoo.ReteooWorkingMemory.doAssertObject(Unknown
> Source)
> at org.drools.common.AbstractWorkingMemory.assertObject(Unknown
> Source)
> at org.drools.common.AbstractWorkingMemory.assertObject(Unknown
> Source)
> at
> cl.bluesoft.jbrules.loader.solcred.SolcredRulesPoC.fireRulesSOLCRED
> (SolcredRulesPoC.java:85)
> at cl.bluesoft.jbrules.loader.solcred.SolcredRulesPoC.main
> (SolcredRulesPoC.java:40)
> Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
> at org.drools.reteoo.FactHandleList.get(Unknown Source)
> at org.drools.reteoo.TupleKey.get(Unknown Source)
> at org.drools.reteoo.ReteTuple.get(Unknown Source)
> at org.drools.reteoo.ReteTuple.get(Unknown Source)
> at
> cl.bluesoft.jbrules.rules.solcred.Rule_montos_maximos_y_minimos_0Pred
> icate0Invoker.evaluate
> (Rule_montos_maximos_y_minimos_0Predicate0Invoker.java:14)
> ... 17 more
>
>
> When I change the column to:
> s: Solicitud( sumaLCG: sumaMontoLCG < max, sumaGTIA:
> sumaMontoGarantia -> ( (sumaLCG - sumaGTIA) < min) )
>
> its shows this error:
> org.drools.rule.InvalidRulePackage: Rule Compilation error The
> operator - is undefined for the argument type(s)
> java.lang.Integer, java.lang.Integer
>
> at org.drools.rule.Package.checkValidity(Unknown Source)
> at org.drools.common.AbstractRuleBase.addPackage(Unknown Source)
> at cl.bluesoft.jbrules.loader.solcred.SolcredRulesPoC.readRule
> (SolcredRulesPoC.java:60)
> at cl.bluesoft.jbrules.loader.solcred.SolcredRulesPoC.main
> (SolcredRulesPoC.java:36)
>
> This happens in a predicate or in a value expression, so I cant
> use this formula... What is wrong?
>
> Thx.
>
>
>
> Felipe Piccolini M.
> felipe.piccolini(a)bluesoft.cl
>
>
Felipe Piccolini M.
felipe.piccolini(a)bluesoft.cl