Hi its working fine with the following rule.
when
$item:OrderableLineItemVO($parent: parentLineItemID)
exists (not (OrderableLineItemVO(lineItemID == $parent)))
then
exception;
end
thanks
________________________________
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Bhattacharya,
Sougata
Sent: Friday, September 28, 2007 7:55 PM
To: Rules Users List
Subject: RE: [rules-users] Please help
Hmm I think we are just near to the solution,
I have the line item like this
<LineItem >
<LineItemID>1</LineItemID>
<ParentLineItemID>1</ParentLineItemID>
</LineItem>
<LineItem >
<LineItemID>2</LineItemID>
<ParentLineItemID>1</ParentLineItemID>
</LineItem>
<LineItem >
<LineItemID>2</LineItemID>
<ParentLineItemID>1</ParentLineItemID>
</LineItem>
<LineItem >
<LineItemID>4</LineItemID>
<ParentLineItemID>2</ParentLineItemID>
</LineItem>
<LineItem >
<LineItemID>5</LineItemID>
<ParentLineItemID>1</ParentLineItemID>
</LineItem>
with this data set case my rule should not raise any exception, if any
of the lineItem has ParentLineItemID = 8 it should raise an exception
Cheers
Sougata
________________________________
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Anstis,
Michael (M.)
Sent: Friday, September 28, 2007 7:35 PM
To: Rules Users List
Subject: RE: [rules-users] Please help
You will need to use the exists keyword.
Without digging around for the manual you need to do something like:-
when
exists (
LineItem( $parent: parentId )
LineItem( id != $parent )
)
then
// raise the exception
end
________________________________
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Bhattacharya,
Sougata
Sent: 28 September 2007 14:50
To: Rules Users List
Subject: RE: [rules-users] Please help
No 30 is not correct, I want if 1 lineItem.parentId does not
equals to any of the LineItem.Id throw one exception.
Thanks
________________________________
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Anstis,
Michael (M.)
Sent: Friday, September 28, 2007 7:13 PM
To: Rules Users List
Subject: RE: [rules-users] Please help
Is 30 correct, you are not clear. Did you want one exception for
any number of violations?
________________________________
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Bhattacharya,
Sougata
Sent: 28 September 2007 14:33
To: Rules Users List
Subject: RE: [rules-users] Please help
Oh yes this raises 30 exceptions if I have 6 Line Items
________________________________
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Edson Tirelli
Sent: Friday, September 28, 2007 6:53 PM
To: Rules Users List
Subject: Re: [rules-users] Please help
when
LineItem( $parent: parentId )
LineItem( id != $parent )
then
// raise the exception
end
2007/9/28, Bhattacharya, Sougata <
sougata.bhattacharya(a)capgemini.com
<mailto:sougata.bhattacharya@capgemini.com> >:
Hi All,
I am using drool to validate my business objects. I
have a Business object like this
LineItem
String ID
String parentId
I get 5 LineItems in a row and each line item has ID
and a Parent ID, I will have to check
if(parented of Any LineItem ! = ID of any LineITem)
I have to show an exception,
Please help me to solve this
Cheers
Su
This message contains information that may be privileged or confidential
and is the property of the Capgemini Group. It is intended only for the
person to whom it is addressed. If you are not the intended recipient,
you are not authorized to read, print, retain, copy, disseminate,
distribute, or use this message or any part thereof. If you receive this
message in error, please notify the sender immediately and delete all
copies of this message.
This message contains information that may be privileged or confidential
and is the property of the Capgemini Group. It is intended only for the
person to whom it is addressed. If you are not the intended recipient,
you are not authorized to read, print, retain, copy, disseminate,
distribute, or use this message or any part thereof. If you receive this
message in error, please notify the sender immediately and delete all
copies of this message.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Edson Tirelli
Software Engineer - JBoss Rules Core Developer
Office: +55 11 3529-6000
Mobile: +55 11 9287-5646
JBoss, a division of Red Hat @
www.jboss.com
This message contains information that may be privileged or confidential
and is the property of the Capgemini Group. It is intended only for the
person to whom it is addressed. If you are not the intended recipient,
you are not authorized to read, print, retain, copy, disseminate,
distribute, or use this message or any part thereof. If you receive this
message in error, please notify the sender immediately and delete all
copies of this message.
This message contains information that may be privileged or confidential
and is the property of the Capgemini Group. It is intended only for the
person to whom it is addressed. If you are not the intended recipient,
you are not authorized to read, print, retain, copy, disseminate,
distribute, or use this message or any part thereof. If you receive this
message in error, please notify the sender immediately and delete all
copies of this message.
This message contains information that may be privileged or confidential
and is the property of the Capgemini Group. It is intended only for the
person to whom it is addressed. If you are not the intended recipient,
you are not authorized to read, print, retain, copy, disseminate,
distribute, or use this message or any part thereof. If you receive this
message in error, please notify the sender immediately and delete all
copies of this message.
This message contains information that may be privileged or confidential and is the
property of the Capgemini Group. It is intended only for the person to whom it is
addressed. If you are not the intended recipient, you are not authorized to read, print,
retain, copy, disseminate, distribute, or use this message or any part thereof. If you
receive this message in error, please notify the sender immediately and delete all
copies of this message.