Chapter 1. Document Types

Table of Contents

1. Document Type Definition
2. Document Properties
3. Attributes
4. Mask
5. Structured attribute
5.1. StructuredAttribute
5.2. AttributeSets
5.3. AttributeSet
6. Example
7. cmserver2.xml (obsolete)
7.1. Template
7.2. Attribute
7.3. ClassAttribute
7.4. Mask

This chapter describe format of Document Type Definition File. There have to be definiton of all available document types. This file is usually called cmserver3.xml and is processed by the client application (Tahiti) or as interchange format between various systems. File is typically generated on the server side from the database.

Document Types are defined as tree structure. This allows to define common attributes on the higher levels and make specialization of each document type. Document is instance of the Document Type.

1. Document Type Definition

All document types have common predecessor called 'DocumentType.Root'. This is abstract type without any attributes. Document types are organized in the tree with root 'DocumentType.Root'.

Every document has set of attributes, structured attributes and properties. Property has assigned fixed value at the Document Type. This value cannot be changed in the document as is read-only. Attribute is opposite. Attribute is only defined at the template and real value is assigned in the document. Structured attribute has assigned fixed value containing encoded values of external system's attributes.

Following example defines one abstract document type called AbstractReport. There is one attribute ReportNumber - this means each report have to have assigned report number. There is StructuredAttribute named externalSystems containig attributes from external systems EXT1 and EXT2. AbstractReport is abstract document type because of property canCreate. ProjectReport is definition of other document type - document can be created as instance of this document type.

Example 1.1. Simple Document Type Definition

<?xml version="1.0"?>
<Documents>
  <Document type="AbstractReport" inherit="DocumentType.Root">
    <Property name="canCreate">N</Property>
    <Attribute name="ReportNumber">
      <Property name="name">Number</Property>
      <Property name="mandatory">Y</Property>
      <Property name="size">10</Property>
    </Attribute>
    <StructuredAttribute name="externalSystems" transformer="external_persister">
      <AttributeSets>      
        <AttributeSet name="EXT1">           
           <Attribute name="ext1.attribute1">
               <Property name="property1">Value of property 1</Property>
           </Attribute>
        </AttributeSet>
      </AttributeSets>
      <AttributeSets>      
        <AttributeSet name="EXT2">           
           <Attribute name="ext2.attribute1">
               <Property name="property1">Value of property 1</Property>
           </Attribute>
        </AttributeSet>
      </AttributeSets>
    </StructuredAttribute>
  </Document>
  <Document type="ProjectReport" inherit="AbstractReport">
    <Property name="canCreate">Y</Property>
    <Property name="name">Project Report</Property>
  </Document>
</Documents>

Document type is defined at the tag Document.

Table 1.1. Tag Document

AttributeMandatoryDescription
typeYName of document type.
inheritYPredecessor.



2. Document Properties

Properties can be defined in the template and can be redefined at any ancestor. There is list of system properties.

canCreate

Y - User can create document based on this template

N - User cannot create document based in this template

name

User visible document name.

Description

Detail description of document template

It is possible to define more context properties. Some of context defined properties:

Area

Area of document usage, e.g. Accounting

PluralName

Plural name of document. Usually used by workflow.

3. Attributes

Attribute is changeable value associated with the document. Attribute is defined as set or properties, e.g. name, size, position. There is defined attribute ReportNumber in the example above.

Attribute is defined in the tag called <Attribute> and have to have assigned unique name (within the scope of one document type). This is used a symbolic name of the attribute.

Table 1.2. Attribute Properties

NameMandatoryDescription
positionYnumber, position of attribute - used to order attributes
nameYuser visible name of attribute, this is not used as symbolic name
mandatoryYdefine if attribute is mandatory, cannot be empty (Y|N)
maskNmask used for attribute validation
sizeNmaximal length of the value, if not set or zero it is unlimited
multilineNflag if attribute is multiline (Y|N)
statusN

status of the attribute (N|H|R), default is N

  • N - normal attribute, can be editted

  • R - readonly attribute, visible attribute, cannot be changed

  • H - hidden attribute, cannot be changed and is not visible


4. Mask

Attribute mask is used for value checking. Mask is constructed from characters with defined behavior.

Table 1.3. Mask of Attributes

CharacterPositionDescription
canywheresome character have to be on the position
#anywheresome character have to be on the position
Canywheresome character have to be on the position, character is transformed to the upper letter
9anywherenumber have to be on the position
*at the endany characters from the position
!at the endany characters from the position, letters are transformed to the upper letters
@at the endletters from English alphabet, a-z, A-Z
~at the endnumbers and letters from English alphabet, 0-9, A-Z

Mask examples:

  • 9999 - used for year checking, valid values are for example 1977, 2000 etc.

  • CC9999 - mask used for car id checking in some countries, example of valid entry: TP4560

  • cccccc* - mask used for string entering with minimal length 6 characters

5. Structured attribute

Structured attribute is readonly storage for presenting sets of attributes from external systems. There can be stored attributes from many external systems in one structured attribute. Attributes are grouped to attribute sets by their relationship to external system.

5.1. StructuredAttribute

Structured attribute is defined in tag called <StructuredAttribute>and have to have assigned unique name and transformer. Transformer is component responsible for extracting values of attributes from structured attribute. Format of attribute encoding is transformer dependent and it is not part of this specification. All values of attributes are encoded into this attribute's value.

Table 1.4. StructuredAttribute properties

namedescription
namename of attribute
transformername of attribute transformer responsible for attribute deserialization

5.2. AttributeSets

Tag <AttributeSets> is wrapper for <AttributeSet>. AttributeSets has to contain at least one AttributeSet.

5.3. AttributeSet

Tag <AttributeSet> contain definition of attributes for one concrete external system. Every attribute set is referenced by it's name. AttributeSet contain definition of Attributes as described in Section 3, “Attributes”. AttributeSet has to contain definition of atleast one attribute.

Table 1.5. AttributeSet properties

namedescription
namename of external system (unique within the scope of attribute sets of one document type)

6. Example

This is real example of file format definitions for accounting system. There are several abstract document types.

Example 1.2. Document Types for Accounting System

<?xml version="1.0"?>
<Documents>
<Document type="AbstractDocumentWithId" inherit="DocumentType.Root">
 <Attribute name="FileNumber">
  <Property name="size">10</Property>
  <Property name="mask">#</Property>
  <Property name="position">1</Property>
  <Property name="mandatory">Y</Property>
  <Property name="multiline">N</Property>
  <Property name="name">Number</Property>
 </Attribute>
 <Property name="canCreate">N</Property>
</Document>
<Document type="AbstractDocumentWithYear" inherit="AbstractDocumentWithId">
 <Attribute name="BusinessYear">
  <Property name="size">4</Property>
  <Property name="mask">9999</Property>
  <Property name="position">2</Property>
  <Property name="mandatory">Y</Property>
  <Property name="multiline">N</Property>
  <Property name="name">Year</Property>
 </Attribute>
 <Property name="canCreate">N</Property>
</Document>
<Document type="AbstractDocumentWithIdDescr" inherit="AbstractDocumentWithId">
 <Attribute name="Note">
  <Property name="size">40</Property>
  <Property name="mask">*</Property>
  <Property name="position">9</Property>
  <Property name="mandatory">Y</Property>
  <Property name="multiline">N</Property>
  <Property name="name">Description</Property>
 </Attribute>
 <Property name="canCreate">N</Property>
</Document>
<Document type="AbstractDocumentWithPeriod" inherit="AbstractDocumentWithYear">
 <Attribute name="Period">
  <Property name="size">2</Property>
  <Property name="mask">09</Property>
  <Property name="position">3</Property>
  <Property name="mandatory">Y</Property>
  <Property name="multiline">N</Property>
  <Property name="name">Period</Property>
 </Attribute>
 <Property name="canCreate">N</Property>
</Document>
<Document type="AbstractEmptyDocumentWithoutAttributes" inherit="DocumentType.Root">
 <Property name="canCreate">N</Property>
</Document>
<Document type="BaseDocument" inherit="AbstractDocumentWithId">
 <Property name="canCreate">Y</Property>
 <Property name="name">Base Document</Property>
 <Property name="PluralName">Base Documents</Property>
 <Property name="Description">Company base documents</Property>
 <Property name="Area">Base Documents</Property>
</Document>
<Document type="BookKeeping_II" inherit="AbstractDocumentWithPeriod">
 <Property name="canCreate">Y</Property>
 <Property name="name">II - Invoice In</Property>
 <Property name="PluralName">II - Invoices In</Property>
 <Property name="Description">Invoice In, received invoice from supplyer</Property>
 <Property name="Area">Book-keeping</Property>
</Document>
<Document type="BookKeeping_IO" inherit="AbstractDocumentWithPeriod">
 <Property name="canCreate">Y</Property>
 <Property name="name">IO - Invoice Out</Property>
 <Property name="PluralName">IO - Invoices Out</Property>
 <Property name="Description">Invoice Out, issued invoice for goods or services</Property>
 <Property name="Area">Book-keeping</Property>
</Document>
<Document type="BookKeeping_AII" inherit="AbstractDocumentWithPeriod">
 <Property name="canCreate">Y</Property>
 <Property name="name">AII - Advance Invoice In</Property>
 <Property name="PluralName">AII - Advance Invoices In</Property>
 <Property name="Description">Advanced Invoice, used by supplyer to receive advance</Property>
 <Property name="Area">Book-keeping</Property>
</Document>
<Document type="BookKeeping_AIO" inherit="AbstractDocumentWithPeriod">
 <Property name="canCreate">Y</Property>
 <Property name="name">AIO - Advance Invoice Out</Property>
 <Property name="PluralName">AIO - Advance Invoices Out</Property>
 <Property name="Description">Advanced Invoice, can be used to receive advance 
       from custommer for goods or services</Property>
 <Property name="Area">Book-keeping</Property>
</Document>
<Document type="BookKeeping_BA1" inherit="AbstractDocumentWithPeriod">
 <Property name="canCreate">Y</Property>
 <Property name="name">BA1 - Bank Account 1</Property>
 <Property name="PluralName">BA1 - Bank Accounts 1</Property>
 <Property name="Description">Bank account statement, usually received 
       every month or in other period</Property>
 <Property name="Area">Book-keeping</Property>
</Document>
<Document type="BookKeeping_BA2" inherit="AbstractDocumentWithPeriod">
 <Property name="canCreate">Y</Property>
 <Property name="name">BA2 - Bank Account 2</Property>
 <Property name="PluralName">BA2 - Bank Accounts 2</Property>
 <Property name="Description">Bank account statement, usually received every 
       month or in other period</Property>
 <Property name="Area">Book-keeping</Property>
</Document>
<Document type="BookKeeping_LE" inherit="AbstractDocumentWithId">
 <Property name="canCreate">Y</Property>
 <Property name="name">LE - leasing</Property>
 <Property name="PluralName">LE - leasing</Property>
 <Property name="Description">Leasing Agreements and other documents</Property>
 <Property name="Area">Book-keeping</Property>
</Document>
<Document type="BookKeeping_AG" inherit="AbstractDocumentWithId">
 <Property name="canCreate">Y</Property>
 <Property name="name">AG - Agreement</Property>
 <Property name="PluralName">AG - Agreements</Property>
 <Property name="Description">Agreements with supplyers, customers and
      other bussiness partners</Property>
 <Property name="Area">Book-keeping</Property>
</Document>
<Document type="BookKeeping_CS" inherit="AbstractDocumentWithPeriod">
 <Property name="canCreate">Y</Property>
 <Property name="name">CS - Cash</Property>
 <Property name="PluralName">CS - Cash</Property>
 <Property name="Description">Cache receipt and statements</Property>
 <Property name="Area">Book-keeping</Property>
</Document>
<Document type="BookKeeping_CIR" inherit="AbstractDocumentWithPeriod">
 <Property name="canCreate">Y</Property>
 <Property name="name">CIR - Cash In Receipt</Property>
 <Property name="PluralName">CIR - Cash In Receipts</Property>
 <Property name="Description">Cash In Receipt</Property>
 <Property name="Area">Book-keeping</Property>
</Document>
<Document type="BookKeeping_COR" inherit="AbstractDocumentWithPeriod">
 <Property name="canCreate">Y</Property>
 <Property name="name">CIR - Cash Out Receipt</Property>
 <Property name="PluralName">CIR - Cash Out Receipts</Property>
 <Property name="Description">Cash Out Receipt</Property>
 <Property name="Area">Book-keeping</Property>
</Document>
<Document type="BookKeeping_CC" inherit="AbstractDocumentWithPeriod">
 <Property name="canCreate">Y</Property>
 <Property name="name">CC - credit card</Property>
 <Property name="PluralName">CC - credit cards</Property>
 <Property name="Description">Credit card operation</Property>
 <Property name="Area">Book-keeping</Property>
</Document>
<Document type="BookKeeping_Reports" inherit="AbstractDocumentWithPeriod">
 <Property name="canCreate">Y</Property>
 <Property name="name">Report</Property>
 <Property name="PluralName">Reports</Property>
 <Property name="Description">Summary reports</Property>
 <Property name="Area">Book-keeping</Property>
</Document>
<Document type="BookKeeping_Statements" inherit="AbstractDocumentWithYear">
 <Property name="canCreate">Y</Property>
 <Property name="name">Statement of Finances</Property>
 <Property name="PluralName">Statements of Finances</Property>
 <Property name="Description">Statements of Finances</Property>
 <Property name="Area">Book-keeping</Property></Document>
<Document type="BookKeeping_TaxDeclaration" inherit="AbstractDocumentWithYear">
 <Property name="canCreate">Y</Property>
 <Property name="name">Declaration of Taxes</Property>
 <Property name="PluralName">Declarations of Taxes</Property>
 <Property name="Description">Declarations of Taxes</Property>
 <Property name="Area">Book-keeping</Property>
</Document>
<Document type="BookKeeping_Compensation" inherit="AbstractDocumentWithPeriod">
 <Property name="canCreate">Y</Property>
 <Property name="name">CO - Compensation</Property>
 <Property name="PluralName">CO - Compensations</Property>
 <Property name="Description">Compensations</Property>
 <Property name="Area">Book-keeping</Property>
</Document>
<Document type="OtherDocument" inherit="AbstractDocumentWithIdDescr">
 <Property name="canCreate">Y</Property>
 <Property name="name">Other</Property>
 <Property name="PluralName">Others</Property>
 <Property name="Description">Other documents</Property>
 <Property name="Area">Others</Property>
</Document>
</Documents>


7. cmserver2.xml (obsolete)

cmserver2.xml is acronym for file with document types definitions. File contain list of document types.

Note

Newer systems should use cmserver3.xml instead of this format. cmserver2.xml is obsolete.

Example 1.3. Example of cmserver2.xml

<?xml version="1.0" encoding="utf-8"?>
<Templates>
 <Template id="BOOK_KEEPING__SOURCE_SHEET__II" 
      name="II - Invoices In" 
      canCreate="Y">
  <Description>Invoice In, received invoice 
      from supplyer</Description>
  <Attributes>
   <Attribute id="FILE_NUMBER" name="Number" size="10" 
        position="1" mandatory="Y" mask="#"/>
   <Attribute id="BUSINESS_YEAR" name="Year" size="4"
        position="2" mandatory="Y" mask="9999"/>
   <Attribute id="PERIOD" name="Period" size="2" 
        position="3" mandatory="Y" mask="09"/>
   <ClassAttribute id="BOOK_KEEPING__AREA" 
        value="Book-keeping"/>
  </Attributes>
 </Template>
 <Template id="BOOK_KEEPING__SOURCE_SHEET__IO" 
      name="IO - Invoices Out" canCreate="Y">
  <Description>Invoice Out, issued invoice for 
      goods or services</Description>
  <Attributes>
   <Attribute id="FILE_NUMBER" name="Number" size="10" 
        position="1" mandatory="Y" mask="#"/>
   <Attribute id="BUSINESS_YEAR" name="Year" size="4" 
        position="2" mandatory="Y" mask="9999"/>
   <Attribute id="PERIOD" name="Period" size="2" 
        position="3" mandatory="Y" mask="09"/>
   <ClassAttribute id="BOOK_KEEPING__AREA" 
        value="Book-keeping"/>
  </Attributes>
 </Template>
</Templates>

File is XML file. Root tag has name <Templates>. Template definition is placed in the tag <Template>. File contain list of template definitions. Relation between templates can be established using class attributes.

7.1. Template

Tag Template contains one template definition.

Table 1.6. Template attributes

AttributeRequiredDescription

id

yes

string with template identification, unique id

name

yes

string with template name, this name is displayed to the users

canCreate

no

one of value - Y|N, default value is Y.

  • Y - document can be created

  • N - document can not be created


Document template can have description inside tag <Description>. It should describe template purpose, how and when to create documents of this type. Information is displayed in the document type selection dialog.

Attributes are defined inside tag <Attributes>. Tag contain list of attributes defined for parent document type. Document can have several document or class attributes.

7.2. Attribute

Document template can have several attributes. Each attribute have string identifier and name. Name is displayed to the users instead of identifier.

Table 1.7. <Attributes>

AttributeRequiredDescription

id

yes

string with attribute identification

name

yes

string with attribute name, this name is displayed to the users

size

no

maximum identifier length, if not set or zero length is unbound

mask

no

String with attribute mask, mask is check when attribute value change. Mask syntax is described in paragraph bellow.

position

yes

Positive number defining attribute position, it is used to order attributes in the dialog for editing. If position is not defined attribute is not displayed. Each attribute in the template should have unique position.

mandatory

no

one of value - Y|N, default value is N.

  • Y - attribute value is mandatory

  • N - attribute value is not mandatory

statusno

state of attribute, default value is N

  • N - normal attribute

  • R - read-only attribute

  • H - hidden attribute


Attributes with same id value are treated as same attributes when document is displayed in the tree. Attribute naming in the document management system is important for document display, creating simple and clear document hierarchy.

7.3. ClassAttribute

Template class attribute is read only value which has same value for all instances of the template. ClassAttribute can be used for document classification.

Table 1.8. <ClassAttribute>

AttributeRequiredDescription

id

yes

string with attribute identification

value

yes

attribute value


7.4. Mask

Attribute mask is used for value checking. Mask is constructed from characters with defined behavior.

Table 1.9. Mask characters

CharacterPositionDescription

c

anywhere

some character have to be on the position

#

anywhere

some character have to be on the position

C

anywhere

some character have to be on the position, character is transformed to the upper letter

9

anywhere

number have to be on the position

*

at the end

any characters from the position

!

at the end

any characters from the position, letters are transformed to the upper letters

@

at the end

letters from English alphabet, a-z, A-Z

~

at the end

numbers and letters from English alphabet, 0-9, A-Z


Mask examples

  • 9999 - used for year checking, valid values are for example 1977, 2000 etc.

  • CC9999 - mask used for car id checking in some countries, example of valid entry: TP4560

  • cccccc* - mask used for string entering with minimal length 6 characters

Mask checking algorithm is described in the appendix.