-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

A table in a database is an entity
in entity form you would have 4 fields
 <entity entity-name="protocolAttribute"
field name="id" type="id-ne"></field>
<field name="protocolid" type="id"></field>
<field name="attribute" type="long-varchar"></field>
<field name="value" type="long-varchar"></field>
<prim-key field="protocolid"/>
</entity>
your attribute would be enumerations

BTW you can do an export of entities and it will build the Entity from
the table you put in.


Jack Liu sent the following on 2/16/2009 6:03 PM:
> In the table protocolAttribute, records show below
> id, protocolid, attribute,           value
> 1   1           ChlUrl               192.168.77.22/abc
> 2   1           ServerID             DWAI
> 3   2           ChlUrl               192.168.77.22/abc
> 4   2           SupportedCharsets    gbk,UTF8
> 
> 
> -----Original Message-----
> From: Jack Liu [mailto:[email protected]] 
> Sent: 2009年2月17日 9:55
> To: [email protected]
> Subject: RE: Tricky! About fields in the form
> 
> Maybe I didn't make myself clear.
> We know, if we add a field in the entity, it will show up in the service and 
> the form automatically.
> But in my projects, we add NOT a field in the entity, but a VALUE.
>>From the view of database, we just add a record in the table, not a field.
> 
> It's totally different.
> 
> -----Original Message-----
> From: David E Jones [mailto:[email protected]] 
> Sent: 2009年2月17日 9:39
> To: [email protected]
> Subject: Re: Tricky! About fields in the form
> 
> 
> Yes. Look at the entities, services, and forms in the Example  
> application (and in fact most in OFBiz).
> 
> The pattern we usually use is that services are derived from entities  
> (both defs and implementation), and forms (ie form fields) are derived  
> from services. So, if you add a field to the entity it will show up in  
> the service and the form.
> 
> If you haven't already, you should check out the framework  
> introduction videos, which explain this and other patterns:
> 
> http://docs.ofbiz.org/display/OFBTECH/Framework+Introduction+Videos+and+Diagrams
> 
> -David
> 
> 
> On Feb 16, 2009, at 6:29 PM, Jack Liu wrote:
> 
>> Hi, All
>> In my project, there are many protocols to set up.
>> For every protocol, it has many attributes.
>> All these protocols have been divided into several types according to
>> their usage.
>>
>> For example
>> A type has attributes: ChlUrl, SupportedCharsets, ServerID
>> B type has attributes: InClientPull
>> C type has attributes: ChlUrl, SMRCustomerType, GMDChargingCurrency,
>> SupportedCharsets, ServerID
>>
>>      <form name="A" type="single"
>> target="createProtocolAttribute?protocolid=${id}">
>>              <field name="ChlUrl"><text/></field>
>>              <field name="SupportedCharsets"><text/></field>
>>              <field name="ServerID"><text/></field>
>>              <field name="submitButton" title="Add Protocol">
>>                      <submit button-type="button"/>
>>              </field>
>>      </form>
>>      <form name="B" type="single"
>> target="createProtocolAttribute?protocolid=${id}">
>>              <field name="InClientPull"><text/></field>
>>              <field name="submitButton" title="Add Protocol">
>>                      <submit button-type="button"/>
>>              </field>
>>      </form>
>>      <form name="C" type="single"
>> target="createProtocolAttribute?protocolid=${id}">
>>              <field name="ChlUrl"><text/></field>
>>              <field name="SMRCustomerType"><text/></field>
>>              <field name="GMDChargingCurrency"><text/></field>
>>              <field name="SupportedCharsets"><text/></field>
>>              <field name="ServerID"><text/></field>
>>              <field name="submitButton" title="Add Protocol">
>>                      <submit button-type="button"/>
>>              </field>
>>      </form>
>>
>> When setting up a protocol in a web page, first choose a type from
>> drop-down list, the web page show attributes relating to its type.
>> After filling in the attributes' value, submit the form and save all
>> these attribute-value pairs in the table protocolAttribute below.
>>
>> services.xml
>>      <service name=" createProtocolAttribute " engine="java"
>> location="com.xian.cmb.CmbServices" invoke="createProtocolAttribute">
>>              <attribute name="ChlUrl" mode="IN" type="String"
>> optional="true" />
>>              <attribute name="SupportedCharsets" mode="IN"
>> type="String" optional="true" />
>>              <attribute name="ServerID" mode="IN" type="String"
>> optional="true" />
>>              <attribute name="InClientPull" mode="IN" type="String"
>> optional="true" />
>>              <attribute name="SMRCustomerType" mode="IN"
>> type="String" optional="true" />
>>              <attribute name="GMDChargingCurrency" mode="IN"
>> type="String" optional="true" />
>>    </service>
>>
>>
>> Tables:
>> protocol: protocolid, protocolName.
>> protocolAttribute: id, protocolid, attribute, value.
>>
>>
>> With the progress of technology, the number of every protocol's
>> attributes is increasing.
>> So we need to modify the forms in the screens to add new fields and
>> services.xml file to add mode IN attributes, and java code to save  
>> newly
>> added attribute-value pairs.
>> Can OFBiz have solutions to deal with the CHANGE and When adding an
>> attribute, we needn't modify the form, services.xml and java source
>> code?
>>
>>
>>
>>
>> Best Regards,
>>
>> Jack Liu
>>
> 
> 
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJmkZFrP3NbaWWqE4RAqrzAJ9I1cV5BZpA2vnOfIAma5k73F0llgCfYke2
BAUh33LWm53UtGpk0LVjiRs=
=tOki
-----END PGP SIGNATURE-----

Reply via email to