<?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="https://ofbiz.apache.org/dtds/entitymodel.xsd">
  <!-- ========================================================= -->
  <!-- ======================== Defaults ======================= -->
  <!-- ========================================================= -->
    <title>Entity of an Apache OFBiz Component</title>
    <description>None</description>
    <version>1.0</version>

  <!-- ========================================================= -->
  <!-- ======================== Data Model ===================== -->
  <!-- The modules in this file are as follows:                  -->
  <!--  - org.apache.ofbiz.common.datasource -->
  <!--  - org.apache.ofbiz.common.email -->
  <!--  - org.apache.ofbiz.common.enum -->
  <!--  - org.apache.ofbiz.common.geo -->
  <!--  - org.apache.ofbiz.common.keyword -->
  <!--  - org.apache.ofbiz.common.language -->
  <!--  - org.apache.ofbiz.common.method -->
  <!--  - org.apache.ofbiz.common.note -->
  <!--  - org.apache.ofbiz.common.period -->
  <!--  - org.apache.ofbiz.common.status -->
  <!--  - org.apache.ofbiz.common.uom -->
  <!--  - org.apache.ofbiz.common.theme -->
  <!-- ========================================================= -->


  <!-- ========================================================= -->
  <!-- org.apache.ofbiz.common.datasource -->
  <!-- ========================================================= -->

    <entity entity-name="DataSource"
            package-name="org.apache.ofbiz.common.datasource"
            default-resource-name="CommonEntityLabels"
            title="Data Source">
      <field name="dataSourceId" type="id"></field>
      <field name="dataSourceTypeId" type="id"></field>
      <field name="description" type="description"></field>
      <prim-key field="dataSourceId"/>
      <relation type="one" fk-name="DATA_SRC_TYP" rel-entity-name="DataSourceType">
        <key-map field-name="dataSourceTypeId"/>
      </relation>
    </entity>
    <entity entity-name="DataSourceType"
            package-name="org.apache.ofbiz.common.datasource"
            title="Data Source Type">
      <field name="dataSourceTypeId" type="id"></field>
      <field name="description" type="description"></field>
      <prim-key field="dataSourceTypeId"/>
    </entity>

  <!-- ========================================================= -->
  <!-- org.apache.ofbiz.common.email -->
  <!-- ========================================================= -->

    <entity entity-name="EmailTemplateSetting" package-name="org.apache.ofbiz.common.email" title="Email Template Setting">
        <field name="emailTemplateSettingId" type="id"></field>
        <field name="emailType" type="id"></field>
        <field name="description" type="description"></field>
        <field name="bodyScreenLocation" type="long-varchar"><description>if empty defaults to a screen based on the emailType</description></field>
        <field name="xslfoAttachScreenLocation" type="long-varchar"><description>if specified is used to generate XSL:FO that is transformed to a PDF via Apache FOP and attached to the email</description></field>
        <field name="fromAddress" type="email"></field>
        <field name="ccAddress" type="email"></field>
        <field name="bccAddress" type="email"></field>
        <field name="subject" type="comment"></field>
        <field name="contentType" type="long-varchar"></field>
        <prim-key field="emailTemplateSettingId"/>
        <relation type="one" fk-name="EMAILSET_ENUM" rel-entity-name="Enumeration">
            <key-map field-name="emailType" rel-field-name="enumId"/>
        </relation>
    </entity>

  <!-- ========================================================= -->
  <!-- org.apache.ofbiz.common.enum -->
  <!-- ========================================================= -->

    <entity entity-name="Enumeration"
            package-name="org.apache.ofbiz.common.enum"
            default-resource-name="CommonEntityLabels"
            title="Enumeration">
      <field name="enumId" type="id"></field>
      <field name="enumTypeId" type="id"></field>
      <field name="enumCode" type="short-varchar"></field>
      <field name="sequenceId" type="id"></field>
      <field name="description" type="description"></field>
      <prim-key field="enumId"/>
      <relation type="one" fk-name="ENUM_TO_TYPE" rel-entity-name="EnumerationType">
        <key-map field-name="enumTypeId"/>
      </relation>
    </entity>
    <entity entity-name="EnumerationType"
            package-name="org.apache.ofbiz.common.enum"
            default-resource-name="CommonEntityLabels"
            title="Enumeration Type">
      <field name="enumTypeId" type="id"></field>
      <field name="parentTypeId" type="id"></field>
      <field name="hasTable" type="indicator"></field>
      <field name="description" type="description"></field>
      <prim-key field="enumTypeId"/>
      <relation type="one" fk-name="ENUM_TYPE_PARENT" title="Parent" rel-entity-name="EnumerationType">
        <key-map field-name="parentTypeId" rel-field-name="enumTypeId"/>
      </relation>
    </entity>

    <view-entity entity-name="EnumTypeChildAndEnum" package-name="org.apache.ofbiz.common.enum">
        <member-entity entity-alias="PARENT" entity-name="EnumerationType"/>
        <member-entity entity-alias="CHILD" entity-name="EnumerationType"/>
        <member-entity entity-alias="ENUM" entity-name="Enumeration"/>
        <alias-all entity-alias="PARENT" prefix="parent"/>
        <alias-all entity-alias="CHILD" prefix="child">
            <exclude field="parentTypeId"/>
        </alias-all>
        <alias-all entity-alias="ENUM"/>
        <view-link entity-alias="PARENT" rel-entity-alias="CHILD">
            <key-map field-name="enumTypeId" rel-field-name="parentTypeId"/>
        </view-link>
        <view-link entity-alias="CHILD" rel-entity-alias="ENUM">
            <key-map field-name="enumTypeId"/>
        </view-link>
    </view-entity>


  <!-- ========================================================= -->
  <!-- org.apache.ofbiz.common.geo -->
  <!-- ========================================================= -->

    <entity entity-name="CountryCapital"
            package-name="org.apache.ofbiz.common.geo"
            dependent-on="CountryCode"
            title="Country Capital">
      <field name="countryCode" type="id"></field>
      <field name="countryCapital" type="description"></field>
      <prim-key field="countryCode"/>
      <relation type="one" fk-name="CNTRY_CAP_TO_CODE" rel-entity-name="CountryCode">
        <key-map field-name="countryCode"/>
      </relation>
    </entity>
    <entity entity-name="CountryCode"
            package-name="org.apache.ofbiz.common.geo"
            title="ISO Country Code">
      <field name="countryCode" type="id"></field>
      <field name="countryAbbr" type="short-varchar"></field>
      <field name="countryNumber" type="short-varchar"></field>
      <field name="countryName" type="description"></field>
      <prim-key field="countryCode"/>
    </entity>
    <entity entity-name="CountryTeleCode"
            package-name="org.apache.ofbiz.common.geo"
            dependent-on="CountryCode"
            title="Telephone Country Code">
      <field name="countryCode" type="id"></field>
      <field name="teleCode" type="short-varchar"></field>
      <prim-key field="countryCode"/>
      <relation type="one" fk-name="CNTRY_TELE_TO_CODE" rel-entity-name="CountryCode">
        <key-map field-name="countryCode"/>
      </relation>
    </entity>
    <view-entity entity-name="CountryTeleCodeAndName" package-name="org.apache.ofbiz.common.geo"
        title="Telephone country code and country name">
        <member-entity entity-alias="CC" entity-name="CountryCode"/>
        <member-entity entity-alias="CT" entity-name="CountryTeleCode"/>
        <alias entity-alias="CT" name="teleCode"/>
        <alias entity-alias="CC" name="countryCode" prim-key="countryCodeId"/>
        <alias entity-alias="CC" name="countryName"/>
        <view-link entity-alias="CC" rel-entity-alias="CT">
            <key-map field-name="countryCode"/>
        </view-link>
    </view-entity>
    <entity entity-name="CountryAddressFormat" package-name="org.apache.ofbiz.common.geo" default-resource-name="CommonEntityLabels"
        title="">
        <field name="geoId" type="id"></field>
        <field name="geoAssocTypeId" type="id"></field>
        <field name="requireStateProvinceId" type="id"></field>
        <field name="requirePostalCode" type="indicator"></field>
        <field name="postalCodeRegex" type="long-varchar"></field>
        <field name="hasPostalCodeExt" type="indicator"></field>
        <field name="requirePostalCodeExt" type="indicator"></field>
        <field name="addressFormat" type="long-varchar"></field>
        <prim-key field="geoId"/>
        <relation type="one" rel-entity-name="Geo" fk-name="CNY_ADR_GEO">
            <key-map field-name="geoId"/>
        </relation>
        <relation type="one" fk-name="CNY_ADR_GEO_TYPE" rel-entity-name="GeoAssocType" >
            <key-map field-name="geoAssocTypeId"/>
        </relation>
    </entity>
    <entity entity-name="Geo" package-name="org.apache.ofbiz.common.geo"
            default-resource-name="CommonEntityLabels"
            title="Geographic Boundary">
        <field name="geoId" type="id"></field>
        <field name="geoTypeId" type="id"></field>
        <field name="geoName" type="name"></field>
        <field name="geoCode" type="short-varchar"></field>
        <field name="geoSecCode" type="short-varchar"></field>
        <field name="abbreviation" type="short-varchar"></field>
        <field name="wellKnownText" type="very-long"></field>
        <prim-key field="geoId" />
        <relation type="one" fk-name="GEO_TO_TYPE" rel-entity-name="GeoType">
            <key-map field-name="geoTypeId" />
        </relation>
    </entity>
    <entity entity-name="GeoAssoc" package-name="org.apache.ofbiz.common.geo"
            title="Geographic Boundary Association">
        <field name="geoId" type="id">
            <description>The enclosed geo</description>
        </field>
        <field name="geoIdTo" type="id">
            <description>The enclosing geo</description>
        </field>
        <field name="geoAssocTypeId" type="id"></field>
        <prim-key field="geoId" />
        <prim-key field="geoIdTo" />
        <relation type="one" fk-name="GEO_ASSC_TO_MAIN" title="Main" rel-entity-name="Geo">
            <key-map field-name="geoId" />
        </relation>
        <relation type="one" fk-name="GEO_ASSC_TO_ASSC" title="Assoc" rel-entity-name="Geo">
            <key-map field-name="geoIdTo" rel-field-name="geoId" />
        </relation>
        <relation type="one" fk-name="GEO_ASSC_TO_TYPE" rel-entity-name="GeoAssocType">
            <key-map field-name="geoAssocTypeId" />
        </relation>
    </entity>
    <view-entity entity-name="GeoAssocAndGeoFrom" package-name="org.apache.ofbiz.common.geo">
        <member-entity entity-alias="GA" entity-name="GeoAssoc"/>
        <member-entity entity-alias="GFR" entity-name="Geo"/>
        <alias-all entity-alias="GFR"/>
        <alias entity-alias="GA" name="geoIdTo"/>
        <alias entity-alias="GA" name="geoAssocTypeId"/>
        <view-link entity-alias="GA" rel-entity-alias="GFR">
            <key-map field-name="geoId"/>
        </view-link>
    </view-entity>
    <view-entity entity-name="GeoAssocAndGeoTo" package-name="org.apache.ofbiz.common.geo">
        <member-entity entity-alias="GA" entity-name="GeoAssoc"/>
        <member-entity entity-alias="GTO" entity-name="Geo"/>
        <alias-all entity-alias="GTO"/>
        <alias entity-alias="GA" name="geoIdFrom" field="geoId"/>
        <alias entity-alias="GA" name="geoAssocTypeId"/>
        <view-link entity-alias="GA" rel-entity-alias="GTO">
            <key-map field-name="geoIdTo" rel-field-name="geoId"/>
        </view-link>
    </view-entity>
    <view-entity entity-name="GeoAssocAndGeoToWithState" package-name="org.apache.ofbiz.common.geo">
        <member-entity entity-alias="GA" entity-name="GeoAssoc"/>
        <member-entity entity-alias="GTO" entity-name="Geo"/>
        <member-entity entity-alias="GWS" entity-name="CountryAddressFormat"/>
        <alias-all entity-alias="GTO"/>
        <alias entity-alias="GA" name="geoIdFrom" field="geoId"/>
        <alias entity-alias="GA" name="geoAssocTypeId"/>
        <view-link entity-alias="GA" rel-entity-alias="GTO">
            <key-map field-name="geoIdTo" rel-field-name="geoId"/>
        </view-link>
        <view-link entity-alias="GA" rel-entity-alias="GWS">
            <key-map field-name="geoId"/>
        </view-link>
    </view-entity>
    <entity entity-name="GeoAssocType" package-name="org.apache.ofbiz.common.geo"
        title="Geographic Boundary Association" default-resource-name="CommonEntityLabels">
      <field name="geoAssocTypeId" type="id"></field>
      <field name="description" type="description"></field>
      <prim-key field="geoAssocTypeId"/>
    </entity>
    <entity entity-name="GeoPoint" package-name="org.apache.ofbiz.common.geo" default-resource-name="CommonEntityLabels"
        title="Geographic Location">
        <field name="geoPointId" type="id"></field>
        <field name="geoPointTypeEnumId" type="id"/>
        <field name="description" type="description"></field>
        <field name="dataSourceId" type="id"></field>
        <field name="latitude" type="short-varchar" not-null="true"></field>
        <field name="longitude" type="short-varchar" not-null="true"></field>
        <field name="elevation" type="fixed-point"></field>
        <field name="elevationUomId" type="id"><description>UOM for elevation (feet, meters, etc.)</description></field>
        <field name="information" type="comment"><description>To enter any related information</description></field>
        <prim-key field="geoPointId"/>
        <relation type="one" fk-name="GEOPOINT_DTSRC" rel-entity-name="DataSource">
            <key-map field-name="dataSourceId"/>
        </relation>
        <relation type="one" fk-name="GEOPOINT_TYPE" title="GeoPointType" rel-entity-name="Enumeration">
            <key-map field-name="geoPointTypeEnumId" rel-field-name="enumId"/>
        </relation>
        <relation type="one" fk-name="GPT_ELEV_UOM" title="Elevation" rel-entity-name="Uom">
            <key-map field-name="elevationUomId" rel-field-name="uomId"/>
        </relation>
    </entity>
    <entity entity-name="GeoType" package-name="org.apache.ofbiz.common.geo" default-resource-name="CommonEntityLabels"
        title="Geographic Boundary Type">
      <field name="geoTypeId" type="id"></field>
      <field name="parentTypeId" type="id"></field>
      <field name="hasTable" type="indicator"></field>
      <field name="description" type="description"></field>
      <prim-key field="geoTypeId"/>
      <relation type="one" fk-name="GEO_TYPE_PARENT" title="Parent" rel-entity-name="GeoType">
        <key-map field-name="parentTypeId" rel-field-name="geoTypeId"/>
      </relation>
    </entity>
    <extend-entity entity-name="Visit">
        <field name="clientIpStateProvGeoId" type="id"></field>
        <field name="clientIpCountryGeoId" type="id"></field>
    </extend-entity>
 
  <!-- ========================================================= -->
  <!-- org.apache.ofbiz.common.keyword -->
  <!-- ========================================================= -->

    <entity entity-name="KeywordThesaurus"
            package-name="org.apache.ofbiz.common.keyword">
      <field name="enteredKeyword" type="long-varchar"></field>
      <field name="alternateKeyword" type="long-varchar"></field>
      <field name="relationshipEnumId" type="id"></field>
      <prim-key field="enteredKeyword"/>
      <prim-key field="alternateKeyword"/>
      <relation type="one" fk-name="KW_THRS_RLENM" title="Relationship" rel-entity-name="Enumeration">
        <key-map field-name="relationshipEnumId" rel-field-name="enumId"/>
      </relation>
    </entity>

  <!-- ========================================================= -->
  <!-- org.apache.ofbiz.common.language -->
  <!-- ========================================================= -->

    <entity entity-name="StandardLanguage"
            package-name="org.apache.ofbiz.common.language">
      <field name="standardLanguageId" type="id"></field>
      <field name="langCode3t" type="very-short"></field>
      <field name="langCode3b" type="very-short"></field>
      <field name="langCode2" type="very-short"></field>
      <field name="langName" type="short-varchar"></field>
      <field name="langFamily" type="short-varchar"></field>
      <field name="langCharset" type="short-varchar"></field>
      <prim-key field="standardLanguageId"/>
    </entity>

    <!-- ========================================================= -->
    <!-- org.apache.ofbiz.common.method -->
    <!-- ========================================================= -->

    <entity entity-name="CustomMethod"
        package-name="org.apache.ofbiz.common.method"
        default-resource-name="CommonEntityLabels"
        title="Custom Method">
        <field name="customMethodId" type="id"></field>
        <field name="customMethodTypeId" type="id"></field>
        <field name="customMethodName" type="long-varchar"></field>
        <field name="description" type="description"></field>
        <prim-key field="customMethodId"/>
        <relation type="one" fk-name="CME_TO_TYPE" rel-entity-name="CustomMethodType">
            <key-map field-name="customMethodTypeId"/>
        </relation>
    </entity>
    <entity entity-name="CustomMethodType"
        package-name="org.apache.ofbiz.common.method"
        title="Custom Method Type">
        <field name="customMethodTypeId" type="id"></field>
        <field name="parentTypeId" type="id"></field>
        <field name="hasTable" type="indicator"></field>
        <field name="description" type="description"></field>
        <prim-key field="customMethodTypeId"/>
        <relation type="one" fk-name="CME_TYPE_PARENT" title="Parent" rel-entity-name="CustomMethodType">
            <key-map field-name="parentTypeId" rel-field-name="customMethodTypeId"/>
        </relation>
    </entity>

  <!-- ========================================================= -->
  <!-- org.apache.ofbiz.common.note -->
  <!-- ========================================================= -->

    <entity entity-name="NoteData"
            package-name="org.apache.ofbiz.common.note"
            title="Note Data">
      <field name="noteId" type="id"></field>
      <field name="noteName" type="name"></field>
      <field name="noteInfo" type="very-long"></field>
      <field name="noteDateTime" type="date-time"></field>
      <prim-key field="noteId"/>
    </entity>

  <!-- ========================================================= -->
  <!-- org.apache.ofbiz.common.period -->
  <!-- ========================================================= -->

    <entity entity-name="CustomTimePeriod"
            package-name="org.apache.ofbiz.common.period"
            title="Custom Time Period">
      <field name="customTimePeriodId" type="id"></field>
      <field name="parentPeriodId" type="id"></field>
      <field name="periodTypeId" type="id"></field>
      <field name="periodNum" type="numeric"></field>
      <field name="periodName" type="name"></field>
      <field name="fromDate" type="date-time"></field>
      <field name="thruDate" type="date-time"></field>
      <field name="isClosed" type="indicator"></field>
      <prim-key field="customTimePeriodId"/>
      <relation type="one" fk-name="ORG_PRD_PARPER" title="Parent" rel-entity-name="CustomTimePeriod">
        <key-map field-name="parentPeriodId" rel-field-name="customTimePeriodId"/>
      </relation>
      <relation type="one" fk-name="ORG_PRD_PERTYP" rel-entity-name="PeriodType">
        <key-map field-name="periodTypeId"/>
      </relation>
    </entity>
    <entity entity-name="PeriodType"
            package-name="org.apache.ofbiz.common.period"
            title="Period Type">
      <field name="periodTypeId" type="id"></field>
      <field name="description" type="description"></field>
      <field name="periodLength" type="numeric"></field>
      <field name="uomId" type="id"></field>
      <prim-key field="periodTypeId"/>
      <relation type="one" fk-name="PER_TYPE_UOM" rel-entity-name="Uom">
        <key-map field-name="uomId"/>
      </relation>
    </entity>

  <!-- ========================================================= -->
  <!-- org.apache.ofbiz.common.status -->
  <!-- ========================================================= -->

    <entity entity-name="StatusItem"
            package-name="org.apache.ofbiz.common.status"
            default-resource-name="CommonEntityLabels"
            title="Status">
      <field name="statusId" type="id"></field>
      <field name="statusTypeId" type="id"></field>
      <field name="statusCode" type="short-varchar"></field>
      <field name="sequenceId" type="id"></field>
      <field name="description" type="description"></field>
      <prim-key field="statusId"/>
      <relation type="one" fk-name="STATUS_TO_TYPE" rel-entity-name="StatusType">
        <key-map field-name="statusTypeId"/>
      </relation>
    </entity>
    <entity entity-name="StatusType"
            package-name="org.apache.ofbiz.common.status"
            default-resource-name="CommonEntityLabels"
            title="Status Type">
      <field name="statusTypeId" type="id"></field>
      <field name="parentTypeId" type="id"></field>
      <field name="hasTable" type="indicator"></field>
      <field name="description" type="description"></field>
      <prim-key field="statusTypeId"/>
      <relation type="one" fk-name="STATUS_TYPE_PARENT" title="Parent" rel-entity-name="StatusType">
        <key-map field-name="parentTypeId" rel-field-name="statusTypeId"/>
      </relation>
    </entity>
    <entity entity-name="StatusValidChange"
            package-name="org.apache.ofbiz.common.status"
            default-resource-name="CommonEntityLabels"
            title="Status Valid Change">
      <field name="statusId" type="id"></field>
      <field name="statusIdTo" type="id"></field>
      <field name="conditionExpression" type="long-varchar"></field>
      <field name="transitionName" type="name"></field>
      <prim-key field="statusId"/>
      <prim-key field="statusIdTo"/>
      <relation type="one" fk-name="STATUS_CHG_MAIN" title="Main" rel-entity-name="StatusItem">
        <key-map field-name="statusId"/>
      </relation>
      <relation type="one" fk-name="STATUS_CHG_TO" title="To" rel-entity-name="StatusItem">
        <key-map field-name="statusIdTo" rel-field-name="statusId"/>
      </relation>
    </entity>
    <view-entity entity-name="StatusValidChangeToDetail"
        package-name="org.apache.ofbiz.common.status"
        title="Status Valid Change To Detail View">
        <member-entity entity-alias="SVC" entity-name="StatusValidChange"/>
        <member-entity entity-alias="SI" entity-name="StatusItem"/>
        <alias-all entity-alias="SVC"/>
        <alias-all entity-alias="SI"/>
        <view-link entity-alias="SVC" rel-entity-alias="SI">
            <key-map field-name="statusIdTo" rel-field-name="statusId"/>
        </view-link>
        <relation type="one" rel-entity-name="StatusValidChange">
            <key-map field-name="statusId"/>
            <key-map field-name="statusIdTo"/>
        </relation>
        <relation type="one" rel-entity-name="StatusItem">
            <key-map field-name="statusId"/>
        </relation>
        <entity-condition>
            <order-by field-name="sequenceId"/>
        </entity-condition>
    </view-entity>

  <!-- ========================================================= -->
  <!-- org.apache.ofbiz.common.uom -->
  <!-- ========================================================= -->

    <entity entity-name="Uom"
            package-name="org.apache.ofbiz.common.uom"
            default-resource-name="CommonEntityLabels"
            title="Unit Of Measure">
      <field name="uomId" type="id"></field>
      <field name="uomTypeId" type="id"></field>
      <field name="abbreviation" type="short-varchar"></field>
      <field name="numericCode" type="numeric"></field>
      <field name="description" type="description"></field>
      <prim-key field="uomId"/>
      <relation type="one" fk-name="UOM_TO_TYPE" rel-entity-name="UomType">
        <key-map field-name="uomTypeId"/>
      </relation>
    </entity>
    <view-entity entity-name="UomAndGroup"
            package-name="org.apache.ofbiz.common.uom"
            title="Unit Of Measure and Group/Type View">
        <member-entity entity-alias="UOMGP" entity-name="UomGroup"/>
        <member-entity entity-alias="UOM" entity-name="Uom"/>
        <member-entity entity-alias="UOMTP" entity-name="UomType"/>
        <alias-all entity-alias="UOMGP"/>
        <alias-all entity-alias="UOM"/>
        <alias-all entity-alias="UOMTP" prefix="type"/>
        <view-link entity-alias="UOMGP" rel-entity-alias="UOM">
            <key-map field-name="uomId"/>
        </view-link>
        <view-link entity-alias="UOM" rel-entity-alias="UOMTP">
            <key-map field-name="uomTypeId"/>
        </view-link>
    </view-entity>
    <view-entity entity-name="UomAndType"
            package-name="org.apache.ofbiz.common.uom"
            title="Unit Of Measure and Type View">
        <member-entity entity-alias="UOM" entity-name="Uom"/>
        <member-entity entity-alias="UOMTP" entity-name="UomType"/>
        <alias-all entity-alias="UOM"/>
        <alias-all entity-alias="UOMTP" prefix="type"/>
        <view-link entity-alias="UOM" rel-entity-alias="UOMTP">
            <key-map field-name="uomTypeId"/>
        </view-link>
    </view-entity>
    <entity entity-name="UomConversion"
            package-name="org.apache.ofbiz.common.uom"
            title="Unit Of Measure Conversion Type">
      <field name="uomId" type="id"></field>
      <field name="uomIdTo" type="id"></field>
      <field name="conversionFactor" type="floating-point"></field>
      <field name="customMethodId" type="id"></field>
      <field name="decimalScale" type="numeric"></field>
      <field name="roundingMode" type="id"></field>
      <prim-key field="uomId"/>
      <prim-key field="uomIdTo"/>
      <relation type="one" fk-name="UOM_CONV_MAIN" title="Main" rel-entity-name="Uom">
        <key-map field-name="uomId"/>
      </relation>
      <relation type="one" fk-name="UOM_CONV_TO" title="ConvTo" rel-entity-name="Uom">
        <key-map field-name="uomIdTo" rel-field-name="uomId"/>
      </relation>
      <relation type="one" fk-name="UOM_CUSTOM_METHOD" title="uomCustomMethod" rel-entity-name="CustomMethod">
        <key-map field-name="customMethodId" rel-field-name="customMethodId"/>
      </relation>
    </entity>
    <entity entity-name="UomConversionDated"
            package-name="org.apache.ofbiz.common.uom"
            title="Unit Of Measure Conversion Entity for those Units of Measure whose conversion values change over time (ie, currencies)">
      <field name="uomId" type="id"></field>
      <field name="uomIdTo" type="id"></field>
      <field name="fromDate" type="date-time"></field>
      <field name="thruDate" type="date-time"></field>
      <field name="conversionFactor" type="floating-point"></field>
      <field name="customMethodId" type="id"></field>
      <field name="decimalScale" type="numeric"></field>
      <field name="roundingMode" type="id"></field>
      <field name="purposeEnumId" type="id"></field>
      <prim-key field="uomId"/>
      <prim-key field="uomIdTo"/>
      <prim-key field="fromDate"/>
      <relation type="one" fk-name="DATE_UOM_CONV_MAIN" title="DatedMain" rel-entity-name="Uom">
        <key-map field-name="uomId"/>
      </relation>
      <relation type="one" fk-name="DATE_UOM_CONV_TO" title="DatedConvTo" rel-entity-name="Uom">
        <key-map field-name="uomIdTo" rel-field-name="uomId"/>
      </relation>
      <relation type="one" fk-name="UOMD_CUSTOM_METHOD" title="uomCustomMethod" rel-entity-name="CustomMethod">
        <key-map field-name="customMethodId" rel-field-name="customMethodId"/>
      </relation>
      <relation type="one" fk-name="UOMD_PURPOSE_ENUM" title="Purpose" rel-entity-name="Enumeration">
        <key-map field-name="purposeEnumId" rel-field-name="enumId"/>
      </relation>
    </entity>
    <entity entity-name="UomGroup"
            package-name="org.apache.ofbiz.common.uom"
            default-resource-name="CommonEntityLabels"
            title="Unit Of Measure Group">
      <field name="uomGroupId" type="id"></field>
      <field name="uomId" type="id"></field>
      <prim-key field="uomGroupId"/>
      <prim-key field="uomId"/>
      <relation type="one" fk-name="UOM_GROUP_UOM" rel-entity-name="Uom">
        <key-map field-name="uomId"/>
      </relation>
    </entity>
    <entity entity-name="UomType"
            package-name="org.apache.ofbiz.common.uom"
            default-resource-name="CommonEntityLabels"
            title="Unit Of Measure Type">
      <field name="uomTypeId" type="id"></field>
      <field name="parentTypeId" type="id"></field>
      <field name="hasTable" type="indicator"></field>
      <field name="description" type="description"></field>
      <prim-key field="uomTypeId"/>
      <relation type="one" fk-name="UOM_TYPE_PARENT" title="Parent" rel-entity-name="UomType">
        <key-map field-name="parentTypeId" rel-field-name="uomTypeId"/>
      </relation>
    </entity>

  <!-- ========================================================= -->
  <!-- org.apache.ofbiz.common.user -->
  <!-- ========================================================= -->

    <entity entity-name="UserPreference"
            package-name="org.apache.ofbiz.common.user"
            title="Application preferences for a given userLogin.">
      <description>The UserPreference entity contains one entry per preference per
          userLogin. User preferences are stored as key/value pairs (userPrefTypeId/userPrefValue).
          All values are stored as strings. Value strings can be converted to
          other data types by specifying a java data type in the userPrefDataType field.
      </description>
      <field name="userLoginId" type="id-vlong"></field>
      <field name="userPrefTypeId" type="id-long"><description>A unique identifier for this preference</description></field>
      <field name="userPrefGroupTypeId" type="id-long"><description>Used to assemble groups of preferences</description></field>
      <field name="userPrefValue" type="value"><description>Contains the value of this preference</description></field>
      <field name="userPrefDataType" type="id-long"><description>The java data type of this preference (empty = java.lang.String)</description></field>
      <prim-key field="userLoginId"/>
      <prim-key field="userPrefTypeId"/>
      <relation type="one-nofk" fk-name="UP_USER_LOGIN" rel-entity-name="UserLogin">
        <key-map field-name="userLoginId"/>
      </relation>
      <relation type="one" fk-name="UP_USER_GROUP_TYPE" rel-entity-name="UserPrefGroupType">
        <key-map field-name="userPrefGroupTypeId"/>
      </relation>
    </entity>

    <entity entity-name="UserPrefGroupType"
            package-name="org.apache.ofbiz.common.user"
            title="Defines a group of User Preferences">
      <description>The UserPrefGroupType entity contains one entry per preference
          group type.
      </description>
      <field name="userPrefGroupTypeId" type="id-long"></field>
      <field name="description" type="description"></field>
      <prim-key field="userPrefGroupTypeId"/>
    </entity>

    <!-- ========================================================= -->
    <!-- org.apache.ofbiz.common.screen -->
    <!-- ========================================================= -->

    <entity entity-name="CustomScreen"
        package-name="org.apache.ofbiz.common.screen"
        default-resource-name="CommonEntityLabels"
        title="Custom Screen">
        <field name="customScreenId" type="id"/>
        <field name="customScreenTypeId" type="id"/>
        <field name="customScreenName" type="long-varchar"/>
        <field name="customScreenLocation" type="long-varchar"/>
        <field name="description" type="description"/>
        <prim-key field="customScreenId"/>
        <relation type="one" fk-name="CSCR_TO_TYPE" rel-entity-name="CustomScreenType">
            <key-map field-name="customScreenTypeId"/>
        </relation>
    </entity>
    <entity entity-name="CustomScreenType"
        package-name="org.apache.ofbiz.common.screen"
        title="Custom Screen Type">
        <field name="customScreenTypeId" type="id"/>
        <field name="parentTypeId" type="id"/>
        <field name="hasTable" type="indicator"/>
        <field name="description" type="description"/>
        <prim-key field="customScreenTypeId"/>
        <relation type="many" fk-name="CSCR_TYPE_CHILD" title="Child" rel-entity-name="CustomScreenType">
            <key-map field-name="customScreenTypeId" rel-field-name="parentTypeId"/>
        </relation>
    </entity>

    <!-- ============================ -->
    <!-- org.apache.ofbiz.common.theme -->
    <!-- ============================ -->

    <entity entity-name="VisualThemeSet"
            package-name="org.apache.ofbiz.common.theme"
            title="Defines a set of Visual Themes">
      <description>Groups toghether Visual Themes that can be used for one (or a set of) application.</description>
      <field name="visualThemeSetId" type="id"></field>
      <field name="description" type="description"></field>
      <prim-key field="visualThemeSetId"/>
    </entity>

    <entity entity-name="VisualTheme"
            package-name="org.apache.ofbiz.common.theme"
            default-resource-name="CommonEntityLabels"
            title="Defines a Visual Theme">
      <description>The VisualTheme entity contains one entry per visual theme.</description>
      <field name="visualThemeId" type="id"></field>
      <field name="visualThemeSetId" type="id"></field>
      <field name="description" type="description"></field>
      <prim-key field="visualThemeId"/>
      <relation type="one" fk-name="VT_THEME_SET" rel-entity-name="VisualThemeSet">
        <key-map field-name="visualThemeSetId"/>
      </relation>
    </entity>

    <entity entity-name="VisualThemeResource"
            package-name="org.apache.ofbiz.common.theme"
            title="Contains All Visual Theme Resources">
      <description>The VisualThemeResource entity contains visual theme
          resources. Each visual theme can have any number of resources.</description>
      <field name="visualThemeId" type="id"></field>
      <field name="resourceTypeEnumId" type="id"></field>
      <field name="sequenceId" type="id"><description>Controls the loading order of duplicate resource types</description></field>
      <field name="resourceValue" type="value"><description>Contains the resource value</description></field>
      <prim-key field="visualThemeId"/>
      <prim-key field="resourceTypeEnumId"/>
      <prim-key field="sequenceId"/>
      <relation type="one" fk-name="VT_RES_THEME" rel-entity-name="VisualTheme">
          <key-map field-name="visualThemeId"/>
      </relation>
      <relation type="one" fk-name="VT_RES_TYPE_ENUM" rel-entity-name="Enumeration">
          <key-map field-name="resourceTypeEnumId" rel-field-name="enumId"/>
      </relation>
    </entity>

    <!-- ============================ -->
    <!-- org.apache.ofbiz.common.portal -->
    <!-- ============================ -->

    <entity entity-name="PortalPortlet" package-name="org.apache.ofbiz.common.portal" title="Defines a Portlet to be used in Portals">
        <field name="portalPortletId" type="id"></field>
        <field name="portletName" type="name"></field>
        <field name="screenName" type="long-varchar"></field>
        <field name="screenLocation" type="long-varchar"></field>
        <field name="editFormName" type="long-varchar"></field>
        <field name="editFormLocation" type="long-varchar"></field>
        <field name="description" type="description"></field>
        <field name="screenshot" type="url"></field>
        <field name="securityServiceName" type="long-varchar"><description>The service named here is used to see if current user can see the portlet on the list of available portlets; the screen that the portlet calls should also call this service to check permission and not render; the service named here must implement the "permissionInterface" service just like services used for service permissions</description></field>
        <field name="securityMainAction" type="short-varchar"><description>The main action which can be done with this portlet, possible values: CREATE UPDATE VIEW DELETE</description></field>
        <prim-key field="portalPortletId"/>
    </entity>
    <entity entity-name="PortletCategory" package-name="org.apache.ofbiz.common.portal" title="Portlet Category">
      <field name="portletCategoryId" type="id"/>
      <field name="description" type="description"/>
      <prim-key field="portletCategoryId"/>
    </entity>
    <entity entity-name="PortletPortletCategory" package-name="org.apache.ofbiz.common.portal" title="Defines Portlets included into Categories">
      <field name="portalPortletId" type="id"/>
      <field name="portletCategoryId" type="id"/>
      <prim-key field="portalPortletId"/>
      <prim-key field="portletCategoryId"/>
      <relation type="one" fk-name="PPTLTCAT_PTPL" rel-entity-name="PortalPortlet">
        <key-map field-name="portalPortletId"/>
      </relation>
      <relation type="one" fk-name="PPTLTCAT_PTLTCAT" rel-entity-name="PortletCategory">
        <key-map field-name="portletCategoryId"/>
      </relation>
    </entity>
    <entity entity-name="PortalPage" package-name="org.apache.ofbiz.common.portal" title="Defines a Portal Page"
        default-resource-name="CommonPortalEntityLabels">
        <field name="portalPageId" type="id"></field>
        <field name="portalPageName" type="name"></field>
        <field name="description" type="description"></field>
        <!-- defined in an extend in content component to avoid dependencies between common and content
        <field name="helpContentId" type="id"><description>Used to give contentId which will be shown when help on this page will be called</description></field>
         -->
        <field name="ownerUserLoginId" type="id-vlong"></field>
        <field name="originalPortalPageId" type="id"><description>The system portal page this page is derived from</description></field>
        <field name="parentPortalPageId" type="id"><description>the parent this page is belonging to, normally the startpage of the portal page group</description></field>
        <field name="sequenceNum" type="numeric"></field>
        <field name="securityGroupId" type="id"></field>
        <prim-key field="portalPageId"/>
        <!-- defined in an extend in content component to avoid dependencies between common and content
        <relation type="one" fk-name="PORTPAL_HELP_CONTENT" rel-entity-name="Content">
          <key-map field-name="helpContentId" rel-field-name="contentId"/>
        </relation>
        -->
        <relation type="one" fk-name="PortPage_PARENT" title="Parent" rel-entity-name="PortalPage">
          <key-map field-name="parentPortalPageId" rel-field-name="portalPageId"/>
        </relation>
        <relation type="one" fk-name="PORTPAGE_SECGRP" rel-entity-name="SecurityGroup">
          <key-map field-name="securityGroupId" rel-field-name="groupId"/>
        </relation>
    </entity>
  <view-entity entity-name="PortalPageAndUserLogin" package-name="org.apache.ofbiz.common.portal"
    title="PortalPage accessible via security group to a userLogin">
    <member-entity entity-alias="PP" entity-name="PortalPage"/>
    <member-entity entity-alias="UG" entity-name="UserLoginSecurityGroup"/>
    <alias entity-alias="PP" name="portalPageId"/>
    <alias entity-alias="PP" name="securityGroupId"/>
    <alias entity-alias="PP" name="parentPortalPageId"/>
    <alias entity-alias="UG" name="userLoginId"/>
    <alias entity-alias="UG" name="fromDate"/>
    <alias entity-alias="UG" name="thruDate"/>
    <view-link entity-alias="PP" rel-entity-alias="UG">
      <key-map field-name="securityGroupId" rel-field-name="groupId"/>
    </view-link>
  </view-entity>
  <entity entity-name="PortalPageColumn" package-name="org.apache.ofbiz.common.portal" title="Defines a Portal Page">
        <field name="portalPageId" type="id"></field>
        <field name="columnSeqId" type="id"></field>
        <field name="columnWidthPixels" type="numeric"></field>
        <field name="columnWidthPercentage" type="numeric"></field>
        <prim-key field="portalPageId"/>
        <prim-key field="columnSeqId"/>
        <relation type="one" fk-name="PRTL_PGCOL_PAGE" rel-entity-name="PortalPage">
            <key-map field-name="portalPageId"/>
        </relation>
    </entity>
    <entity entity-name="PortalPagePortlet" package-name="org.apache.ofbiz.common.portal" title="Defines Portlets included into Portal Pages">
        <field name="portalPageId" type="id"></field>
        <field name="portalPortletId" type="id"></field>
        <field name="portletSeqId" type="id"><description>Identify the portalPortlet instance in case more copy of the same portalPortlet are present in the same portalPage</description></field>
        <field name="columnSeqId" type="id"></field>
        <field name="sequenceNum" type="numeric"></field>
        <prim-key field="portalPageId"/>
        <prim-key field="portalPortletId"/>
        <prim-key field="portletSeqId"/>
        <relation type="one" fk-name="PRTL_PGPTLT_PAGE" rel-entity-name="PortalPage">
            <key-map field-name="portalPageId"/>
        </relation>
        <relation type="one" fk-name="PRTL_PGPTLT_PTLT" rel-entity-name="PortalPortlet">
            <key-map field-name="portalPortletId"/>
        </relation>
        <relation type="one-nofk" rel-entity-name="PortalPageColumn">
            <key-map field-name="portalPageId"/>
            <key-map field-name="columnSeqId"/>
        </relation>
    </entity>
    <view-entity entity-name="PortalPagePortletView" package-name="org.apache.ofbiz.common.portal" title="View entity to have all Portlet information with portalPageId ">
        <member-entity entity-alias="PPGPTLT" entity-name="PortalPagePortlet"/>
        <member-entity entity-alias="PTLT" entity-name="PortalPortlet"/>
        <alias-all entity-alias="PPGPTLT"/>
        <alias-all entity-alias="PTLT"/>
        <view-link entity-alias="PPGPTLT" rel-entity-alias="PTLT">
            <key-map field-name="portalPortletId"/>
        </view-link>
    </view-entity>
    <entity entity-name="PortletAttribute" package-name="org.apache.ofbiz.common.portal" title="Allows to set different attribute values for each instance of the same portlet">
        <field name="portalPageId" type="id"></field>
        <field name="portalPortletId" type="id"></field>
        <field name="portletSeqId" type="id"></field>
        <field name="attrName" type="id-long"></field>
        <field name="attrValue" type="value"></field>
        <field name="attrDescription" type="description"></field>
        <field name="attrType" type="value"></field>
        <prim-key field="portalPageId"/>
        <prim-key field="portalPortletId"/>
        <prim-key field="portletSeqId"/>
        <prim-key field="attrName"/>
        <relation type="one" fk-name="PTLT_ATTR_PTLT" rel-entity-name="PortalPortlet">
            <key-map field-name="portalPortletId"/>
        </relation>
    </entity>

    <view-entity entity-name="PortalPageAndPortlet" package-name="org.apache.ofbiz.common.portal" title="View entity to have all Portal and Portlet information">
        <member-entity entity-alias="PP" entity-name="PortalPage"/>
        <member-entity entity-alias="PPP" entity-name="PortalPagePortlet"/>
        <alias-all entity-alias="PP"/>
        <alias-all entity-alias="PPP">
            <exclude field="sequenceNum"/>
        </alias-all>
        <alias field="sequenceNum" entity-alias="PPP" name="portletSequenceNum"/>
        <view-link entity-alias="PP" rel-entity-alias="PPP">
            <key-map field-name="portalPageId"/>
        </view-link>
    </view-entity>

    <!-- ============================ -->
    <!-- org.apache.ofbiz.common.property -->
    <!-- ============================ -->
    
    <entity entity-name="SystemProperty" package-name="org.apache.ofbiz.common.property" title="Defines a System Property">
        <field name="systemResourceId" type="id-long"></field>
        <field name="systemPropertyId" type="id-long"></field>
        <field name="systemPropertyValue" type="value"></field>
        <field name="description" type="description"></field>
        <prim-key field="systemResourceId"/>
        <prim-key field="systemPropertyId"/>
    </entity>
</entitymodel>
