Files
ofbiz-framework/framework/entity/entitydef/entitymodel_test.xml
T
Adrian Crum 6ad531be48 Some work on the entity engine:
1. Removed the conversion framework from the entity engine. Type conversions should be done higher up in the stack. The basic pattern is the same, but instead of each ModelFieldType containing a converter instance, it now contains a JdbcValueHandler instance. The JdbcValueHandler performs the same task as the original switch statement - in effect each ModelFieldType contains its own piece of the switch statement.

2. Added two new field types: byte[] and Object. Originally, the Blob field type was a catch-all for multiple Java data types. This change disambiguates the field's contents.

This has been tested on Advantage, Derby, and MySQL. It should be completely backward compatible. I will be monitoring the dev mailing list closely for any problems.



git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@959470 13f79535-47bb-0310-9956-ffa450edef68
2010-06-30 23:27:24 +00:00

169 lines
7.8 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<entitymodel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/entitymodel.xsd">
<!-- ========================================================= -->
<!-- ======================== Defaults ======================= -->
<!-- ========================================================= -->
<title>Entity testing suite</title>
<description>None</description>
<version>1.0</version>
<!-- =========================================================
For the test, testing is the basic entity.
It can have a type represented by TestingType, and can be a member of a TestingNode.
TestingNodes represent a hierarchy of Node, each Node can have one parent
and many children.
A TestingNodeMember can be member of many TestingNodes.
========================================================= -->
<!-- ======================== Data Model ===================== -->
<!-- The modules in this file are as follows: -->
<!-- - org.ofbiz.entity.test -->
<!-- ========================================================= -->
<!-- =========================================================
The testing entity is a basic entity with a type
========================================================= -->
<entity entity-name="Testing"
package-name="org.ofbiz.entity.test"
title="Testing Entity">
<field name="testingId" type="id-ne"/>
<field name="testingTypeId" type="id-ne"/>
<field name="testingName" type="name" enable-audit-log="true"/>
<field name="description" type="description"/>
<field name="comments" type="comment"/>
<field name="testingSize" type="numeric"/>
<field name="testingDate" type="date-time"/>
<prim-key field="testingId"/>
<relation type="one" fk-name="ENTITY_ENTY_TYP" rel-entity-name="TestingType">
<key-map field-name="testingTypeId"/>
</relation>
</entity>
<!-- =========================================================
Testing entity type
========================================================= -->
<entity entity-name="TestingType"
package-name="org.ofbiz.entity.test"
title="Testing Entity Type">
<field name="testingTypeId" type="id-ne"/>
<field name="description" type="description"/>
<prim-key field="testingTypeId"/>
</entity>
<!-- =========================================================
An entity for testing the BLOB data type
========================================================== -->
<entity entity-name="TestBlob"
package-name="org.ofbiz.entity.test"
title="Entity for testing the blob type (Deprecated)">
<description>Deprecated - use TestFieldType instead</description>
<field name="testBlobId" type="id-ne"/>
<field name="testBlobField" type="blob"/>
<prim-key field="testBlobId"/>
</entity>
<!-- =========================================================
An entity for testing the field data types
========================================================== -->
<entity entity-name="TestFieldType"
package-name="org.ofbiz.entity.test"
title="Entity for testing the field data types">
<description>An entity for testing the field data types</description>
<field name="testFieldTypeId" type="id-ne"/>
<field name="blobField" type="blob"/>
<field name="byteArrayField" type="byte-array"/>
<field name="objectField" type="object"/>
<field name="dateField" type="date"/>
<field name="timeField" type="time"/>
<field name="dateTimeField" type="date-time"/>
<field name="fixedPointField" type="fixed-point"/>
<field name="floatingPointField" type="floating-point"/>
<field name="numericField" type="numeric"/>
<field name="clobField" type="very-long"/>
<prim-key field="testFieldTypeId"/>
</entity>
<!-- =========================================================
Testing Node entity : hierarchy of nodes having
'testing node member' as potential members
========================================================= -->
<entity entity-name="TestingNode"
package-name="org.ofbiz.entity.test"
title="Testing Node">
<field name="testingNodeId" type="id-ne"></field>
<field name="primaryParentNodeId" type="id"></field>
<field name="description" type="description"></field>
<prim-key field="testingNodeId"/>
<relation type="one" fk-name="TESTNG_NDE_PARNT" title="PrimaryParent" rel-entity-name="TestingNode">
<key-map field-name="primaryParentNodeId" rel-field-name="testingNodeId"/>
</relation>
<relation type="many" title="PrimaryChild" rel-entity-name="TestingNode">
<key-map field-name="testingNodeId" rel-field-name="primaryParentNodeId"/>
</relation>
</entity>
<!-- =========================================================
Testing Node member
A testing member entity can belong to any testing node
========================================================= -->
<entity entity-name="TestingNodeMember"
package-name="org.ofbiz.entity.test"
title="Testing Node Member">
<field name="testingNodeId" type="id-ne"></field>
<field name="testingId" type="id-ne"></field>
<field name="fromDate" type="date-time"></field>
<field name="thruDate" type="date-time"></field>
<prim-key field="testingNodeId"/>
<prim-key field="testingId"/>
<prim-key field="fromDate"/>
<relation type="one" fk-name="TESTING_NMBR_TEST" rel-entity-name="Testing">
<key-map field-name="testingId"/>
</relation>
<relation type="one" fk-name="TEST_NMBR_NODE" rel-entity-name="TestingNode">
<key-map field-name="testingNodeId"/>
</relation>
</entity>
<!-- =========================================================
View : a Testing Node with its member(s)
========================================================= -->
<view-entity entity-name="TestingNodeAndMember"
package-name="org.ofbiz.entity.test"
title="TestingNode And TestingNodeMember View">
<member-entity entity-alias="TN" entity-name="TestingNode"/>
<member-entity entity-alias="TNM" entity-name="TestingNodeMember"/>
<alias-all entity-alias="TN"/>
<alias-all entity-alias="TNM"/>
<view-link entity-alias="TN" rel-entity-alias="TNM">
<key-map field-name="testingNodeId"/>
</view-link>
<relation type="one-nofk" rel-entity-name="TestingNodeMember">
<key-map field-name="testingNodeId"/>
<key-map field-name="testingId"/>
<key-map field-name="fromDate"/>
</relation>
<relation type="one-nofk" rel-entity-name="TestingNode">
<key-map field-name="testingNodeId"/>
</relation>
<relation type="one-nofk" rel-entity-name="Testing">
<key-map field-name="testingId"/>
</relation>
</view-entity>
</entitymodel>