I think you're going in the wrong direction. Read this document (below), specially the section "Extending an Existing Component".
https://cwiki.apache.org/OFBIZ/addressing-custom-requirements-in-ofbiz.html

May be all you need is to just override the webapp, not even the component.

Thanks&  Regards
Atul Vani
Enterprise Software Developer
HotWax Media Pvt. Ltd.
http://www.hotwaxmedia.com/
We are the Global Leaders in Apache OFBiz, Google 'ofbiz' and see for yourself.


On 04/13/2012 10:14 PM, Skip wrote:
Let me restate the two problems a little more succinctly.

Problem 1
I want to include a controller from a hot-deploy component into an existing
ofbiz controller in applications directories.  I know I can use "condition /
widget / fail-widget tags" in screen widgets, but can you use something
similiar in a controller.xml file.  I could find no examples.

For example, in
...applications/product/webapp/catalog/WEB-INF/controller.xml

     <include
location="component://company1/webapp/common/WEB-INF/common-controller.xml"/
Only, I want the location to be a variable like
<include location="${externalLocation}"/>

If this is possible, where can I declare "externalLocation".

Alternately, is it possible to "inject" the hot-deploy controller into the
first.

Problem 2

I want to call a service with an indeterminate attribute list.

I think I have found the solution here.  Just set validate="false" in the
service declaration and I can pass in whatever attributes I want from the
form widget.



-----Original Message-----
From: Atul Vani [mailto:[email protected]]
Sent: Thursday, April 12, 2012 10:43 PM
To: [email protected]
Subject: Re: Complicated Question


Didn't get the problem completely, but still, check my comments inline.

Thanks&   Regards
Atul Vani
Enterprise Software Developer
HotWax Media Pvt. Ltd.
http://www.hotwaxmedia.com/
We are the Global Leaders in Apache OFBiz, Google 'ofbiz' and see for
yourself.


On 04/13/2012 05:55 AM, Skip wrote:
I am implementing Ofbiz for two sister companies, each of which sells
different kinds of products.  I have implemented the first company and am
starting on the second.  I would like to maintain just a single set of
source for both companies.

I have two components in hot-deploy that load the seed data and code
specific to each company. Only one or the other is included in
component-load.xml.


However, I do not want these screens from company 1 available in the
second
company.  These company specific screens have to do with product
attributes
for the items sold.

In the ordermgr order entry screen, I have have added a secondary screen
that allows sales people to look up products by their attributes using
product type specific screens.  For example, for a screw, they enter the
thread count, length, material, etc.  Another example would be would be a
tap which has fields for diameter, length, thread count, etc.

Other screens allow inexperienced employees to enter new products by
selecting product attributes from product specific dropdowns.  Using this
data, they can add or update products.

There are two problems here, the add and update actions require product
specific URLs which eventually end up in product specific services.

I would like to do two things.

The first is to include the controller.xml file for one or the other of
these two companies into the the controller.xml file for facility and
catalog that has these product specific URLs.  For example, in a screen
widget, I can do:

<condition>
    <not><if-empty field-name="findScreenName"/></not>
</condition>
<widgets>
   <include-screen name="${findScreenName}"/>
</widgets>

is it possible to do something like this:

<condition>
     somecondition
</condition>
<include
location="component://product/webapp/facility/WEB-INF/controller.xml"/>

or

<include location="${externalLocation}"/>    and specify externalLocation
in
the web.xml file maybe?

Check out the use of condition / widget / fail-widget tags.

Second,  I could write a single service to do these add/update services if
there was a way to pass an arbitrary list of attributes in the context to
the service and not have the service engine complain that field is not
defined for service .

For example, if I have a service defined as:

      <service name="createInventoryProduct" engine="java" auth="true"
default-entity-name=""
              location="com.fs.inventory.InventoryServices"
invoke="createInventoryProduct"
              use-transaction="false">
          <description>
                Create a Product, SupplierProduct, and default ProductPrice
          </description>
          <attribute name="productId" type="String" mode="INOUT"
optional="false"/>
          <attribute name="internalName" type="String" mode="IN"
optional="false"/>
          <attribute name="description" type="String" mode="IN"
optional="false"/>
          <attribute name="productType" type="String" mode="IN"
optional="false"/>
      </service>

Use attribute(s) of type List in the service. Use 2 or more fields with
the same name in the HTML form.

and I pass an attribute "color", I get an error from the service
validation
code.  Is there some way to inform the service engine that the service
could
have an arbitrary number of additional attributes (based on the
productType
in this case) and to not throw this error?

Thanks in advance for your help.

Skip

Reply via email to