Hi All, should this work in beanshell? bsh % source ("bshcontainer.bsh"); bsh % oh = delegator.findByAnd("OrderHeader",UtilMisc.toMap("orderId","WS10022")); bsh % print(oh) ; [[GenericEntity:OrderHeader][billingAccountId,null()][createdBy,[hidden email](java.lang.String)][createdStamp,2006-03-17 16:15:52.8 79(java.sql.Timestamp)][createdTxStamp,2006-03-17 16:15:52.628(java.sql.Timestamp)][currencyUom,USD(java.lang.String)][entryDate,2006-03-17 1 6:15:52.658(java.sql.Timestamp)][externalId,null()][firstAttemptOrderId,null()][grandTotal,15.85(java.lang.Double)][internalCode,null()][isRu shOrder,null()][lastUpdatedStamp,2006-03-20 15:25:58.842(java.sql.Timestamp)][lastUpdatedTxStamp,2006-03-20 15:25:57.337(java.sql.Timestamp)] [needsInventoryIssuance,null()][orderDate,2006-03-17 16:15:52.658(java.sql.Timestamp)][orderId,WS10022(java.lang.String)][orderTypeId,SALES_O RDER(java.lang.String)][originFacilityId,null()][productStoreId,9000(java.lang.String)][remainingSubTotal,12.85(java.lang.Double)][salesChann elEnumId,WEB_SALES_CHANNEL(java.lang.String)][statusId,ORDER_COMPLETED(java.lang.String)][syncStatusId,null()][terminalId,null()][transaction Id,null()][visitId,10174(java.lang.String)][webSiteId,WebStore(java.lang.String)]] ************* FAILS HERE ************* bsh % items = oh.getRelated("OrderItem", UtilMisc.toList("orderItemSeqId")); // Error: EvalError: Error in method invocation: Method getRelated( java.lang.String, java.util.ArrayList ) not found in class'javolution.uti l.FastList' : at Line: 5 : in file: <unknown file> : oh .getRelated ( "OrderItem" , UtilMisc .toList ( "orderItemSeqId" ) ) Thanx Fred _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users |
No, because delegator.findByAnd returns a List. You probably want:
orderHeaders = delegator.findByAnd(...); oh = orderHeaders.get(0); or something like that. > -------- Original Message -------- > Subject: [OFBiz] Users - Bean Shell problem > From: Fred Forester <[hidden email]> > Date: Tue, March 21, 2006 11:11 am > To: ofbiz list <[hidden email]> > > Hi All, > > should this work in beanshell? > > bsh % source ("bshcontainer.bsh"); > bsh % oh = > delegator.findByAnd("OrderHeader",UtilMisc.toMap("orderId","WS10022")); > bsh % print(oh) > ; > [[GenericEntity:OrderHeader][billingAccountId,null()][createdBy,[hidden email](java.lang.String)][createdStamp,2006-03-17 > 16:15:52.8 > 79(java.sql.Timestamp)][createdTxStamp,2006-03-17 > 16:15:52.628(java.sql.Timestamp)][currencyUom,USD(java.lang.String)][entryDate,2006-03-17 > 1 > 6:15:52.658(java.sql.Timestamp)][externalId,null()][firstAttemptOrderId,null()][grandTotal,15.85(java.lang.Double)][internalCode,null()][isRu > shOrder,null()][lastUpdatedStamp,2006-03-20 > 15:25:58.842(java.sql.Timestamp)][lastUpdatedTxStamp,2006-03-20 > 15:25:57.337(java.sql.Timestamp)] > [needsInventoryIssuance,null()][orderDate,2006-03-17 > 16:15:52.658(java.sql.Timestamp)][orderId,WS10022(java.lang.String)][orderTypeId,SALES_O > RDER(java.lang.String)][originFacilityId,null()][productStoreId,9000(java.lang.String)][remainingSubTotal,12.85(java.lang.Double)][salesChann > elEnumId,WEB_SALES_CHANNEL(java.lang.String)][statusId,ORDER_COMPLETED(java.lang.String)][syncStatusId,null()][terminalId,null()][transaction > Id,null()][visitId,10174(java.lang.String)][webSiteId,WebStore(java.lang.String)]] > > ************* FAILS HERE ************* > bsh % items = oh.getRelated("OrderItem", UtilMisc.toList("orderItemSeqId")); > // Error: EvalError: Error in method invocation: Method getRelated( > java.lang.String, java.util.ArrayList ) not found in class'javolution.uti > l.FastList' : at Line: 5 : in file: <unknown file> : oh .getRelated ( > "OrderItem" , UtilMisc .toList ( "orderItemSeqId" ) ) > > Thanx > Fred > > > _______________________________________________ > Users mailing list > [hidden email] > http://lists.ofbiz.org/mailman/listinfo/users _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users |
thanx, I was able to get them like this
items = delegator.findByAnd("OrderItem",UtilMisc.toMap("orderId","WS10022")); it would be nice if I could get OrderReadHelper to work. Nate Reed wrote: No, because delegator.findByAnd returns a List. You probably want: orderHeaders = delegator.findByAnd(...); oh = orderHeaders.get(0); or something like that.-------- Original Message -------- Subject: [OFBiz] Users - Bean Shell problem From: Fred Forester [hidden email] Date: Tue, March 21, 2006 11:11 am To: ofbiz list [hidden email] Hi All, should this work in beanshell? bsh % source ("bshcontainer.bsh"); bsh % oh = delegator.findByAnd("OrderHeader",UtilMisc.toMap("orderId","WS10022")); bsh % print(oh) ; [[GenericEntity:OrderHeader][billingAccountId,null()][createdBy,[hidden email])][createdStamp,2006-03-17 16:15:52.8 79(java.sql.Timestamp)][createdTxStamp,2006-03-17 16:15:52.628(java.sql.Timestamp)][currencyUom,USD(java.lang.String)][entryDate,2006-03-17 1 6:15:52.658(java.sql.Timestamp)][externalId,null()][firstAttemptOrderId,null()][grandTotal,15.85(java.lang.Double)][internalCode,null()][isRu shOrder,null()][lastUpdatedStamp,2006-03-20 15:25:58.842(java.sql.Timestamp)][lastUpdatedTxStamp,2006-03-20 15:25:57.337(java.sql.Timestamp)] [needsInventoryIssuance,null()][orderDate,2006-03-17 16:15:52.658(java.sql.Timestamp)][orderId,WS10022(java.lang.String)][orderTypeId,SALES_O RDER(java.lang.String)][originFacilityId,null()][productStoreId,9000(java.lang.String)][remainingSubTotal,12.85(java.lang.Double)][salesChann elEnumId,WEB_SALES_CHANNEL(java.lang.String)][statusId,ORDER_COMPLETED(java.lang.String)][syncStatusId,null()][terminalId,null()][transaction Id,null()][visitId,10174(java.lang.String)][webSiteId,WebStore(java.lang.String)]] ************* FAILS HERE ************* bsh % items = oh.getRelated("OrderItem", UtilMisc.toList("orderItemSeqId")); // Error: EvalError: Error in method invocation: Method getRelated( java.lang.String, java.util.ArrayList ) not found in class'javolution.uti l.FastList' : at Line: 5 : in file: <unknown file> : oh .getRelated ( "OrderItem" , UtilMisc .toList ( "orderItemSeqId" ) ) Thanx Fred _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users_______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users |
why couldn't you get OrderReadHelper to work?
Fred Forester wrote: thanx, I was able to get them like this _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users |
I couldn't get it to work via bsh prompt. after adding the import for the class to bshcontainer and sourcing it, the odds are Im not creating it properly. oh = delegator.findByAnd("OrderHeader",UtilMisc.toMap("orderId","WS10051")); orh = new OrderReadHelper(oh); // Error: EvalError: Constructor error: Can't find constructor: class org.ofbiz.order.order.OrderReadHelper : at Line: 5 : in file: <unknown file> : new OrderReadHelper ( oh ) Si Chen wrote: why couldn't you get OrderReadHelper to work? _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users |
did you import it first?
Fred Forester wrote:
_______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users |
I added this to bshcontainer.bsh import org.ofbiz.order.order.*; Si Chen wrote: did you import it first? _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users |
Fred,
the error is caused by the fact that you are passing a List instead of a GenericValue to the OrderReadHelper costructor: in fact the findByAnd always returns a List. You can solve this in two ways: a) oh = delegator.findByPrimaryKey("OrderHeader",UtilMisc.toMap("orderId","WS10051")); b) ohList = delegator.findByAnd("OrderHeader",UtilMisc.toMap("orderId","WS10051")); ok = org.ofbiz.entity.util.EntityUtil.getFirst(ohList); orh = new OrderReadHelper(oh); Hope this helps, Jacopo Fred Forester wrote: > > I added this to bshcontainer.bsh > > import org.ofbiz.order.order.*; > > Si Chen wrote: >> did you import it first? >> >> Fred Forester wrote: >>> >>> I couldn't get it to work via bsh prompt. after adding the import for >>> the class to bshcontainer and sourcing it, >>> the odds are Im not creating it properly. >>> >>> oh = >>> delegator.findByAnd("OrderHeader",UtilMisc.toMap("orderId","WS10051")); >>> orh = new OrderReadHelper(oh); >>> // Error: EvalError: Constructor error: Can't find constructor: class >>> org.ofbiz.order.order.OrderReadHelper : at Line: 5 : in file: <unknown >>> file> : new OrderReadHelper ( oh ) >>> >>> >>> >>> Si Chen wrote: >>>> why couldn't you get OrderReadHelper to work? >>>> >>>> Fred Forester wrote: >>>>> thanx, I was able to get them like this >>>>> items = >>>>> delegator.findByAnd("OrderItem",UtilMisc.toMap("orderId","WS10022")); >>>>> >>>>> it would be nice if I could get OrderReadHelper to work. >>>>> >>>>> Nate Reed wrote: >>>>>> No, because delegator.findByAnd returns a List. You probably want: >>>>>> >>>>>> orderHeaders = delegator.findByAnd(...); >>>>>> oh = orderHeaders.get(0); >>>>>> >>>>>> or something like that. >>>>>> >>>>>> >>>>>>> -------- Original Message -------- >>>>>>> Subject: [OFBiz] Users - Bean Shell problem >>>>>>> From: Fred Forester <[hidden email]> >>>>>>> Date: Tue, March 21, 2006 11:11 am >>>>>>> To: ofbiz list <[hidden email]> >>>>>>> >>>>>>> Hi All, >>>>>>> >>>>>>> should this work in beanshell? >>>>>>> >>>>>>> bsh % source ("bshcontainer.bsh"); >>>>>>> bsh % oh = >>>>>>> delegator.findByAnd("OrderHeader",UtilMisc.toMap("orderId","WS10022")); >>>>>>> bsh % print(oh) >>>>>>> ; >>>>>>> [[GenericEntity:OrderHeader][billingAccountId,null()][createdBy,[hidden email](java.lang.String)][createdStamp,2006-03-17 >>>>>>> 16:15:52.8 >>>>>>> 79(java.sql.Timestamp)][createdTxStamp,2006-03-17 >>>>>>> 16:15:52.628(java.sql.Timestamp)][currencyUom,USD(java.lang.String)][entryDate,2006-03-17 >>>>>>> 1 >>>>>>> 6:15:52.658(java.sql.Timestamp)][externalId,null()][firstAttemptOrderId,null()][grandTotal,15.85(java.lang.Double)][internalCode,null()][isRu >>>>>>> shOrder,null()][lastUpdatedStamp,2006-03-20 >>>>>>> 15:25:58.842(java.sql.Timestamp)][lastUpdatedTxStamp,2006-03-20 >>>>>>> 15:25:57.337(java.sql.Timestamp)] >>>>>>> [needsInventoryIssuance,null()][orderDate,2006-03-17 >>>>>>> 16:15:52.658(java.sql.Timestamp)][orderId,WS10022(java.lang.String)][orderTypeId,SALES_O >>>>>>> RDER(java.lang.String)][originFacilityId,null()][productStoreId,9000(java.lang.String)][remainingSubTotal,12.85(java.lang.Double)][salesChann >>>>>>> elEnumId,WEB_SALES_CHANNEL(java.lang.String)][statusId,ORDER_COMPLETED(java.lang.String)][syncStatusId,null()][terminalId,null()][transaction >>>>>>> Id,null()][visitId,10174(java.lang.String)][webSiteId,WebStore(java.lang.String)]] >>>>>>> >>>>>>> ************* FAILS HERE ************* >>>>>>> bsh % items = oh.getRelated("OrderItem", UtilMisc.toList("orderItemSeqId")); >>>>>>> // Error: EvalError: Error in method invocation: Method getRelated( >>>>>>> java.lang.String, java.util.ArrayList ) not found in class'javolution.uti >>>>>>> l.FastList' : at Line: 5 : in file: <unknown file> : oh .getRelated ( >>>>>>> "OrderItem" , UtilMisc .toList ( "orderItemSeqId" ) ) >>>>>>> >>>>>>> Thanx >>>>>>> Fred >>>>>>> >>>>>>> >>>>>>> _______________________________________________ >>>>>>> Users mailing list >>>>>>> [hidden email] >>>>>>> http://lists.ofbiz.org/mailman/listinfo/users >>>>>>> >>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> Users mailing list >>>>>> [hidden email] >>>>>> http://lists.ofbiz.org/mailman/listinfo/users >>>>>> >>>>>> >>>>>> >>>>> ------------------------------------------------------------------------ >>>>> >>>>> >>>>> _______________________________________________ >>>>> Users mailing list >>>>> [hidden email] >>>>> http://lists.ofbiz.org/mailman/listinfo/users >>>> ------------------------------------------------------------------------ >>>> >>>> >>>> _______________________________________________ >>>> Users mailing list >>>> [hidden email] >>>> http://lists.ofbiz.org/mailman/listinfo/users >>> ------------------------------------------------------------------------ >>> >>> >>> _______________________________________________ >>> Users mailing list >>> [hidden email] >>> http://lists.ofbiz.org/mailman/listinfo/users >> ------------------------------------------------------------------------ >> >> >> _______________________________________________ >> Users mailing list >> [hidden email] >> http://lists.ofbiz.org/mailman/listinfo/users > > ------------------------------------------------------------------------ > > > _______________________________________________ > Users mailing list > [hidden email] > http://lists.ofbiz.org/mailman/listinfo/users _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users |
Ah yes that makes sense. thanx Jacopo Cappellato wrote: Fred, the error is caused by the fact that you are passing a List instead of a GenericValue to the OrderReadHelper costructor: in fact the findByAnd always returns a List. You can solve this in two ways: a) oh = delegator.findByPrimaryKey("OrderHeader",UtilMisc.toMap("orderId","WS10051")); b) ohList = delegator.findByAnd("OrderHeader",UtilMisc.toMap("orderId","WS10051")); ok = org.ofbiz.entity.util.EntityUtil.getFirst(ohList); orh = new OrderReadHelper(oh); Hope this helps, Jacopo Fred Forester wrote:I added this to bshcontainer.bsh import org.ofbiz.order.order.*; Si Chen wrote:did you import it first? Fred Forester wrote:I couldn't get it to work via bsh prompt. after adding the import for the class to bshcontainer and sourcing it, the odds are Im not creating it properly. oh = delegator.findByAnd("OrderHeader",UtilMisc.toMap("orderId","WS10051")); orh = new OrderReadHelper(oh); // Error: EvalError: Constructor error: Can't find constructor: class org.ofbiz.order.order.OrderReadHelper : at Line: 5 : in file: <unknown file> : new OrderReadHelper ( oh ) Si Chen wrote:why couldn't you get OrderReadHelper to work? Fred Forester wrote:thanx, I was able to get them like this items = delegator.findByAnd("OrderItem",UtilMisc.toMap("orderId","WS10022")); it would be nice if I could get OrderReadHelper to work. Nate Reed wrote:No, because delegator.findByAnd returns a List. You probably want: orderHeaders = delegator.findByAnd(...); oh = orderHeaders.get(0); or something like that.-------- Original Message -------- Subject: [OFBiz] Users - Bean Shell problem From: Fred Forester [hidden email] Date: Tue, March 21, 2006 11:11 am To: ofbiz list [hidden email] Hi All, should this work in beanshell? bsh % source ("bshcontainer.bsh"); bsh % oh = delegator.findByAnd("OrderHeader",UtilMisc.toMap("orderId","WS10022")); bsh % print(oh) ; [[GenericEntity:OrderHeader][billingAccountId,null()][createdBy,[hidden email])][createdStamp,2006-03-17 16:15:52.8 79(java.sql.Timestamp)][createdTxStamp,2006-03-17 16:15:52.628(java.sql.Timestamp)][currencyUom,USD(java.lang.String)][entryDate,2006-03-17 1 6:15:52.658(java.sql.Timestamp)][externalId,null()][firstAttemptOrderId,null()][grandTotal,15.85(java.lang.Double)][internalCode,null()][isRu shOrder,null()][lastUpdatedStamp,2006-03-20 15:25:58.842(java.sql.Timestamp)][lastUpdatedTxStamp,2006-03-20 15:25:57.337(java.sql.Timestamp)] [needsInventoryIssuance,null()][orderDate,2006-03-17 16:15:52.658(java.sql.Timestamp)][orderId,WS10022(java.lang.String)][orderTypeId,SALES_O RDER(java.lang.String)][originFacilityId,null()][productStoreId,9000(java.lang.String)][remainingSubTotal,12.85(java.lang.Double)][salesChann elEnumId,WEB_SALES_CHANNEL(java.lang.String)][statusId,ORDER_COMPLETED(java.lang.String)][syncStatusId,null()][terminalId,null()][transaction Id,null()][visitId,10174(java.lang.String)][webSiteId,WebStore(java.lang.String)]] ************* FAILS HERE ************* bsh % items = oh.getRelated("OrderItem", UtilMisc.toList("orderItemSeqId")); // Error: EvalError: Error in method invocation: Method getRelated( java.lang.String, java.util.ArrayList ) not found in class'javolution.uti l.FastList' : at Line: 5 : in file: <unknown file> : oh .getRelated ( "OrderItem" , UtilMisc .toList ( "orderItemSeqId" ) ) Thanx Fred _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users_______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users------------------------------------------------------------------------ _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users------------------------------------------------------------------------ _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users------------------------------------------------------------------------ _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users------------------------------------------------------------------------ _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users------------------------------------------------------------------------ _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users_______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users |
Free forum by Nabble | Edit this page |