Business Operation in Application Model

Table of contents:

  • Context-agnostic Business Operations node,
  • Context-dependent Business Operations node,
  • Child nodes of any Business Operation,
  • End-user interaction.

Business Operations are represented in the Application Model. They are listed in the Xafari|BusinessOperations node.

Note

Business Operations may be added to the Application Business Model. The Xafari BC Model module (Xafari.BC.Model.dll) provides such a scenario. If this module is added to the application, then the BO services use the Business Model instead of the Application Model. The Business Model data is stored in separate files out of the main Application Model. The special Project.xafml.Editor.exe tool provides all interactions to the Business Model. To learn more about these features, refer to the Support Center.

Context-agnostic Business Operations node

The image below shows the non-context BO node:

business_operations_4

This node exposes the following properties:

  • ImageName: specifies the string of characters that defines the name of the icon used to display the BO starting item in the UI.
  • Visible: it is a boolean flag that specifies whether the BO starting item is visible in the UI (see BrowsableAttribute).
  • DefaultImplementation: specifies the default Implementation.
  • ExecutionWay: specifies the execution mode of the BO within the Managed Operation when started from the UI. There are two possible modes:

- Asynchronous. In the asynchronous mode, the BO is executed in the background. The application does not wait for the result of the execution.

- Synchronous. In the synchronous mode, the progress window is displayed to visualize the execution progress. The application stops and waits until the execution ends.

  • Caption: specifies the BO display name (in the UI items).
  • Description: specifies a brief description of the BO.
  • Id: specifies the string of characters comprising a unique BO identifier. It is a read-only value. By default, the name of the BO class is used.
  • Type: specifies the BO class. It is a read-only value.
  • ParametersDialogSizeable: it is a flag indicating whether the input parameters dialog should be sizable. The default value is "false".

For the most of the above properties, the values can be set through the corresponding attributes in the code.

Context-dependent Business Operations node

The nodes representing the context-dependent BO have the same properties as the ordinary (context-agnostic) Business Operations, plus 7 additional properties described below:

business_operations_41

AutoRefreshView specifies the mode of data refreshing. Xafari.BC.BusinessOperations.Controllers.BORefreshController provides the feature to refresh the View data after executing a context BO. Available values are listed below.

  • Any: to refresh data in all context Views (both Detail View and List View);
  • DetailView: to refresh data in the Detail View only;
  • ListView: to refresh data in the List View only;
  • None: to update no data (it is a default value).

It is possible to set the AutoRefreshView property in the code via the ModelDefaultAttribute:

  • c#
  • VB

[ModelDefault("AutoRefreshView", "DetailView")]
public class MyBusinessOperation : BusinessOperationBase
{
}

<ModelDefault("AutoRefreshView", "DetailView")> _
Public Class MyBusinessOperation
  Inherits BusinessOperationBase
End Class

BORefreshController exposes three events: CustomRefreshBeforeExecute, CustomRefreshAfterExecute, and CustomMatch. The events allow the developer to complement or replace the entire logic of updating data after executing the BO. To learn more, refer to the following classes:

    • Xafari.BC.BusinessOperations.Controllers.BOExecViewController
    • Xafari.BC.BusinessOperations.Controllers.BORefreshController
    • Xafari.BC.BusinessOperations.Model.IModelBusinessOperationContext
    • Xafari.BC.BusinessOperations.ContextViewType

ContextDataType specifies the type of data providing the context (e.g., the type of the business object for which the Business Operation is intended). It is a read-only value.

ContextProperty specifies the reference to the BO context property (see the BO class section). It is a read-only value.

ContextViewType specifies the type of View in which the BO can be used. Three options are possible: DetailView, ListView, and Any.

ContextTypeMatchMode specifies the mode to check the correspondences between a context-dependent BO and the type of objects to which the operation can apply. It may possess the following values:

  • ExactObjectType: the business object type must match the context property type strictly.
  • SuccessorsOnly: the business object type should be a heir to the context property type.
  • ObjectTypeOrSuccessors: both scenarios from above are allowed. It is a default value.

The developer can set the value of this property using ContextPropertyAttribute in the application's source code.

ContextObjectsCriteria specifies the criteria string; the criterion is calculated based on an instance of the selected (current) business object. If the calculation result is False, the BO in the Actions list becomes inactive.

The developer can set the value of this property using ContextPropertyAttribute in the application's source code.

ContextObjectsCriteriaMode specifies how to apply the criterion to a group of previously selected objects. It may possess the following values:

  • TrueAtLeastForOne: at least one selected object should satisfy the criteria.
  • TrueForAll: all selected objects should satisfy the criteria.

The developer can set the value of this property using ContextPropertyAttribute in the application's source code.

Child nodes of any Business Operation

The node of any BO includes the following child nodes:

  • Categories,
  • Implementations,
  • Parameters.

business_operations_5

The deeper description of these nodes follows below.

Categories.

In the UI, the list of Business Operations displays a one-tier grouping by categories (see the Business Operation Class Attributes topic). One BO can belong to a number of categories. The Categories node contains the list of categories which the BO belongs to. There is a Default category that displays the BO in the root. It is possible to add, delete, and edit categories.

Implementations.

The node contains the list of all available Implementations. It is possible to change the Caption and the Description of the Implementation. The Id property is similar to the BO Id property and contains a unique identifier of the Implementation class. The Type property refers to the Implementation class.

Parameters.

It contains the list of the BO parameters. As mentioned above, any public property of the BO class is a BO parameter.

business_operations_6

Each BO parameter in the Model exposes the following properties:

  • CanWrite determines whether the parameter is accessible for writing. The value is "true" if there is a public setter for the respective property in the BO class.
  • CanRead determines whether the parameter is accessible for reading. The value is "true" if there is a public getter for the respective property in the BO class.
  • Caption specifies the display name of the parameter. It is used in the UI when the user inputs the BO parameters.
  • Id specifies the identifier of the parameter. The name of the respective BO class property is used as the identifier.
  • Index defines the display order of the parameters in the UI when the user inputs the parameters to the BO.
  • ToolTip defines the text of the pop-up tip in the UI when the user inputs the BO parameters.
  • Type stands for the type of the BO class property.

End-user interaction

To display a context-dependent BO in the Actions list, the framework uses a special SingleChoiceAction. It is named BOExecuteAction and can be configured in the ActionDesign|Actions node of the Application Model.

Context-agnostic BO are displayed using BusinessOperationsTreeNode_ListView. It is available in the Views node of the Application Model. There is also a respective NavigationItem element.

Important

BusinessOperationsTreeNode_ListView requires to add the NonPersistentObjectSpaceProvider to the application. If you have created an app using the Xafari template, this provider already exists.