<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE fieldtypemodel PUBLIC "-//OFBiz//DTD Field Type Model//EN" "http://www.ofbiz.org/dtds/fieldtypemodel.dtd">

<!--
/**
 *  Title: Entity Generator Definitions for the General Data Model
 *  Description: None
 *  Copyright (c) 2002 The Open For Business Project - www.ofbiz.org
 *
 *  Permission is hereby granted, free of charge, to any person obtaining a
 *  copy of this software and associated documentation files (the "Software"),
 *  to deal in the Software without restriction, including without limitation
 *  the rights to use, copy, modify, merge, publish, distribute, sublicense,
 *  and/or sell copies of the Software, and to permit persons to whom the
 *  Software is furnished to do so, subject to the following conditions:
 *
 *  The above copyright notice and this permission notice shall be included
 *  in all copies or substantial portions of the Software.
 *
 *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 *  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 *  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 *  CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
 *  OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
 *  THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 *
 *@author     Mateu Batle
 *@created    December 11, 2002
 *@version    1.0
 */

 Updated to run with Firebird 1.5.2 (22 Apr 2005)
-->

<fieldtypemodel>
    <!-- ===================== field-type-def ==================== -->
    <!-- General Types -->
    <field-type-def type="blob" sql-type="BLOB SUB_TYPE 0" java-type="java.lang.Object"></field-type-def>

    <field-type-def type="date-time" sql-type="TIMESTAMP" java-type="java.sql.Timestamp"></field-type-def>
    <field-type-def type="date" sql-type="DATE" java-type="java.sql.Date"></field-type-def>
    <field-type-def type="time" sql-type="TIME" java-type="java.sql.Time"></field-type-def>

    <field-type-def type="currency-amount" sql-type="NUMERIC(18,2)" java-type="Double">
        <validate name="isSignedDouble"/>
    </field-type-def>
    <field-type-def type="floating-point" sql-type="FLOAT" java-type="Double">
        <validate name="isSignedDouble"/>
    </field-type-def>
    <field-type-def type="numeric" sql-type="NUMERIC(18,0)" java-type="Long">
        <validate name="isSignedLong"/>
    </field-type-def>

    <field-type-def type="id" sql-type="VARCHAR(20)" java-type="String"></field-type-def>
    <field-type-def type="id-long" sql-type="VARCHAR(60)" java-type="String"></field-type-def>
    <field-type-def type="id-vlong" sql-type="VARCHAR(255)" java-type="String"></field-type-def>
    <!-- Need to define 'integer' for Firebird -->
    <field-type-def type="integer" sql-type="INTEGER" java-type="Integer"></field-type-def>

    <field-type-def type="indicator" sql-type="CHAR(1)" java-type="String"></field-type-def>
    <field-type-def type="very-short" sql-type="VARCHAR(10)" java-type="String"></field-type-def>
    <!-- Firebird restricts the primary key to be less than 250 in size - hence must reduce the VARCHAR to 56 in order to respect this contstraint -->
    <field-type-def type="short-varchar" sql-type="VARCHAR(56)" java-type="String"></field-type-def>
    <!-- Firebird has an internal PK size limit which means VARCHARs used as PKs can't be over 250.  See JRA- http://www.volny.cz/iprenosil/interbase/ip_ib_indexcalculator.htm -->
    <field-type-def type="long-varchar" sql-type="VARCHAR(250)" java-type="String"></field-type-def>
    <!-- Firebird expects 'BLOB SUB_TYPE 1' instead of 'BLOB SUB_TYPE TEXT' -->
    <field-type-def type="very-long" sql-type="BLOB SUB_TYPE 1" java-type="String"></field-type-def>
    <field-type-def type="extremely-long" sql-type="BLOB SUB_TYPE 1" java-type="String"></field-type-def>

    <field-type-def type="comment" sql-type="VARCHAR(255)" java-type="String"></field-type-def>
    <field-type-def type="description" sql-type="VARCHAR(255)" java-type="String"></field-type-def>
    <field-type-def type="name" sql-type="VARCHAR(60)" java-type="String"></field-type-def>
    <field-type-def type="value" sql-type="VARCHAR(255)" java-type="String"></field-type-def>

    <!-- Specialized Types -->
    <field-type-def type="credit-card-number" sql-type="VARCHAR(40)" java-type="String">
        <validate name="isAnyCard"/>
    </field-type-def>
    <field-type-def type="credit-card-date" sql-type="VARCHAR(20)" java-type="String">
        <validate name="isDateAfterToday"/>
    </field-type-def>
    <field-type-def type="email" sql-type="VARCHAR(255)" java-type="String">
        <validate name="isEmail"/>
    </field-type-def>
    <field-type-def type="url" sql-type="VARCHAR(255)" java-type="String"></field-type-def>
    <field-type-def type="id-ne" sql-type="VARCHAR(20)" java-type="String">
        <validate name="isNotEmpty"/>
    </field-type-def>
    <field-type-def type="id-long-ne" sql-type="VARCHAR(60)" java-type="String">
        <validate name="isNotEmpty"/>
    </field-type-def>
    <field-type-def type="id-vlong-ne" sql-type="VARCHAR(255)" java-type="String">
        <validate name="isNotEmpty"/>
    </field-type-def>
    <field-type-def type="tel-number" sql-type="VARCHAR(60)" java-type="String">
        <validate name="isInternationalPhoneNumber"/>
    </field-type-def>

</fieldtypemodel>

