Yes this is the interface service type ;o) Jacques
De : "Jonathon -- Improov" <[EMAIL PROTECTED]> > Jacques, > > In the service definition, there's the <implements> mechanism that could > allow Skip to define a > new service with all the same fields as another (original) OFBiz service, so > he doesn't have to > redefine the many attributes defined in the original OFBiz service. > > Jonathon > > Jacques Le Roux wrote: > > Jonathon, Skip, > > > > I'm not sure of what Jonathon means (have not time to look at > > services_authorizedotnet.xml right now); maybe he wants to allude that > > there is an interface mechanism for services too. Just look for the word > > "interface" in services definitions. > > > > Jacques > > > > De : "Jonathon -- Improov" <[EMAIL PROTECTED]> > >> Skip, > >> > >> Create a hot-deploy app (you can skip the webapp creation). Insert a > >> service definition (in say > >> servicedef/services.xml), service name "skip.calculateProductPrice". > >> > >> Extend the class of original Java method "calculateProductPrice", in case > >> that method uses any > >> class members. In your new class (extended from original class), do your > >> new Java method > >> "calculateProductPrice". The point here is to clearly document for > >> yourself which OFBiz method you > >> are cloning and modifying. > >> > >> Java extension mechanisms (eg class extends, method overrides) make for > >> clean codes that avoid > >> redundancies. Same for OFBiz extension mechanisms. > >> > >> By the way, you can "implement" (think Java's "implement" for interfaces) > >> a service definition, > >> kind of. I'm not sure if you can "implement" a fully-defined service > >> definition like service > >> "calculateProductPrice". You can try it. > >> > >> For egs, see in Accounting module folder servicedef. See > >> services_authorizedotnet.xml service > >> "AIMCCAuthCapture", and services_paymentmethod.xml service > >> "ccAuthInterface" and service > >> "paymentProcessInterface". > >> > >> Jonathon > >> > >> [EMAIL PROTECTED] wrote: > >>> Jonathon > >>> > >>> Thanks for the input. However, I guess I didn't ask the question right. > >>> "calculateProductPrice" is defined as a service in services_pricepromo.xml > >>> as: > >>> > >>> <service name="calculateProductPrice" engine="java" > >>> location="org.ofbiz.product.price.PriceServices" > >>> invoke="calculateProductPrice" auth="false" use-transaction="false"> > >>> ... > >>> > >>> and this is loaded from ...product/ofbiz-component.xml as > >>> <service-resource type="model" loader="main" > >>> location="servicedef/services_pricepromo.xml"/> > >>> > >>> The question is, how can I override the original definition without > >>> modifying Ofbiz code. i.e. can I put an identically named service > >>> definition in hot-deploy or somewhere and have all of Ofbiz use my new > >>> calculateProductPrice? > >>> > >>> Skip > >>> > >>> > >>> -----Original Message----- > >>> From: Jonathon -- Improov [mailto:[EMAIL PROTECTED] > >>> Sent: Sunday, September 30, 2007 2:39 AM > >>> To: [email protected] > >>> Subject: Re: Complicated pricing > >>> > >>> > >>> Yes, overriding that method will mean you won't touch the OFBiz codes. > >>> That > >>> could mean you can > >>> continue to use your custom method, while still conveniently watching the > >>> community's updates to > >>> the original method. > >>> > >>> Such a method override will also kinda "document" your custom method as > >>> "being related to some > >>> original OFBiz method", so you know what original OFBiz codes to use for > >>> side-by-side comparisons > >>> of your codes. Making huge overhauls to the original method can make it > >>> difficult to do such > >>> comparisons. > >>> > >>> One gotcha here. Make sure you fully understand the original method you're > >>> overriding, so that you > >>> don't break any dependencies on that method. > >>> > >>> As far as possible, I do try to touch as few OFBiz codes as possible. If > >>> any > >>> OFBiz codes need to > >>> be enhanced, it is possibly to make them more generic and more base-level > >>> or > >>> more fine-grained or > >>> more customizable building blocks. > >>> > >>> Jonathon > >>> > >>> [EMAIL PROTECTED] wrote: > >>>> I have had another discussion about pricing with my customer today and > >>>> the > >>>> pricing is more complicated that I remembered. Their pricing is based on > >>> a > >>>> percentage above cost and package quantity, i.e. 30% above cost for one > >>>> package (12 pieces), 25% above cost for 2 packages (24 pieces), and 100 > >>>> percent above cost for any broken package plus a fixed abount depending > >>>> on > >>>> cost, i.e. + a buck for all below 1 dollar, + 2 for all below 5 and > >>> nothing > >>>> for above 10. > >>>> > >>>> This is outside what I see in the ofbiz pricing module in > >>>> PriceServices.java, and so it appears as if I will have to write my own > >>>> price calculation service. > >>>> > >>>> What I would like to do is write a subclass of PriceServices so my > >>>> "calculateProductPrice" subclass gets called whenever > >>>> runSync("calculateProductPrice") gets called. I would like to do this in > >>>> such a way that I don't bother the core Ofbiz code as I'll still be using > >>>> the shoppingcart, etc. > >>>> > >>>> Can anyone offer any advice or point me to samples? > >>>> > >>>> Skip > >>>> > >>>> > >>> > >>> > > > > >
