Object Definition Syntax

This article contains the following topics:
casm173
This article contains the following topics:
Many of the components of CA SDM consist of business objects. These objects are defined in a metalanguage named Majic. You can use Majic statements to create new objects and modify existing objects, thus customizing these objects to meet your needs.
Directories
The Majic files are organized in two directories:
Directory
Description
bopcfg/majic (UNIX) or bopcfg\majic (Windows)
Contains the .maj files that have been used to create windows defined in the database. These files should not be changed because changes will be overwritten by new releases of CA SDM.
site/mods/majic (UNIX) or site\mods\majic (Windows)
Contains the .mod files you use to customize windows.
Types of Statements
The following Majic statements are used in screen painter and database customization procedures.
Statement
Description
OBJECT
Defines a business object
MODIFY
Changes existing object attributes
MODIFY FACTORY
Changes existing factories
MODIFY Statement
Changes the way attributes are defined on OBJECT statements. MODIFY statements are read after OBJECT statements.
Syntax
MODIFY obj_name att_name [status_type;] [ON_NEW DEFAULT|SET value|NOW ;]| [ON_CI DEFAULT|SET value|NOW ;]| [ON_DB_INIT DEFAULT|SET value|NOW ;]
Arguments
  • obj_name
    Identifies the object whose attribute is being modified.
  • att_name
    Identifies the attribute being modified.
  • status_type
    Modifies the properties of the attribute to allow or prohibit null values. There are two valid options for this keyword:
    • REQUIRED
      Indicates that the attribute is required.
    • NOT_REQUIRED
      Indicates that the attribute is not required.
  • ON Statements
    See ON Statements for a description of these statements.
Example
The following example changes the salary attribute in the emp object so that it is now a required attribute:
MODIFY emp salary REQUIRED;
Example
The following example changes the address2 attribute in the emp object so that is now not required.
MODIFY emp address2 NOT_REQUIRED;
MODIFY FACTORY Statement
Changes the way factories are defined on OBJECT statements. MODIFY statements are read after OBJECT statements.
Syntax
MODIFY FACTORY fac_name { [FUNCTION_GROUP name ;] [DISPLAY_NAME name ;] [STANDARD_LISTS { [SORT_BY index_att ;] [FETCH fetch_att ;] [WHERE string ;] [MLIST ON|OFF;] [RLIST ON|OFF;] } ;] };
Arguments
  • fac_name
    Identifies the factory, if included on the original OBJECT statement.
Optional Statements
At least one of these optional statements must be specified.
  • FUNCTION_GROUP
    name
    Indicates which security access groups are permitted to access the object. For example:
    FUNCTION_GROUP "admin" ;
  • DISPLAY_NAME name
    Defines an external name for the table.
    DISPLAY_NAME "Call Request" ;
  • STANDARD_LISTS
    Creates lists of objects that are kept in a cache. The parameters determine whether the lists are master lists or restricted lists, whether the objects included in the list must meet specified conditions, and how the lists can be sorted. Refer STANDARD_LISTS Optional Statements for a description of the syntax.
OBJECT Statement
Defines a business object.
Syntax
OBJECT obj_name { [ATTRIBUTES [table_name]{ att_name [field_name] value_type [access_type[status_type]] [DISPLAY_NAME string][{ [ON_NEW DEFAULT|SET value|NOW ;] [ON_CI DEFAULT|SET value|NOW ;] [ON_DB_INIT DEFAULT|SET value|NOW ;]} ;]};] [FACTORY [fac_name]{ [REL_ATTR name ;] [COMMON_NAME name ;] [DISPLAY_NAME name ;] [FUNCTION_GROUP name ;] [STANDARD_LISTS { [SORT_BY index_att ;] [FETCH fetch_att ;] [WHERE string ;] [MLIST ON|OFF;] [RLIST ON|OFF;] } ;]};] };
Arguments
  • obj_name
    The object’s name (for example, cnt for contact or cr for request).
Optional Statements
Either ATTRIBUTES or FACTORY must be specified. Both can be specified.
  • ATTRIBUTES [
    table_name
    ] { }
    Defines the properties of the object. Most attributes map to a field (column) in a database table. The ATTRIBUTES Optional Statement describes its syntax.
  • FACTORY [
    fac_name
    ] { }
    Defines access to the object, like its relation attribute, a common name, the security group that can access it, the type of lists produced, and how those lists can be sorted. The FACTORY Optional Statement describes its syntax.
Example
This example defines an object named ctp. The ATTRIBUTES statement defines attributes named sym, delete_flag, and description whose values are stored in the Contact_Type table in the database. The FACTORY statement creates a master list of objects, sorted by values in the field that corresponds to the sym attribute, and specifies that the id attribute will represent ctp when it is referenced by an SREL:
OBJECT ctp { ATTRIBUTES Contact_Type { sym STRING REQUIRED ; delete_flag del INTEGER { ON_NEW DEFAULT 0 ; } ; description desc STRING ; } ; FACTORY { STANDARD_LISTS {SORT_BY "sym"} ; REL_ATTR id ; }; };