Regards Scott
HotWax Media http://www.hotwaxmedia.com On 16/10/2009, at 5:22 PM, Hans Bakker wrote:
In general, this looks like a pretty good idea.The visibility tag would be nice if the widgets took advantage of that. then i would be easy to let a field disappear in the whole system when aif a simple 'true/false' would be possible. More complicated ones like the ones mentioned below could also beinteresting but the integration in the widgets is a must. ftl's will memore difficult (macros), jsp, not sure if we should support that. trigger and validation will be more complex but sure we could look at that. In general a good idea Regards, Hans On Fri, 2009-10-16 at 05:16 +0800, Michael Xu (xudong) wrote:hi all, We can define entities in XML files. However, only database specificsemantics could be defined there. For those application level semantics (like trigger, visiblity, validation) has to be defined in different places. The lack of a single place to define such metadata makes ofbiz hard tomaintain. (Correct me if I am wrong)Let's take OrderHeader as an example. I copy the latest entity definition asbelow: <entity entity-name="OrderHeader" package-name="org.ofbiz.order.order" never-cache="true" title="Order Header Entity"> <field name="orderId" type="id-ne"></field> <field name="orderTypeId" type="id"></field> <field name="orderName" type="name"></field> <field name="externalId" type="id"></field> <field name="salesChannelEnumId" type="id"></field> <field name="orderDate" type="date-time"></field> <field name="entryDate" type="date-time"></field> <field name="visitId" type="id"></field> <field name="statusId" type="id"></field> <field name="createdBy" type="id-vlong"></field> <field name="firstAttemptOrderId" type="id"></field> <field name="currencyUom" type="id"></field> <field name="syncStatusId" type="id"></field> <field name="billingAccountId" type="id"></field> <field name="originFacilityId" type="id"></field> <field name="webSiteId" type="id"></field> <field name="productStoreId" type="id"></field> <field name="terminalId" type="id-long"></field> <field name="transactionId" type="id-long"></field> <field name="autoOrderShoppingListId" type="id"></field> <field name="needsInventoryIssuance" type="indicator"></field> <field name="isRushOrder" type="indicator"></field> <field name="internalCode" type="id-long"></field> <field name="remainingSubTotal" type="currency-amount"></field> <field name="grandTotal" type="currency-amount"></field> <prim-key field="orderId"/> <relation type="one" fk-name="ORDER_HDR_TYPE" rel-entity-name="OrderType"> <key-map field-name="orderTypeId"/> </relation><relation type="one" fk-name="ORDER_HDR_SCENUM" title="SalesChannel"rel-entity-name="Enumeration"><key-map field-name="salesChannelEnumId" rel-field- name="enumId"/></relation> <relation type="one" fk-name="ORDER_HDR_OFAC" title="Origin" rel-entity-name="Facility"><key-map field-name="originFacilityId" rel-field- name="facilityId"/></relation> <relation type="many" rel-entity-name="OrderTypeAttr"> <key-map field-name="orderTypeId"/> </relation> <relation type="one" fk-name="ORDER_HDR_BACCT" rel-entity-name="BillingAccount"> <key-map field-name="billingAccountId"/> </relation> <relation type="one" fk-name="ORDER_HDR_PDSTR" rel-entity-name="ProductStore"> <key-map field-name="productStoreId"/> </relation><relation type="one" fk-name="ORDER_HDR_AOSHLST" title="AutoOrder"rel-entity-name="ShoppingList"> <key-map field-name="autoOrderShoppingListId" rel-field-name="shoppingListId"/> </relation> <relation type="one" fk-name="ORDER_HDR_CBUL" title="CreatedBy" rel-entity-name="UserLogin"> <key-map field-name="createdBy" rel-field-name="userLoginId"/> </relation> <relation type="one" fk-name="ORDER_HDR_STTS" rel-entity-name="StatusItem"> <key-map field-name="statusId"/> </relation> <relation type="one" fk-name="ORDER_HDR_SYST" title="Sync" rel-entity-name="StatusItem"> <key-map field-name="syncStatusId" rel-field-name="statusId"/> </relation><relation type="one" fk-name="ORDER_HDR_CUOM" rel-entity- name="Uom"><key-map field-name="currencyUom" rel-field-name="uomId"/> </relation> <relation type="many" rel-entity-name="OrderHeaderNoteView"> <key-map field-name="orderId"/> </relation><relation type="many" rel-entity- name="OrderItemAndShipGroupAssoc"><key-map field-name="orderId"/> </relation> <index name="ORDEREXT_ID_IDX"> <index-field name="externalId"/> </index> </entity>In order to enrich the definition (metadata) with more information, I amconsidering to put more tags (please find elements surrounded with !!!!!!!!!!!!!!!!!!!!!), like: <entity entity-name="OrderHeader" package-name="org.ofbiz.order.order" never-cache="true" title="Order Header Entity"> <field name="orderId" type="id-ne"></field> <field name="orderTypeId" type="id"></field> <field name="orderName" type="name"></field> <!- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! <field name="externalId" type="id"> <!-We can use "visiblity" tag to tell system when to show thisfield in UI layer. -> <visbility> <condition implementation="org.ofbiz.core.condition.NonEmptyField"/> </visbility> <validity type="clientSide"> <condition notEqual="111"/> </validity> </field> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -> <field name="salesChannelEnumId" type="id"></field> <field name="orderDate" type="date-time"></field> <field name="entryDate" type="date-time"></field> <field name="visitId" type="id"></field> <field name="statusId" type="id"></field> <field name="createdBy" type="id-vlong"></field> <field name="firstAttemptOrderId" type="id"></field> <field name="currencyUom" type="id"></field> <field name="syncStatusId" type="id"></field> <field name="billingAccountId" type="id"></field> <field name="originFacilityId" type="id"></field> <field name="webSiteId" type="id"></field> <field name="productStoreId" type="id"></field> <field name="terminalId" type="id-long"></field> <field name="transactionId" type="id-long"></field> <field name="autoOrderShoppingListId" type="id"></field> <field name="needsInventoryIssuance" type="indicator"></field> <field name="isRushOrder" type="indicator"></field> <field name="internalCode" type="id-long"></field> <field name="remainingSubTotal" type="currency-amount"></field> <field name="grandTotal" type="currency-amount"></field> <prim-key field="orderId"/> <relation type="one" fk-name="ORDER_HDR_TYPE" rel-entity-name="OrderType"> <key-map field-name="orderTypeId"/> </relation><relation type="one" fk-name="ORDER_HDR_SCENUM" title="SalesChannel"rel-entity-name="Enumeration"><key-map field-name="salesChannelEnumId" rel-field- name="enumId"/></relation> <relation type="one" fk-name="ORDER_HDR_OFAC" title="Origin" rel-entity-name="Facility"><key-map field-name="originFacilityId" rel-field- name="facilityId"/></relation> <relation type="many" rel-entity-name="OrderTypeAttr"> <key-map field-name="orderTypeId"/> </relation> <relation type="one" fk-name="ORDER_HDR_BACCT" rel-entity-name="BillingAccount"> <key-map field-name="billingAccountId"/> </relation> <relation type="one" fk-name="ORDER_HDR_PDSTR" rel-entity-name="ProductStore"> <key-map field-name="productStoreId"/> </relation><relation type="one" fk-name="ORDER_HDR_AOSHLST" title="AutoOrder"rel-entity-name="ShoppingList"> <key-map field-name="autoOrderShoppingListId" rel-field-name="shoppingListId"/> </relation> <relation type="one" fk-name="ORDER_HDR_CBUL" title="CreatedBy" rel-entity-name="UserLogin"> <key-map field-name="createdBy" rel-field-name="userLoginId"/> </relation> <relation type="one" fk-name="ORDER_HDR_STTS" rel-entity-name="StatusItem"> <key-map field-name="statusId"/> </relation> <relation type="one" fk-name="ORDER_HDR_SYST" title="Sync" rel-entity-name="StatusItem"> <key-map field-name="syncStatusId" rel-field-name="statusId"/> </relation><relation type="one" fk-name="ORDER_HDR_CUOM" rel-entity- name="Uom"><key-map field-name="currencyUom" rel-field-name="uomId"/> </relation> <relation type="many" rel-entity-name="OrderHeaderNoteView"> <key-map field-name="orderId"/> </relation><relation type="many" rel-entity- name="OrderItemAndShipGroupAssoc"><key-map field-name="orderId"/> </relation> <index name="ORDEREXT_ID_IDX"> <index-field name="externalId"/> </index> <!- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! <!-In different context, maybe different set of fields need to show.So my ideahere is to use "group" to group fields for different scenario. Andthen in UIlevel, we can define a jsp tag or something to only show fieldswithin this group. -> <group name="summary"> <field name="orderId" rank="1"/> <field name="orderTypeId" rank="10"/> <field name="orderName" rank="11"/> </group> <group name="details"> <field name="orderId" rank="1"/> <field name="orderTypeId" rank="10"/> <field name="orderName" rank="11"/> <field name="externalId" rank="20"> <!-!!!!Note: Though visibility is definded above with anothercondition. However, in this group(Scenario), externalID will always be visible.-> <visbility value="true"/> <field> </group> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!-> </entity> Such an idea to make entity definition as a single point ofconfiguration/customization might make system easier to maintain/ customize.Am I right? If yes, anybody could suggest me how to implement it.(BTW: we are going to use ofbiz entity engine for our products just like what JIRA did. It would be great if such enhancement could be done direct under apache. Otherwise, we might have to maintain a customized ofbiz entityengine by ourselves.) -- Regards, Michael Xu (xudong)www.wizitsoft.com | Office: (8610) 6267 0615 ext 806 | Mobile: (86) 135 01359807 | Fax: (8610) 62670096-- Antwebsystems.com: Quality OFBiz services for competitive rates
smime.p7s
Description: S/MIME cryptographic signature
