Business Entity Descriptor

The Business Entity Descriptor uses the Annotation based Type Descriptor to provide specific information about the usage of Business Entities at runtime. The information can be used by tools that use the information provided by the Business Entity Descriptor to dynamically adjust the behavior based on definitions in the Business Entity.

As the Business Entity Descriptor is based on the Annotation based Type Descriptor, the utility described on that page must be used after inserting necessary annotations in a Business Entity source code.

Sample of a Business Entity with relevant annotations
@BusinessEntityGenerator (entityname="Test.SCL835.OrderBusinessEntity", type="BusinessEntity") .
@BusinessEntityView (name="order", isdefault="true", entitytable="eOrder", entityview="eCustomer",
                     listcolumns="eOrder.OrderNum,eOrder.OrderDate,eOrder.CustNum,eCustomer.Name",
                     viewercolumns="eOrder.OrderNum,eOrder.OrderDate,eOrder.CustNum,eCustomer.Name,eOrder.OrderStatus") .
@BusinessEntityView (name="orderline", entitytable="eOrderLine", entityview="eItem",
                     listcolumns="eOrderLine.LineNum,eOrderLine.Qty,eOrderLine.ItemNum,eItem.ItemName,eOrderLine.Price",
                     viewercolumns="eOrderLine.LineNum,eOrderLine.Qty,eOrderLine.ItemNum,eItem.ItemName,eOrderLine.Price,eOrderLine.Orderlinestatus") .
@BusinessEntityTable (name="eOrder", mandatoryColumns="ordernum,orderstatus", readonlyColumns="ordernum") .
@BusinessEntityTable (name="eCustomer", mandatoryColumns="ordernum,orderstatus", readonly="true") .
@BusinessEntityTable (name="eOrderLine", mandatoryColumns="ordernum,linenum", readonlyColumns="ordernum,linenum") .
@BusinessEntityTable (name="eItem", mandatoryColumns="ordernum,orderstatus", readonly="true") .
 
 
CLASS Test.SCL835.OrderBusinessEntity
    INHERITS BusinessEntity
    USE-WIDGET-POOL:
Sample of a Business Entity method with the @InvokeMethod annotation
@InvokeMethod (template="invoke-receive-dataset", parameterClassName="Consultingwerk.CharacterHolder", datasetInput="true", datasetOutput="true") .
/*------------------------------------------------------------------------------
    Purpose: 
    Notes:  
    @param dsOrder INPUT-OUTPUT DATASET
    @param poParameter The Parameter Object for this method
------------------------------------------------------------------------------*/
METHOD PUBLIC VOID SampleMethod (INPUT-OUTPUT DATASET dsOrder, poParameter AS Consultingwerk.CharacterHolder):
     
END METHOD .

List of Annotations supported by the Business Entity Descriptor

@BusinessEntityTable

The BusinessEntityTable annotation allows to describe tables of the Business Entity. The possible attributes of the annotation at:

Attribute Name

Description

Name (required)

The name of the Temp-Table which is described here

ReadOnly

Logical value, describing if the Temp-Table is considered read-only in this Business Entity

MandatoryColumns

Comma delimited list of mandatory columns

ReadOnlyColumns

Comma delimited list of columns that are read-only

@BusinessEntityView

The BusinessEntityView annotation allows to describe views of the Business Entity, similar to the parameters required in the SmartBusinessEntityAdapter when accessing the Business Entity:

Attribute Name

Description

Name (required)

The name of the View

isdefault

Logical value indicating if this view is considered the default view of the Business Entity

EntityTable (required)

The name of the Entity Table (temp-table)

EntityView

The comma delimited list of Entity View table names (list of temp-tables that should be joined with the Entity Table on the client)

ListColumns

Comma delimited list of column names to be used in lists. The entries in this list should be {temp-table name}.{field name} or just {field name}. In case of just referencing the field name the view should use the first matching field from the EntityTable or the EntityView tables

QueryString

The default Query String for this view (leave empty for default)

ViewerColumns

Comma delimited list of column names to be used in viewers (detail views). The entries in this list should be {temp-table name}.{field name} or just {field name}. In case of just referencing the field name the view should use the first matching field from the EntityTable or the EntityView tables

@InvokeMethod

The InvokeMethod annotation allows the description of method that are invokable through the Service Interface or the Service Adapter

Attribute Name

Description

ParameterClassName

Name of the class name expected as the parameter object of the invokable method. Invokable methods expect the dataset of the Business Entity as INPUT-OUTPUT parameter and a further parameter object (which should be serializable if the method should be accessible from a client).

DatasetInput

Is the dataset parameter expected for INPUT

DatasetOutput

Is the dataset parameter expected for OUTPUT

template (ignored)

The template parameter is commonly used for Invokable method for the generation of proxy methods in the DatasetModel classes. This parameter is not required for the Business Entity Descriptor and will be ignored

Accessing the Business Entity Descriptor from the Backend

The Business Entity Descriptor is accessed by calling into the GetBusinessEntityDescriptor method of the Business Entity (base class) through the ServiceInterface:InvokeMethod method.

The parameter class GetBusinessEntityDescriptorParameter allows to specify if the call should also return the Business Entity Dataset.

Sample to access the Business Entity Descriptor from the backend
USING Consultingwerk.OERA.*                          FROM PROPATH .
USING Consultingwerk.OERA.BusinessEntityDescriptor.* FROM PROPATH .

DEFINE VARIABLE hDataset AS HANDLE NO-UNDO.
DEFINE VARIABLE oParameter AS GetBusinessEntityDescriptorParameter NO-UNDO . 

oParameter = NEW GetBusinessEntityDescriptorParameter () . 


ServiceInterface:InvokeMethod ("Test.SCL835.OrderBusinessEntity":U,
                               "GetBusinessEntityDescriptor":U,
                               INPUT-OUTPUT DATASET-HANDLE hDataset,
                               oParameter) .
 
/* oParameter:Descriptor returns the Business Entity Descriptor */

Accessing the Business Entity Descriptor from the Frontend

The Consultingwerk.OERA.BusinessEntityDescriptor.IBusinessEntityDescriptorClient with the default implementation BusinessEntityDescriptorClient provides access and a cache for the Business Entity Descriptor and should be used on the client.

Sample to access the Business Entity Descriptor from the client
USING Consultingwerk.OERA.*                          FROM PROPATH .
USING Consultingwerk.OERA.BusinessEntityDescriptor.* FROM PROPATH .

DEFINE VARIABLE oCache      AS IBusinessEntityDescriptorClient NO-UNDO . 
DEFINE VARIABLE oDescriptor AS IBusinessEntityDescriptor       NO-UNDO . 


/* ***************************  Main Block  *************************** */

oCache = {Consultingwerk/get-service.i Consultingwerk.OERA.BusinessEntityDescriptor.IBusinessEntityDescriptorClient
                                       "NEW Consultingwerk.OERA.BusinessEntityDescriptor.BusinessEntityDescriptorClient ()"} . 

oDescriptor = oCache:GetBusinessEntityDescriptor ("Test.SCL835.OrderBusinessEntity":U) .