2017 June Release

Defining an object classPermanent link for this heading

An object class defines the abstract characteristics of an object, which include properties and the use cases that can be executed on the instances of the object class.

Syntax

class<metaclass> reference : baseclass {
  ...
}

Selecting the meta classPermanent link for this heading

In Fabasoft Folio, each object class is an instance of a meta class that defines the characteristics of the object class itself.

The meta class is specified in angle brackets following the class keyword. The definition of the meta class is optional. When omitted, COOSYSTEM@1.1:ObjectClass is used as the meta class of the object class.

Usually, you will use one of the following meta classes for defining a new object class:

  • The COOSYSTEM@1.1:ContentObjectClass meta class is specifically designed for object classes containing content properties or compound properties of type COOSYSTEM@1.1:Content. For defining an object class that is an instance of COOSYSTEM@1.1:ContentObjectClass, the class keyword must be followed by <COOSYSTEM@1.1:ContentObjectClass>. Full qualification of the reference is only required if COOSYSTEM@1.1 is not imported using the import keyword.
  • The COOSYSTEM@1.1:ObjectClass meta class should be used for object classes that do not contain object lists or content properties. The class keyword is used for defining an instance of COOSYSTEM@1.1:ObjectClass. <COOSYSTEM@1.1:ObjectClass> may be omitted as it is the default meta class.

If you want to use a different meta class, you can specify the reference of the meta class in the angle brackets following the class keyword.

Defining the base classPermanent link for this heading

Each object class in Fabasoft Folio must have a base class which must either directly or indirectly be derived from object class COOSYSTEM@1.1:Object. This object class is the base class of all other object classes.

The base class is specified after a colon following the reference of the newly defined object class.

If you do not find a more specific base class that is appropriate for your new class, you will usually derive it from one of the following most common base classes:

  • COOSYSTEM@1.1:ContentObject for object classes that are intended for storing content. These object classes usually have COOSYSTEM@1.1:ContentObjectClass as their meta class.
  • COOSYSTEM@1.1:CompoundObject for object classes that are intended for storing object lists.
  • COOSYSTEM@1.1:ComponentObject for object classes where the instances must be shipped with a software component.
  • COOSYSTEM@1.1:BasicObject for other object classes when you do not find a more appropriate base class.
  • Cloud profile note: Base classes are restricted to COOSYSTEM@1.1:ContentObject, COOSYSTEM@1.1:CompoundObject, COOSYSTEM@1.1:BasicObject and classes marked as derivable from own and friend components.

Example

objmodel APPDUCXSAMPLE@200.200
{
  import COOSYSTEM@1.1;

  // New object class for storing resources that is derived from
  // COOSYSTEM@1.1:BasicObject

  class Resource : BasicObject {
    ...
  }

  // New object class for specification documents that is derived from
  // COOSYSTEM@1.1:ContentObject

  class<ContentObjectClass> SpecificationDocument : ContentObject {
    ...
  }

  // New object class for projects that is derived from
  // COOSYSTEM@1.1:CompoundObject

  class Project : CompoundObject {
    ...
  }
}

Defining miscellaneous object class aspectsPermanent link for this heading

Besides choosing the meta class and the base class, you can also define several other aspects of the object class, such as whether it should be abstract, programmatic, common, deriveable or compound.

Setting an object class to abstractPermanent link for this heading

The abstract keyword allows you to define an abstract object class.

An abstract object class can only be used as a base class from which child object classes may be derived, and which cannot be instantiated itself.

Example

objmodel APPDUCXSAMPLE@200.200
{
  import COOSYSTEM@1.1;

  class Vehicle : BasicObject {
    abstract = true;
  }

  class Car : Vehicle {
  }
}

Setting an object class to programmaticPermanent link for this heading

Using the programmatic keyword, an object class can be marked as not creatable by a user via the user interface. Thus, for example, the object class is not available in the “Object” > “New” dialog but objects of the object class can be created programmatically.

Example

objmodel APPDUCXSAMPLE@200.200
{
  import COOSYSTEM@1.1;

  class Order : BasicObject {
    programmatic = true;
  }
}

Marking an object class as compoundPermanent link for this heading

Using the compound keyword, an object class can be marked as compound. Only the instances of a compound object class are displayed in the tree view on the left-hand side of the Fabasoft Folio Web Client.

Example

objmodel APPDUCXSAMPLE@200.200
{
  import COOSYSTEM@1.1;

  class Product : CompoundObject {
    compound = true;
  }
}

Marking an object class as a common classPermanent link for this heading

Using the common keyword, an object class can be marked as a common class. This means that this class is creatable or usable in common locations like in a folder (i.e. in the COOSYSTEM@1.1:objchildren property). Using the allowcommonclasses keyword with a property can be marked as a property for containing common classes.

Example

objmodel APPDUCXSAMPLE@200.200
{
  import COOSYSTEM@1.1;

  class Product : CompoundObject {
    common = true;
  }
}

Marking an object class as derivablePermanent link for this heading

Using the derivable keyword, an object class can be marked as derivable. This means that classes from other software components can use this class as base class.

Example

objmodel APPDUCXSAMPLE@200.200
{
  import COOSYSTEM@1.1;

  class Product : CompoundObject {
    derivable = true;
  }
}