Versions Compared

Key

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

...

In the below section the type definition format is described. 

Code Block
languagetextxml
titleType Definition Spec
{
  "@type" : "JSON_Document" | Fully qualified className,  <-- The name of the object type being defined
  "@typeId" : ,  <-- A numberic field which would uniquely identify the type
  "fields":[   <-- A collection of fields
    {
      "fieldName" :  ,  <-- The name of the field
      "dataType" : "String" | "Integer" | "Double" | "Date" | "Float" | "Boolean" | "Long" | Object (default),  <-- The data type of the field (Not required when using @refTypeId)
	  "format" : "MM/dd/yyyy hh:mm:ss:SSS " | "#0.00" <-- Optional field to provide a format when dealing with dates of doubles	
      "@refTypeId" : ,  <-- The reference to an already defined type
    },
    {
      "fieldName" :  ,  <-- The name of the field
      "dataType" : "List",  <-- Indicates data type is a list/array
      "@refTypeId" : ,  <-- Numeric reference to an already defined type, which will be populated in the list
    },
    {
      "fieldName": , <-- The name of the field
      "dataType": "List", <-- Indicates data type is a list/array
      "subType": "String" | "Integer" | "Double" | "Date" | "Float" | "Boolean" | "Long" | Object (default) <-- The data type of the elements of a List
      "format": "MM/dd/yyyy hh:mm:ss:SSS " | "#0.00" <-- Optional field to provide a format when dealing with dates of doubles
    }
}
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="typeDefinitons" type="typeDefinitonsType"/>
  <xs:complexType name="entryType">
    <xs:simpleContent>
      <xs:extension base="xs:string">
        <xs:attribute type="xs:long" name="refTypeId" use="optional"/>
        <xs:attribute type="xs:string" name="type" use="optional"/>
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>
  <xs:complexType name="valueType">
    <xs:simpleContent>
      <xs:extension base="xs:string">
        <xs:attribute type="xs:string" name="type" use="optional"/>
        <xs:attribute type="xs:string" name="name" use="optional"/>
        <xs:attribute type="xs:long" name="refTypeId" use="optional"/>
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>
  <xs:complexType name="typeDefinitonsType">
    <xs:sequence>
      <xs:element type="typeDefinitionType" name="typeDefinition" maxOccurs="unbounded" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="typeDefinitionType">
    <xs:sequence>
      <xs:element type="fieldsType" name="fields"/>
    </xs:sequence>
    <xs:attribute type="xs:string" name="type" use="optional"/>
    <xs:attribute type="xs:long" name="refTypeId" use="optional"/>
  </xs:complexType>
  <xs:complexType name="keyType">
    <xs:simpleContent>
      <xs:extension base="xs:string">
        <xs:attribute type="xs:string" name="type" use="optional"/>
        <xs:attribute type="xs:string" name="name" use="optional"/>
        <xs:attribute type="xs:long" name="refTypeId" use="optional"/>
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>
  <xs:complexType name="fieldType">
    <xs:sequence>
      <xs:element name="name">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:enumeration value="primitiveTypeField"/>
            <xs:enumeration value="existingTypeField"/>
            <xs:enumeration value="mapTypeField"/>
            <xs:enumeration value="listTypeField"/>
            <xs:enumeration value="formattedDateTypeField"/>
            <xs:enumeration value="formattedDecimalTypeField"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element type="keyType" name="key" minOccurs="0"/>
      <xs:element type="valueType" name="value" minOccurs="0"/>
      <xs:element type="entryType" name="entry" minOccurs="0"/>
      <xs:element name="formattingString" minOccurs="0">
        <xs:simpleType>
          <xs:restriction base="xs:string"/>
        </xs:simpleType>
      </xs:element>
    </xs:sequence>
    <xs:attribute type="xs:string" name="type" use="optional"/>
    <xs:attribute type="xs:long" name="refTypeId" use="optional"/>
  </xs:complexType>
  <xs:complexType name="fieldsType">
    <xs:sequence>
      <xs:element type="fieldType" name="field" maxOccurs="unbounded" minOccurs="0">
        <xs:annotation>
          <xs:documentation>A formatted double | float field definition</xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
</xs:schema>

 

In the below example it shows how to define the type definition for a domain object.

...