Commands

Commands are available operations that can be executed on a class object.

JSON

{
      "id": "SAVE",
      "caption": "Сохранить",
      "visibilityCondition": null,
      "enableCondition": null,
      "needSelectedItem": false,
      "signBefore": false,
      "signAfter": false,
      "isBulk": false
 }

Field description

Field Name Acceptable values Description
"id" Code “CREATE” - crate object/object of reference field Internal code for the object operations.
    “EDIT” - edit object/reference object of the reference field  
    “DELETE” - delete object  
    “CREATE-INLINE” - create object (not in the create mode) Create object without opening the create form (to speed up the objects creation).
    “SAVEANDCLOSE” - save changes and close  
    “SAVE” - save changes  
    “REMOVE” - delete the reference to the reference object  
    “ADD” - add the reference to the reference object  
"caption" Name String Visible name - the signature on the action button (if available).
"visibilityCondition" View conditions Строка или null The condition under which the action button is available.
"enableCondition" Activity condition Строка или null The condition under which the action button is available.
"needSelectedItem" Visibility condition - presence of the selected item Boolean The field is set to true for commands that require the selected item to activate it.
"signBefore" Electronic signature of incoming data Boolean  
"signAfter" Electronic signature of outgoing data Boolean  
"isBulk" Group Boolean Sign of a batch operation, for the commands of reference fields. It is set to true for commands that are executed with all reference objects at the same time.

Logic of actions on reference objects

The "Select" operation is setting the connection between objects, regardless of the type of connection, it should be possible to set (and break) it at the level of business logic.

  1. If this is a one-to-many reference relationship, (i.e. a reference to a key), then taking the “one” side for A, the “many” side for B, we implement:
    • on the side of the B object (reference to A): the " SELECT " operation, find the object (A), set the value of the reference attribute of the B object equal to the key of the A object (reset the attribute to break the connection);
    • on the side of the A object (collection or back reference): the " ADD " operation, find the object (B), set the value of the reference attribute of this object (B) equal to the key of the object A, the " REMOVE " operation - select the object (B) in the collection, nullify the reference to A.
  2. If this is a many-to-many reference connection, (i.e. a link to a non-key attribute), then for both ends of the collection implement connections:
    • The “ADD” operation: find an object, set the value of its reference to the corresponding attribute of the container. The object will be in the collections of all containers with the corresponding attribute value, this is the specificity of this type of connections)
    • The "REMOVE" operation: select an object in the collection, reset the link, and the object is also removed from the collections of all containers with the corresponding attribute value.
  3. If this is a many-to-many connection without a reference (communication through a system intermediate entity, this includes both “direct” and “back” collections, as different ends of connection), then for both collections implement:
    • The “ADD” operation: find an object and create the entity-connection with a container, the object is displayed only in the collection of this container
    • The “REMOVE” operation: select an object in the collection, delete the connection with a container, the object disappears only from the collection of this container

From the viewpoint of UI there are no differences between the types of connections at all, everywhere we operate with collections, and the ADD and REMOVE operations are available everywhere. And it is possible to customize the certain buttons at the collection field at the level of the view mode. In business logic, standard handlers for the ADD and REMOVE buttons should be implemented in accordance with the logic described above.

Logic of actions on class objects

The field "commands" , specified in the general part of the meta of the class views, specifies the list of actions allowed for objects of this class.

In the general part of the meta of class views, the commands of the following "id" codes can be specified:

  1. "CREATE" - create object
  2. "EDIT" - edit object
  3. "DELETE" - delete object
  4. "SAVEANDCLOSE" - save changes and close
  5. "SAVE" - save changes

Use the following commands for the attribute with "type":2:

  1. "SELECT" - add
  2. "EDIT" - edit
  3. "REMOVE" - delete

Структура в mongoDB (registry)

{
    "id" : "SAVE",
    "caption" : "Сохранить",
    "visibilityCondition" : null,
    "enableCondition" : null,
    "needSelectedItem" : false,
    "signBefore" : false,
    "signAfter" : false,
    "isBulk" : false
}