interface Command

An interface is a group of attributes that can be added to business objects as well as connections to provide additional classification capabilities. When an Interface is created, it is linked to (previously-defined) attributes that logically go together. Interfaces are added to business object or relationship instances.

An Interface can be derived from other Interfaces, similar to how Types can be derived. Derived Interfaces include the attributes of their parents, as well as any other attributes associated with it directly. The types or relationships associated with the parents are also associated with the child.

The primary reason to add an interface to a business object or a connection is to add the attributes to the instance that were not defined on the type.

For conceptual information on this command, see MQL Concepts: Interfaces.

This page discusses:

User Level

Business Administrator

Add Interface

Add Interface

An object interface is created with the Add Interface command:

add interface NAME [ADD_ITEM {ADD_ITEM}];
  • ADD_ITEM provides additional information about the interface:
    description VALUE
    icon FILENAME
    attribute NAME{,NAME}
    derived INTERFACE_NAME{,INTERFACE_NAME}
    abstract [true|false]
    type all | TYPE_NAME{,TYPE_NAME}
    relationship all | REL_NAME{,REL_NAME}
    pathtype PATH_NAME{,PATH_NAME}
    [!|not] hidden
    [!|not] resetonclone
    [!|not] resetonrevision
    property NAME [to ADMINTYPE NAME] [value STRING]
    rule RULE_NAME

All these clauses are optional. You can define an interface by simply assigning a name to it. If you do, 3DSpace assumes that the interface is non-abstract, does not contain any explicit attributes, and does not inherit from any other interfaces. If you do not want these default values, add clauses as necessary.

Abstract Clause

Interfaces can inherit properties from other interfaces. Such as the following:

  • Abstract interfaces act as categories for other interfaces.

    Abstract interfaces are not used to add attributes to a business object directly. They are useful only in defining characteristics that are inherited by other interfaces. For example, you could create an abstract interface called “Metal.” Two non-abstract interfaces, “Aluminum” and “Iron”, could inherit from it.

  • Non-abstract interfaces a re used to add groups of attributes to a business object.

    You can add non-abstract interfaces to business objects. For example, assume that Aluminum is a non-abstract interface with its own set of attributes. You can add this interface to objects that are manufactured from aluminum and therefore need this set of attributes.

Use one the following clauses:

abstract true

Or:

abstract false

Abstract interfaces are helpful because you do not have to reenter attributes that are often reused. If an additional field is required, it needs to be added only once. For example, the “Person Record” object interface might include a person’s name, telephone number, home address, and social security number. While it is a commonly used set of attributes, it is unlikely that this information would appear on its own. Therefore, you might want to define this object interface as an abstract interface.

If you want a user to be able to add the defined interface to a business object, set the abstract argument to false. If not, set the abstract argument to true. If you do not use the Abstract clause, false is assumed, allowing users to add instances of the interface to a business object.

For example, in the following definition, you cannot add the interface to a business object:

add interface "Metal"
   derived "Material used to Manufacture"
   abstract true;

Attribute Clause

This clause assigns attributes to the interface. These attributes must be previously defined with the Add Attribute command. (For more information, see Add Attribute Command.) If they are not defined, an error message is displayed.

Adding an attribute to an interface should not be included in a transaction with other extensive operations, especially against a distributed database. This is a “special” administrative edit, in that it needs to update all business objects that use the interface with a default attribute.

An interface can have any combination of attributes associated with it. For example, the following Add Interface command assigns 2 attributes to the Metal interface:

add interface "Metal"
   description "Material used to Manufacture"
   attribute "Metal1"
   attribute "Metal2";

Derived Clause

Use the Derived clause to identify 1 or more existing interfaces as the parent(s) of the interface you are creating. The parent interface(s) can be abstract or non-abstract. A child interface inherits the following items from the parent(s):

  • All attributes
  • All types to which it can be added

Assigning a parent interface is an efficient way to define several object interfaces that are similar because you only have to define the common items for one interface, the parent, instead of defining them for each interface. The child interface inherits all the items listed above from the parent but you can also add attributes directly to the child interface. Similarly, you can (and probably will) add attributes to the child interface that the parent does not have. Any changes you make for the parent are also applied to the child interface.

Because an interface can inherit from multiple interfaces, derived interfaces do NOT inherit their parent’s resetonclone/resetonrevise property as conflicts could happen. The resetonclone/resetonrevise property must be applied on each interface that requires it.

For example, suppose you have an interface named “Manufacturing Process”, which includes 2 attributes: “Process” and “Vendor”. Now you create two new interfaces named “Rolled” and “Molded:”

add interface "Rolled"
   derived "Manufacturing Process";
add interface "Molded"
   derived "Manufacturing Process";

Both new interfaces acquire the attributes in the Manufacturing Process interface. Rather than adding each of these attributes to the new interfaces, you can make Manufacturing Process the parent of the new interfaces. The new interfaces then inherit the 2 attributes as well as the allowed Types from the parent.

Interfaces can have more than 1 parent.

Type Clause

This clause defines all of the business object types that can use the interface. An interface can be allowed for use with any number of types, and likewise, a type can be allowed to use any number of interfaces. The Type clause is required for an interface to be usable:

type all | TYPE_NAME{,TYPE_NAME}
  • all can be used to allow the interface on any business type.
  • TYPE_NAME is a previously defined object type.

You can list one type or many types (separated by a comma or carriage return). When specifying the name of an object type, it must be of a type that already exists in the database. If it is not, an error message will display.

For example, the following command is a valid Add interface command:

add interface "Metal"
      description "Material used to Manufacture"
      type Part,Component;

Relationship Clause

This clause defines the relationships that can use the interface. An interface can be allowed for use with any number of relationships, and likewise, a relationship can be allowed to use any number of interfaces. Specify at least a type or a Relationship for an interface to be usable:

relationship all | REL_NAME{,REL_NAME}

  • all can be used to allow the interface on any relationship that exists in the database.
  • REL_NAME is a previously defined relationship.

You can list one or many relationships (separated by a comma or carriage return). The relationships you specify must already exist in the database. If it is not, an error message will display. For example, the following command is a valid Add interface command:

add interface "Material"
  description "Material used to Manufacture"
  relationship Color,Texture;

Rule Clause

The rule clause allows you to add a rule to the interface for a business object. When evaluating access to a business object, an interface rule on the business object is treated as if it were a rule on the business object’s policy state (or allstate). Rules on interfaces can only be used with business objects.

You can only add a single rule to an interface in addition to any inherited rules. A derived interface inherits any rules defined on the parent interface. Although you can only include a single rule in an interface, you can add multiple interfaces to a business object, each with its own rule.

A trace statement can show whether an interface rule evaluated to true or false for the business object. For this type of trace, you can use this syntax:

trace type access on;

The calculation of primary and secondary ownership vectors for a business object includes any rules added to any interfaces for that business object for the policy state. Adding or removing an interface to a business object triggers a recalculation of the ownership vectors.

When the system adds or removes rules from an interface, or when an interface is removed from business objects that have multiple interfaces, you need to run the transition interfacerulesflag command. For more information, see Transition Interfacerulesflag.

For more information about rules, see rule Command.

ResetOnClone and ResetOnRevision Clauses

These clauses define if the interface and the attributes defined by that interface are set for the new business object when an existing business object is cloned or revised.

resetonclone removes the interface and its attributes from the new object when cloning a business object. resetonrevision removes the interface and its attributes from the new object when revising a business object.

Precede the clause with ! or not to set the interface to copy attribute values to the newly cloned or revised business object.

Copy Interface

After an interface is defined, you can clone the definition with the Copy Interface command. This command lets you duplicate defining clauses with the option to change the value of clause arguments.

copy interface SRC_NAME DST_NAME [MOD_ITEM {MOD_ITEM}];
  • SRC_NAME is the name of the interface definition (source) to copied.
  • DST_NAME is the name of the new definition (destination).
  • MOD_ITEMs are modifications that you can make to the new definition. For more information, see Modify Interface.

Modify Interface

You can change the interface definition with the Modify Interface command. This command lets you add or remove defining clauses and change the value of clause arguments.

modify interface NAME [MOD_ITEM {MOD_ITEM}];
  • NAME is the name of the interface you want to modify.
  • MOD_ITEM is the interface of modification you want to make.

You can make the following modifications. Each is specified in a Modify Interface clause, as listed in the following table. You only need to specify fields to be modified.

Modify Interface Clause Specifies
name NEW_NAME/ The current interface name changes to that of the new name entered.
description VALUE The current description, if any, changes to the value entered.
icon FILENAME The image is changed to the new image in the field specified.
add attribute NAME The named attribute is added to the interface's list of explicit attributes.
remove attribute NAME The named attribute is removed from the interface's list of explicit attributes.
derived INTERFACE_NAME{,INTERFACE_NAME} The interface being modified inherits attributes and allowed types of the interface(s) named. Overwrites any previously defined parents.
remove derived Removes all parents.
abstract true Business object instances of this interface cannot be created.
abstract false Business object instances of this interface can be created.
add type NAME The named type is added to the interface's list of allowed types.
remove type NAME The named type is removed from the interface's list of allowed types.
add relationship REL_NAME to [minorrevision] [none|float\replicate] The named relationship is added to the interface's list of allowed relationships.
remove relationship REL_NAME The named relationship is removed from the interface's list of allowed relationships.
add pathtype PATH_NAME{,PATH_NAME} The named pathtype with the specified clauses is added to the interface.
remove pathtype PATH_NAME{,PATH_NAME} The named pathtype is removed from the interface.
add rule RULE_NAME Adds the named rule to the interface.
remove rule RULE_NAME Removes the named rule from the interface.
hidden The hidden option is changed to specify that the object is hidden.
nothidden The hidden option is changed to specify that the object is not hidden.
resetonclone When a business object is cloned, do not copy the interface and its attributes to the newly cloned business object.
!|not resetonclone When a business object is cloned, copy attribute values to the newly cloned business object.
resetonrevision When a business object is revised, do not copy the interface and its attribute to the newly revised business object.
!|not resetonrevision When a business object is revised, copy attribute values to the newly revised business object.
property NAME [to ADMININTERFACE NAME] [value STRING] The named property is modified.
add property NAME [to ADMININTERFACE NAME] [value STRING] The named property is added.
remove property NAME [to ADMININTERFACE NAME] [value STRING] The named property is removed.

Each modification clause is related to the arguments that define the interface.

Adding and removing attributes to an interface have the same effect as adding and removing them from a part. If many objects use the interface, many database rows are affected by the change, and so the transaction has the potential to be very time-consuming.

Delete Interface

If an interface is no longer required, you can delete it with the Delete Interface command.

delete interface NAME;
  • NAME is the name of the interface to be deleted.

Searches the list of interfaces. If the name is not found, an error message is displayed. If the name is found and the interface does not derive another interface, and there are no business objects that use the interface, the interface is deleted. If it is a parent interface, you must first delete the interfaces that are derived from it. For example, to delete the interface named “Metal,” enter the following MQL command:

delete interface Metal;

Deletes the interface if:

  • There are no business objects that use this interface.
  • There are no interfaces derived from this interface.

Add/Remove Interface Clause

You can add or remove the collection of interface attributes to a business object with the add interface or remove interface clause of the modify business object command.

add interface NAME
remove interface NAME

For example:

mod bus Item 1000 A add interface Aluminum add interface Milled;
mod bus Item 2000 A add interface Iron add interface Rolled
mod bus Item 3000 A add interface Iron remove interface Rolled;

Remember to include the keyword add or remove before you specify each interface name.

When modifying a business object’s type, if the new type allows the interfaces, the interfaces will be preserved. If not, the interfaces will be removed.