You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Skip <sk...@thedevers.org> on 2012/04/13 02:25:55 UTC

Complicated Question

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?


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>

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


RE: Complicated Question

Posted by Skip <sk...@thedevers.org>.
Thanks Jacques, I'll have a look.

This might be a nice feature generically to allow enhancement of existing
applications without making modifications to them.  This has been a big
problem for me.  I have to many modifications to existing controller.xml,
etc that when I upgrade versions, it is a major job to copy over all the
changes.

-----Original Message-----
From: Jacques Le Roux [mailto:jacques.le.roux@les7arts.com]
Sent: Friday, April 13, 2012 12:56 PM
To: user@ofbiz.apache.org
Subject: Re: Complicated Question


From: "Skip" <sk...@thedevers.org>
> 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}"/>

You can't use that OOTB, but you could maybe have a look at
FlexibleLocation.resolveLocation() and create an entry in a
locationresolvers.properties file (or even teawk the FlexibleLocation class)
The  question is more from where would come your externalLocation var and
how you would make it vary
Jacques


> 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:atul.vani@hotwaxmedia.com]
> Sent: Thursday, April 12, 2012 10:43 PM
> To: user@ofbiz.apache.org
> 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
>>
>


Re: Complicated Question

Posted by Jacques Le Roux <ja...@les7arts.com>.
From: "Skip" <sk...@thedevers.org>
> 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}"/>

You can't use that OOTB, but you could maybe have a look at FlexibleLocation.resolveLocation() and create an entry in a 
locationresolvers.properties file (or even teawk the FlexibleLocation class)
The  question is more from where would come your externalLocation var and how you would make it vary
Jacques


> 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:atul.vani@hotwaxmedia.com]
> Sent: Thursday, April 12, 2012 10:43 PM
> To: user@ofbiz.apache.org
> 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
>>
> 

Re: Complicated Question

Posted by Atul Vani <at...@hotwaxmedia.com>.
Glad to be helpful.

--
Thanks & Regards
Atul Vani

On 4/16/2012 10:33 PM, Skip wrote:
> Thaks Atul, this is exactly what I needed.  I looked and looked at pages of
> Google returns and could not find this.
>
> Thanks again
>
> Skip
>
> -----Original Message-----
> From: Atul Vani [mailto:atul.vani@hotwaxmedia.com]
> Sent: Sunday, April 15, 2012 9:30 PM
> To: user@ofbiz.apache.org
> Subject: Re: Complicated Question
>
>
> 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:atul.vani@hotwaxmedia.com]
>> Sent: Thursday, April 12, 2012 10:43 PM
>> To: user@ofbiz.apache.org
>> 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
>>>

RE: Complicated Question

Posted by Skip <sk...@thedevers.org>.
Thaks Atul, this is exactly what I needed.  I looked and looked at pages of
Google returns and could not find this.

Thanks again

Skip

-----Original Message-----
From: Atul Vani [mailto:atul.vani@hotwaxmedia.com]
Sent: Sunday, April 15, 2012 9:30 PM
To: user@ofbiz.apache.org
Subject: Re: Complicated Question


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:atul.vani@hotwaxmedia.com]
> Sent: Thursday, April 12, 2012 10:43 PM
> To: user@ofbiz.apache.org
> 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
>>


Re: Complicated Question

Posted by Atul Vani <at...@hotwaxmedia.com>.
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:atul.vani@hotwaxmedia.com]
> Sent: Thursday, April 12, 2012 10:43 PM
> To: user@ofbiz.apache.org
> 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
>>

Re: Complicated Question

Posted by Jacopo Cappellato <ja...@hotwaxmedia.com>.
On Apr 13, 2012, at 6:44 PM, Skip wrote:

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

I would consider to declare, in your hot-deploy component a webapp that extends the ootb one with the same mount point.

Jacopo

RE: Complicated Question

Posted by Skip <sk...@thedevers.org>.
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:atul.vani@hotwaxmedia.com]
Sent: Thursday, April 12, 2012 10:43 PM
To: user@ofbiz.apache.org
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
>


Re: Complicated Question

Posted by Atul Vani <at...@hotwaxmedia.com>.
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
>