Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The Open For Business Project: General Entity Overview

Written By: David E. Jones, jonesde@ofbiz.org

Info
titleStatus

This document is an early attempt to organize the data corresponding to the various components of the overall system.  Some parts are much more complete and thought out than others. Please send me feed back on any omissions or errors.

 

Table of Contents

Introduction

The purpose of this document is to describe the Entities OFBiz entities in various components and their design. A brief overview of each component will be presented which will include a description of the entities in the component and their relations to other entities.

There are some files that go along with the definitions of these entities. These files are located in the "entitydef" directory of each components. The most important file is generally named something like entitymodel*.xml which contain the XML definitions for all of the entities in the project'entitydef' folder in the datamodel component for the base OFBiz components. For special purpose components the entity definitions are in the 'entitydef' folder of the particular component. For an explanation of what these entity types are and how they are used, see the Extensibility Pattern section of this document.

Another important set of files is in the "data" directory folder of each component. These are XML Entity Engine Import files that contain seed and demo data including various entity types for related to the various entities in the data model. For an explanation of what these entity types are and how they are used, see the Extensibility Pattern section of this document.

Extensibility Pattern

There is one pattern that you will see repeated often in this the OFBiz data model that warrants some explanation. This pattern is used to make the data model more flexible and eliminate a great many tables that might otherwise have to exist. It aids in the conceptualization of the use of an entity that follows this pattern. It also provides a method for run-time extensibility of the entities that use this pattern.

For a given Entity there are 3 or 4 related entities that are used to implement this pattern. These are:

  • EntityClass (optional),
  • EntityType, 
  • EntityAttribute,

...

  • and 
  • EntityTypeAttr.

Each Entity instance can have one or more types which are described by EntityType. If an Entity can have multiple types the EntityClass, or Entity Classification entity is used to implement the many-to-many relation between Entity and EntityType. Otherwise no EntityClass is necessary and Entity will have an entityTypeId field.

EntityType

EntityType is used to describe an Entity. A given EntityType can inherit features from a parent EntityType if one is specified in the parentTypeId field of a given EntityType instance. If a table is associated with a given EntityType instance that has the same name as the entityTypeId field value then the hasTable field should have the value 'Y', otherwise it should have the value 'N'. A description field is provided for a short description of an EntityType instance.

EntityAttribute

EntityAttribute is used to store instances of name-value pair attributes for a given Entity instance. An attribute can be used in place of a column on the Entity table, especially when the attribute does not apply to all types of Entities. Attributes can also be used ad-hoc for any name-value pair information that applies to a given Entity instance. If many attributes apply to a given EntityType it may be best to create a separate entity to hold those attributes, and have that entity be associated with the EntityType instance by naming it the same as the entityTypeId and setting the hasTable field to 'Y' on the EntityType instance. This will be faster than repeatedly querying a collection of attributes for a given Entity instance.

EntityTypeAttr

EntityTypeAttr is used to specify which attributes should exist for an Entity instance that corresponds to a given entityTypeId. The entityTypeId and name field combinations are listed to specify this. For example, the EntityType with entityTypeId 'BOX' should always have attributes named 'HEIGHT', 'WIDTH', 'DEPTH', and 'COLOR', so an instance of EntityTypeAttr will exist for each of these attributes.

...

Whenever doing any of these sorts of changes that require additional steps to update a production server, ALWAYS add an entry on this page: Revisions Requiring Data Migration - upgrade ofbiz

Packages

Common

The Common package is meant to contain entities that are for general use and may be used by entities in many other packages.

...