0% found this document useful (0 votes)
52 views38 pages

Business Controls Development Guide

The DELMIA Apriso 2021 Technical Guide provides a comprehensive overview of developing reusable Function Interpreter visual Web components, known as Business Controls. It outlines the objectives, scope, requirements, and best practices for creating these components, which enhance the customization and reusability of functions within the DELMIA Apriso Process Builder. The document serves as a standard reference for programmers to ensure consistent and efficient development of Business Controls.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views38 pages

Business Controls Development Guide

The DELMIA Apriso 2021 Technical Guide provides a comprehensive overview of developing reusable Function Interpreter visual Web components, known as Business Controls. It outlines the objectives, scope, requirements, and best practices for creating these components, which enhance the customization and reusability of functions within the DELMIA Apriso Process Builder. The document serves as a standard reference for programmers to ensure consistent and efficient development of Business Controls.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

DELMIA Apriso 2021 Technical Guide

Business Controls Development

®2020 Dassault Systèmes. Apriso, 3DEXPERIENCE, the Compass logo and the 3DS logo, CATIA, SOLIDWORKS, ENOVIA, DELMIA, SIMULIA, GEOVIA, EXALEAD, 3D VIA, BIOVIA, NETVIBES, and 3DXCITE
are commercial trademarks or registered trademarks of Dassault Systèmes or its subsidiaries in the U.S. and/or other countries. All other trademarks are owned by their respective owners.
Use of any Dassault Systèmes or its subsidiaries trademarks is subject to their express written approval.
Business Controls Development | DELMIA Apriso 2021 Technical Guide 2

Contents
1 Introduction 4
1.1 Objective 4
1.2 Scope 4
1.3 Definitions 4
2 Framework Overview 5
2.1 Motivation 5
2.2 Assumptions 5
2.3 Business Control Architecture 5
3 Requirements 7
3.1 Tools 7
3.1.1 SDK 7
3.1.2 Programming Language 7
3.1.3 Development Environment 7
3.2 Definitions 7
3.2.1 Interfaces 7
3.2.2 Base Class 7
3.2.3 Common Controls and Actions 7
4 Business Control Creation Process 8
4.1 Developing the Business Control Properties Project 8
4.1.1 Developing the Business Control Win Configurator Class 9
4.1.2 Developing the Business Control Win Properties Class 17
4.2 Developing the Business Control Runtime Project 20
4.2.1 Developing the Business Control Main Class 21
4.2.2 Developing the Business Control Runtime Control 26
4.3 Developing the Business Control Win Editor Project 28
4.3.1 Developing the Business Control Win Editor Class 29
4.4 Using a Business Control in DELMIA Apriso 33
4.4.1 Installing the Business Control on a DELMIA Apriso Server 33
4.4.2 Configuring the Business Control 34
4.4.3 The Business Control in Runtime 34
5 Best Practices 35
5.1 Web Controls (*.ascx) 35
5.2 Shared Web Controls 35
5.3 Shared Actions 35
5.4 Debugging Business Control Editor Class 37
6 References 38

Figures
Figure 1 Sample Business Control properties project tree 9
Business Controls Development | DELMIA Apriso 2021 Technical Guide 3

Figure 2 Sample Business Control WebUI Project Tree 21


Figure 3 Sample Business Control WinUI Project Tree 29
Figure 4 Business Control function in Process Builder 34
Business Controls Development | DELMIA Apriso 2021 Technical Guide 4

1 Introduction
1.1 Objective
The objective of this document is to introduce programmers to the concept of developing
reusable Function Interpreter visual Web components called Business Controls. The
development process will be standardized through the introduction of a set of guidelines that
should be followed by programmers.

1.2 Scope
The scope of this document describes the following core areas of Business Control
development:
General information about the development framework (2 Framework Overview)
Components required for development of Business Controls (3 Requirements)
Process of Business Controls creation (4 Business Control Creation Process):
Best practices (5 Best Practices)

1.3 Definitions
Business Control – a set of classes and [Link] web controls that allow for embedding
pre-coded Web forms and related business logic into Function Interpreter Processes in a
simple and easily configurable way.
Business Controls Development | DELMIA Apriso 2021 Technical Guide 5

2 Framework Overview
2.1 Motivation
Some of the Functions configured in DELMIA Apriso Process Builder appear in many
Processes and Operations, often with few or no changes in appearance and behavior. It is not
always possible to reuse some existing Functions, because they are defined to work in
specific contexts and are not defined to be reusable or customizable in the future.
With that in mind, Business Controls have been introduced. The Business Control technology
enables developing UI components that can be placed in Process Builder Operations as
Functions with many configuration features for modifying the component’s outlook and
behavior. These are later displayed by Function Interpreter in the desired fashion.
Business Controls are templates for Functions and are therefore reusable components.
Business Controls can be designed to work with many different sets of Inputs, which allows
them to speed up the development of production Operations and assure the consistent display
of similar Functions to the end user.

2.2 Assumptions
All of the controls are implemented using the Microsoft® .NET framework and [Link]
technology. Though the majority of them are written in the C# language, support for other .NET
languages is also provided.

2.3 Business Control Architecture


A Business Control is a composite component that consists of several subcomponents. All of
these subcomponents have to be developed according to the rules specified in the following
sections of this document in order to assure proper and consistent behavior.
The main components of a Business Control are:
Business Control Class
The class is the axis of the entire Business Control, as it indicates what components should
be used in the process of configuration and execution of the control. It implements the
IBusinessControl interface (which is a member of
[Link]) and is marked with the
ComponentRepositoryComponentType and BusinessControl attributes.
Win Business Control Configuration
This is the WinForms user control. This control is used by Process Builder in design mode
to set the Business Control properties.
Business Controls Development | DELMIA Apriso 2021 Technical Guide 6

Business Control Runtime


This is a set of [Link] user Web controls (Desktop and Mobile) which are used by
Function Interpreter during execution to display the Business Control based on the
properties set in Process Builder.
Business Control Properties
This is an optional class that contains the configuration options of the Business Control. It is
persisted in the database so the class itself and all of its fields have to be serializable (or
marked with the XmlIgnore attribute).
It is recommended to implement the INotifyPropertyChanged interface on this class,
because this is very useful during the writing of the Win Configurator.
Business Controls Development | DELMIA Apriso 2021 Technical Guide 7

3 Requirements
This chapter describes the tools and definitions required for development of Business
Controls.

3.1 Tools
3.1.1 SDK
To develop and extend the DELMIA Apriso Business Controls, Microsoft® .NET SDK have to
be installed. This library can be freely downloaded and installed from the Microsoft® Web site.

3.1.2 Programming Language


Most DELMIA Apriso Business Controls are written in the C# programming language.
Business Controls can be extended in any language that is available for the .NET platform.

3.1.3 Development Environment


Microsoft® Visual Studio offers the best development environment for the .NET platform and is
recommended as the primary developer tool.

3.2 Definitions
3.2.1 Interfaces
The interfaces used by Business Control runtime controls are defined in
[Link].

The interfaces required to create the WinForms configurator for DELMIA Apriso Process
Builder are defined in [Link].

3.2.2 Base Class


The base Business Control class is defined in [Link].

3.2.3 Common Controls and Actions


Common controls and actions useful in development (e.g., creating/deleting Inputs/Outputs,
changing Input/Outputs types, changing the routing) are defined in
[Link].
Business Controls Development | DELMIA Apriso 2021 Technical Guide 8

4 Business Control Creation Process


To create a Business Control, create a new solution in the 3.1.3 Development Environment
and add three new projects:
Business Control Properties
This should be a class library project which will contain the Business Control Properties
Class for the configurator and also for the runtime controls. This assembly should reference
as few DLLs as required, because it will be shared between the client and the server
application and the Properties class will be sent via remoting services. If you already have
properties for your old Web Business Control, you can use this class but you have to
implement a few interfaces on it.
For details on this project, refer to 4.1 Developing the Business Control Properties Project.
Business Control Runtime
This should be the Web Application project which will contain the main Business Control
class and all the runtime classes.
For details on this project, refer to 4.2 Developing the Business Control Runtime Project.
Business Control Win Editor
This should be the class library project which will contain the set of classes for the
Business Control WinForms Editor for Process Builder. If your control does not need to
have a WinForm Editor (e.g., it just has some predefined Inputs), you do not need to create
this assembly.
For details on this project, refer to 4.3 Developing the Business Control Win Editor Project.

All these DLLs have to be signed with a strong name, because they will be placed in
the .NET Global Assembly Cache or downloaded via ClickOnce as described in 4.4
Using a Business Control in DELMIA Apriso.

4.1 Developing the Business Control Properties Project


To create the project, perform the following tasks:
1. Create a Class Library project. The example project is named BusinessControlsSample.
2. Add the following classes to the folder:
a. Business Control Configurator class. For instructions on creating this class, refer to 4.1.1
Developing the Business Control Win Configurator Class.
b. Business Control Properties class – in the simplest case, you do not need to create a
Properties class, as it could be a simple type such as integer, string, or an array of one of
these types. Additionally, it could be a PropertyBag class. In the example solution
described in this document, you can see the SampleProperties class and
Business Controls Development | DELMIA Apriso 2021 Technical Guide 9

TestBusinessControlPropertiesDTO class, which is used in the Process Builder


solution. If your implementation is not complex, it may be sufficient to implement the
IBusinessControlProperties interface on the SampleProperties class instead of creating
a separate TestBusinessControlPropertiesDTO class.
For instructions on creating the Business Control Properties class, refer to 4.1.2
Developing the Business Control Win Properties Class.
3. Add references for:
[Link] this assembly contains all required interfaces
for the Win Configurator control)
[Link]
[Link]
[Link]
[Link]
[Link]
[Link]
[Link]

The project tree should look similar to the one shown in the figure below.

Figure 1 Sample Business Control properties project tree

4.1.1 Developing the Business Control Win Configurator Class


The Business Control Win Configurator is a non-visual class that provides binding between
the Business Control components and the rest of the Process Builder environment. It is used
for managing Business Control properties, providing information about Business Control
Editor (if it is enabled), and validating the configuration of the Business Control.
This class has to implement IBuisnessControlConfigurator. The following properties and
methods should be implemented:
Logic:
ICollectionView<IODescriptor> NewInstanceInputs { get; } – gets the Input
descriptors required for a new instance of the Business Control
ICollectionView<IODescriptor> NewInstanceOutputs { get; } – gets the Output
descriptors required for a new instance of the Business Control
ICollectionView<IODescriptor> GetInstanceInputs(IBusinessControlProperties
properties); – gets the Inputs collection based on properties
Business Controls Development | DELMIA Apriso 2021 Technical Guide 10

This method is used during the validation of the Business Control. The system checks if
all of the Inputs exist and have the correct type. In a simple Business Control example,
this could just return NewInstanceInputs, but in a more complicated situation it could be
different.
ICollectionView<IODescriptor> GetInstanceOutputs(IBusinessControlProperties
properties); – gets the Outputs collection based on properties
This method is used during the validation of the Business Control. The system checks if
all of the Outputs exist and have the correct type. In a simple Business Control example,
this could just return NewInstanceOutputs, but in a more complicated situation it could
be different.
string EditorAssemblyName { get; } – used to define the full assembly name
string EditorClassName { get; } – used to define the name of the editor class
IBusinessControlProperties CreateProperties(FunctionDTO function, object
serializedProperties); – creates an IBusinessControlProperties object based on a
serialized internal representation of the Business Control properties (refer to 4.1.2
Developing the Business Control Win Properties Class)
object SerializeProperties(IBusinessControlProperties properties); – serializes
the PB properties object to an internal representation of the Business Control properties
void OnInputAdded(FunctionInputDTO input); – the method called after adding an
Input to the Function
void OnInputRemoved(FunctionDTO function, FunctionInputDTO input); – the method
called after removing an Input from the Function
void OnInputChanged(FunctionInputDTO functionInput, ChangeType changeType,
EventArgs args); – the method called after changing an Input in the Function
void OnOutputAdded(FunctionOutputDTO output); – the method called after adding an
Output to the Function
void OnOutputRemoved(FunctionDTO function, FunctionOutputDTO output); – the
method called after removing an Output from the Function
void OnOutputChanged(FunctionOutputDTO functionOutput, ChangeType changeType,
EventArgs args); – the method called after changing an Output in the Function
void Validate(FunctionDTO function, BusinessControlFunctionPropertiesDTO
controlGeneralProperties, [Link] serviceProvider, out
IDictionary<IValidatableEntity, ICollection<Message>> validationMessagess); –
validates the Business Control properties
ServiceProvider can be used in a situation when you want to get additional data from the
server or call some methods on the server via remoting. In such cases, the interface
should be added to the common shared [Link]. An
additional project for service implementation can be added to the solution. Use of this
service is shown below:
IFunctionsRepositoryService service =
[Link]<IFunctionsRepositoryService>();
BusinessComponentMethodDTO bcmDTO =
[Link]([Link]);
Business Controls Development | DELMIA Apriso 2021 Technical Guide 11

Visual experience:
[Link]<UnitType> SupportedSizeUnits { get; } –
used to define the units that can be used to describe the Business Control size
CssStyle DefaultDesktopStyle { get; } – used to define the default control rendering
style on desktop devices
CssStyle DefaultMobileStyle { get; } – used to define the default control rendering
style on mobile devices
Unit? DefaultDesktopWidth { get; } – used to define the default control width on
desktop devices
Unit? DefaultDesktopHeight { get; } – used to define the default control height on
desktop devices
Unit? DefaultMobileWidth { get; } – used to define the default control width on
mobile devices
Unit? DefaultMobileHeight { get; } – used to define the default control height on
mobile devices
SizeF MinimumDesktopSize { get; } – used to define the minimum control size on
desktop devices
SizeF MinimumMobileSize { get; } – used to define the minimum control size on
mobile devices
[Link] PreviewImage { get; } – returns an image of the Business
Control initially designed to be used in Layout Editor
[Link] Icon { get; } – returns an image of the Business Control icon
used in the toolbox in Layout Editor
BusinessControlCategory Category { get; } – defines the category of the Business
Control and determines if and in which toolbox section the control will be displayed in
Layout Editor
BusinessControlType Type { get; } – defines the type of the Business Control, and
determines how the Business Control will be visualized in Layout Editor
bool EditorNotRequired { get; } – if true, then the Business Control properties editor
is not needed and does not have to be specified
Business Controls Development | DELMIA Apriso 2021 Technical Guide 12

Example Code
Business Controls Development | DELMIA Apriso 2021 Technical Guide 13

using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using Image = [Link];
using Message = [Link];
using [Link].BusinessControls2;

namespace [Link]
{
public class TestBusinessControlConfigurator : IBusinessControlConfigurator
{
//Optionaly instead of implementing IBusinessControlConfigurator you can derive
//some methods already implemented.
//ComponentBusinessControlConfigurator
//UserInterfaceBusinessControlConfigurator
public IBusinessControlProperties CreateProperties(FunctionDTO function, object
serializedProperties)
{
BusinessControlFunctionPropertiesDTO bcpdto = [Link] as
BusinessControlFunctionPropertiesDTO;
[Link](bcpdto, "bcpdto");
if (serializedProperties == null)
return new TestBusinessControlPropertiesDTO();
SampleProperties sampleProprties = [Link]
((string) serializedProperties, typeof(SampleProperties)) as
SampleProperties;
return new TestBusinessControlPropertiesDTO(sampleProprties);
}
public object SerializeProperties(IBusinessControlProperties properties)
{
return [Link]((properties as
TestBusinessControlPropertiesDTO).SampleProperties);
}
public IBusinessControlProperties DeserializeProperties(object serializedProperties)
{
return [Link]<TestBusinessControlPropertiesDTO>
(serializedProperties as string);
}
public [Link]<UnitType> SupportedSizeUnits
{
get { return null; }
Business Controls Development | DELMIA Apriso 2021 Technical Guide 14

}
public CssStyle DefaultDesktopStyle
{
get { return null; }
}
public CssStyle DefaultMobileStyle
{
get { return null; }
}
public Unit? DefaultDesktopWidth
{
get { return null; }
}
public Unit? DefaultDesktopHeight
{
get { return null; }
}
public Unit? DefaultMobileWidth
{
get { return null; }
}
public Unit? DefaultMobileHeight
{
get { return null; }
}
public SizeF MinimumDesktopSize
{
get { return [Link]; }
}
public SizeF MinimumMobileSize
{
get { return [Link]; }
}

//Getter should returns image. In our case it is added to project properties.


//Add files to resources and change its name in code.
public Image PreviewImage
{
get { return Resources.bcontrol_image_chart; }
}

//Getter should returns image. In our case it is added to project properties.


//Add files to resources and change its name in code.
public Image Icon
{
get { return Resources.bcontrol_toolbox_chart; }
}
public BusinessControlCategory Category
{
get { return [Link]; }
}
public BusinessControlType Type
Business Controls Development | DELMIA Apriso 2021 Technical Guide 15

{
get { return [Link]; }
}
public bool EditorNotRequired
{
get { return false; }
}
public string EditorAssemblyName
{
get
{
return
"[Link], Version=[Link],Culture = neutral,
PublicKeyToken = 33f692327842122b";
}
}

public string EditorClassName


{
get
{
return
"[Link]
rolEditor";
}
}

public string HelpKeyword { get; private set; }

public ICollectionView<IODescriptor> NewInstanceInputs


{
get
{
IList<IODescriptor> inputs = new List<IODescriptor>(
new[]
{
new IODescriptor("TestInput", "Test input description",
[Link])
}
);
return inputs;
}
}
public ICollectionView<IODescriptor> NewInstanceOutputs
{
get
{
IList<IODescriptor> outputs = new List<IODescriptor>(
new[]
{
new IODescriptor("TestOutput", "Test output description",
[Link])
Business Controls Development | DELMIA Apriso 2021 Technical Guide 16

}
);
return outputs;
}
}

public ICollectionView<IODescriptor> GetInstanceInputs(IBusinessControlProperties


properties)
{
TestBusinessControlPropertiesDTO testProperties =
(TestBusinessControlPropertiesDTO) properties;
if ([Link])
return [Link];
return null;
}

public ICollectionView<IODescriptor> GetInstanceOutputs(IBusinessControlProperties


properties)
{
return [Link];
}

public void Validate(FunctionDTO function, BusinessControlFunctionPropertiesDTO


controlGeneralProperties, [Link] serviceProvider, out
IDictionary<IValidatableEntity, ICollection<Message>> validationMessagess)
{
validationMessagess = new Dictionary<IValidatableEntity, ICollection<Message>>
();
IList<Message> collection = new List<Message>();
[Link](function, collection);
if ([Link] == null)
{
[Link]([Link]
([Link],
[Link]));
return;
}

try
{
SampleProperties properties =
((TestBusinessControlPropertiesDTO)
[Link])
.SampleProperties;
if (properties == null)
{
[Link]([Link]
([Link]));
}
}
catch
{
Business Controls Development | DELMIA Apriso 2021 Technical Guide 17

[Link]([Link]
([Link]));
}
}

public void OnInputAdded(FunctionInputDTO input)


{
}

public void OnInputRemoved(FunctionDTO function, FunctionInputDTO input)


{
}

public void OnInputChanged(FunctionInputDTO functionInput, ChangeType changeType,


EventArgs args)
{
}

public void OnOutputAdded(FunctionOutputDTO output)


{
}

public void OnOutputRemoved(FunctionDTO function, FunctionOutputDTO output)


{
}

public void OnOutputChanged(FunctionOutputDTO functionOutput, ChangeType changeType,


EventArgs args)
{
}
}
}

4.1.2 Developing the Business Control Win Properties Class


The Business Control Properties class is a class with fields and get/set properties. Properties
are used to persist into the database the information about the configuration options chosen
on the Business Control configuration screen.
The class should implement the IBusinessControlProperties (which also implement
INotifyPropertyChanged and IUpdatable<IBusinessControlProperties>) interface:

IBusinessControlProperties DettachedClone();– this method returns a copy of the


current properties and should create a standalone object of the Business Control properties
without links to the Function
PropertyChangedEventHandler PropertyChanged;– the event that is fired when a property
of the Business Control changes
void UpdateFrom(IBusinessControlProperties source);– this method updates the current
properties according to the source properties
Business Controls Development | DELMIA Apriso 2021 Technical Guide 18

Example Code – SampleProperties Class

using System;
using [Link];

namespace [Link]
{
[Serializable]
public class SampleProperties : INotifyPropertyChanged
{
private string _test;
public string TestProperty
{
get { return this._test; }
set
{
if (value != this._test)
{
this._test = value;
[Link]("TestProperty");
}
}
}

private bool _testInputRequired = true;


public bool TestInputRequired
{
get { return this._testInputRequired; }
set
{
if (value != this._testInputRequired)
{
this._testInputRequired = value;
[Link]("TestInputRequired");
}
}
}

public event PropertyChangedEventHandler PropertyChanged;


protected void OnPropertyChanged(string propertyName)
{
if ([Link] != null)
[Link](this, new PropertyChangedEventArgs(propertyName));
}
}
}
Business Controls Development | DELMIA Apriso 2021 Technical Guide 19

Example Code – TestBusinessControlPropertiesDTO Class

using [Link];
using [Link];
using [Link];

namespace [Link]
{
public class TestBusinessControlPropertiesDTO : IBusinessControlProperties
{
public SampleProperties SampleProperties { get; set; }

public TestBusinessControlPropertiesDTO(SampleProperties sampleProperties)


{
[Link] = sampleProperties;
}

public TestBusinessControlPropertiesDTO()
{
[Link] = new SampleProperties();
}

[DTOIgnore]
public event PropertyChangedEventHandler PropertyChanged
{
add { [Link] += value; }
remove { [Link] -= value; }
}

public void UpdateFrom(IBusinessControlProperties source)


{
if (source as TestBusinessControlPropertiesDTO == null)
return;

TestBusinessControlPropertiesDTO sourceProperties =
(TestBusinessControlPropertiesDTO)source;

[Link] =
[Link];
[Link] =
[Link];
}

public IBusinessControlProperties DettachedClone()


{
TestBusinessControlPropertiesDTO properties = new
TestBusinessControlPropertiesDTO(new SampleProperties());
[Link](this);
return properties;
}
}
}
Business Controls Development | DELMIA Apriso 2021 Technical Guide 20

Example Code – Validation of Messages Literals

using [Link];
namespace [Link]
{
[LiteralDefinition]
public enum ValidationMessages
{
[LiteralDefinition("Business Control Properties is empty.")]
BusinessControlPropertiesIsEmpty,
[LiteralDefinition("Business Control is not configured.")]
TestBusinessControlNotConfigured
}
}

4.2 Developing the Business Control Runtime Project


To create the project, perform the following tasks:
1. Create an [Link] Web Application project. The example project is named
BusinessControlsSampleWebUI.
2. Add a folder for the Business Control that is created.
3. Add the following classes to the folder:
a. <control name> BusinessControl class. For instructions on creating this class, refer to
4.2.1 Developing the Business Control Main Class.
b. <control name> Runtime Web user control class. For instructions on creating this class,
refer to 4.2.2 Developing the Business Control Runtime Control.
c. <control name> RuntimeMobile mobile Web user control class (if the control is supposed
to work on mobile devices). For instructions on creating this class, refer to 4.2.2
Developing the Business Control Runtime Control.
d. <control name> RuntimeText mobile Web user control class (if the control is supposed to
work on text devices and the mobile control is different than text). For instructions on
creating this class, refer to 4.2.2 Developing the Business Control Runtime Control.
4. Add references for
[Link]
[Link]
[Link]
[Link]
[Link]
[Link]
BusinessControlsSample project
The project tree should look similar to the one shown in the figure below.
Business Controls Development | DELMIA Apriso 2021 Technical Guide 21

Figure 2 Sample Business Control WebUI Project Tree

4.2.1 Developing the Business Control Main Class


The Main Business Control class is a non-visual class that provides binding between the
Business Control components and the rest of the DELMIA Apriso environment. It contains the
information necessary for the Business Control to be registered in the Business Component
Repository as well as the names of the configuration and runtime controls of which the
Business Control consists. It is also used to validate the configuration data entered by the user
in DELMIA Apriso Process Builder, generate PB Function Inputs and Outputs, or execute
custom logic in runtime.
The Main Business Control class has to be marked with two attributes:
ComponentRepositoryComponentType
This is the attribute used by the Component Repository engine to register the control. See
an example below.

[ComponentRepositoryComponentType([Link], “NEW_FUID” )]

The example attribute contains two required parameters:


ComponentType
FUID – a unique identifier used in the DELMIA Apriso system that can be generated
using tools like a GUID generator
BusinessControl
This is the attribute that supplies information about the Business Control. See an example
below.
Business Controls Development | DELMIA Apriso 2021 Technical Guide 22

[BusinessControl("SampleBusinessControl",
"1.0",
"SampleBusinessControlDescription",
"[Link]",
"[Link]",
null,
"[Link], Version=[Link], Culture=neutral,
PublicKeyToken=33f692327842122b",
"[Link]
r")]

The example attribute contains the following parameters:


SampleBusinessControl – the name of the Business Control
1.0 – the version of the Business Control
SampleBusinessControlDescription – the description of the Business Control
[Link], [Link], null
– the paths to the desktop, mobile and text runtime controls (if a control is not used, insert
null)
[Link], Version=[Link], Culture=neutral,
PublicKeyToken=33f692327842122b – the details of the DLL that contains the Win
Configurator
[Link]
nfigurator – the name of the Win Configurator class

It is very important to specify the file locations as relative paths to the main Business Control
path. For example:

[BusinessControl
("Checklist Control", "1.0",
"Displays a checklist and persists a user's answers to the database",
"Checklist/[Link]", null, null,
"[Link], Version=[Link], Culture=neutral,
PublicKeyToken=33f692327842122b",
"[Link]
Configurator")]

The Main Business Control class also needs to inherit from


[Link]. BusinessControl (override methods if needed) or
implement the IBusinessControl interface:
Outcome ExecutePreRenderLogic(object properties, PropertyBag inputs, PropertyBag
sessionVariables) – executed right before the runtime engine renders the Business Control
to the user (this method is executed inside the Function Interpreter database transaction!)
Outcome ExecutePostRenderLogic(object properties, PropertyBag outputs, PropertyBag
sessionVariables) – executed just after the Operation screen is submitted (this method is
executed inside the Function Interpreter database transaction!)
Business Controls Development | DELMIA Apriso 2021 Technical Guide 23

Some interface methods are marked as obsolete and will be removed from the interface in the
next version (these methods are not required, because Web Process Builder has been
removed):
InputOutputDescriptorCollection GetInputsDefinition(object properties)
InputOutputDescriptorCollection GetOutputsDefinition(object properties)
OutcomeCollection Validate(object properties, InputOutputDescriptorCollection inputs,
InputOutputDescriptorCollection outputs, CssStyleSet style)
Business Controls Development | DELMIA Apriso 2021 Technical Guide 24

Example Code
Business Controls Development | DELMIA Apriso 2021 Technical Guide 25

using [Link];
using [Link];
using [Link];
using [Link];
using [Link];

namespace [Link]
{
[ComponentRepositoryComponentType([Link], "FA7A0A07-3341-4c41-
ACFE-7BDB59AAE9FB")]
[BusinessControl("SampleBusinessControl",
"1.0",
"TestBusinessControlDescription",
"[Link]",
"[Link]",
null,
"[Link], Version=[Link], Culture=neutral,
PublicKeyToken=33f692327842122b",
"[Link]")]
public class TestBusinessControl : BusinessControl
{
public override InputOutputDescriptorCollection GetInputsDefinition(
object properties)
{
InputOutputDescriptorCollection result = new InputOutputDescriptorCollection
{
new InputOutputDescriptor("TestInput", "TestInputDescription",
[Link])
};

return result;
}

protected override InputOutputDescriptorCollection GetRequiredInputs(object


properties)
{
SampleProperties props = (SampleProperties)properties;
if ([Link])
return [Link](properties);

return new InputOutputDescriptorCollection();


}

public override InputOutputDescriptorCollection GetOutputsDefinition(object


properties)
{
InputOutputDescriptorCollection result = new InputOutputDescriptorCollection
{
new InputOutputDescriptor("TestOutput", "TestOutputDescription",
[Link])
};
Business Controls Development | DELMIA Apriso 2021 Technical Guide 26

return result;
}
}
}

4.2.2 Developing the Business Control Runtime Control


Business Control Runtime is a set of [Link] user Web controls which are used by Function
Interpreter during execution to display the Business Control.
The runtime control needs to implement the IBusinessControlRuntime interface:
void Initialize(object properties, PropertyBag inputs, PropertyBag
sessionVariables, CssStyleSet style) – the initialized Business Control just before it is
shown to the user, and this is invoked only once
Outcome Validate() – validates if the data on the screen is correct (e.g., if the Inputs have
the correct types, etc.)
void GetOutputsValues(PropertyBag outputs) – gets a Function Outputs based on values
from the screen, and this is invoked once when the page is submitted (for example, the user
clicks the OK button or invokes SubmitPage event [see below])
event EventHandler SubmitPage – could be used to submit the page (without clicking the
OK button)
The desktop control must inherit from [Link].

The runtime control must be composed of [Link] controls. You should avoid using
static HTML controls that are the same as static string value assignments in runtime.
Business Controls Development | DELMIA Apriso 2021 Technical Guide 27

Example Code

using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];

namespace [Link]
{
public partial class TestBusinessControlRuntime : UserControl, IBusinessControlRuntime
{
protected [Link] TextBox1;
protected [Link] TextBox2;
protected [Link] Label1;
protected [Link] Label2;
//-----------------------------------------------------------------------------
// Additional code
//-----------------------------------------------------------------------------

public void GetOutputsValues(PropertyBag outputs)


{
outputs["TestOutput"] = [Link] + ":" + [Link];
}

public void Initialize(object properties, PropertyBag inputs, PropertyBag


sessionVariables, CssStyleSet style)
{
SampleProperties sampleProperties = [Link]
([Link](), typeof(SampleProperties)) as SampleProperties;

if ([Link])
[Link] = [Link] + ":" + inputs
["TestInput"];
else
[Link] = [Link];
}

public Outcome Validate()


{
return [Link]();
}

public event EventHandler SubmitPage;


}
}

Runtime ASCX file


Business Controls Development | DELMIA Apriso 2021 Technical Guide 28

<%@ Control Language="C#" AutoEventWireup="true"


CodeBehind="[Link]"
Inherits="[Link]
e, [Link], Version=[Link], Culture=neutral,
PublicKeyToken=33f692327842122b"
TargetSchema="[Link]
<table>
<tr>
<td>
<asp:Label id="Label1" runat="server">Properties : Test Input</asp:Label>
</td>
<td>
<asp:TextBox id="TextBox1" runat="server" Enabled="False"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label id="Label2" runat="server">Test Output</asp:Label>
</td>
<td>
<asp:TextBox id="TextBox2" runat="server"></asp:TextBox>
</td>
</tr>
</table>

4.3 Developing the Business Control Win Editor Project


If your control does not require a visual editor, you do not have to create this project.

To create the project, perform the following tasks:


1. Create a Class Library project. The example project is named
BusinessControlsSampleWinUI.
2. Add a folder for the Business Control that will be created.
3. Add the following class to the folder: <control name> Business Control Editor class (if
required). This should be User Control class.
4. Add reference for:
[Link]
[Link]
[Link]
[Link]
This assembly contains all of the required interfaces for the Win Configurator control
[Link]
[Link]
[Link]
[Link]
BusinessControlsSample project
The project tree should look similar to the one shown in the figure below.
Business Controls Development | DELMIA Apriso 2021 Technical Guide 29

Figure 3 Sample Business Control WinUI Project Tree

4.3.1 Developing the Business Control Win Editor Class


If it is required to implement the Editor class. The Business Control Editor for DELMIA Apriso
Process Builder should be derived from the UserControl class and has to implement the
IBusinessControlEditor interface.

void SetReadOnly(bool readOnly); – implements the read-only property on all controls


when they are called
void EditFunction(FunctionDTO function); – sets all the properties on the editor based
on information from the Function
void CompleteEditing(); – releases all of the objects that are not needed anymore
Business Controls Development | DELMIA Apriso 2021 Technical Guide 30

Example Code
Business Controls Development | DELMIA Apriso 2021 Technical Guide 31

using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using SecurityManager = [Link];

namespace [Link]
{
public partial class TestBusinessControlEditor : UserControl, IBusinessControlEditor
{
private bool _settingControls;
private FunctionDTO _editedFunction;

private SampleProperties _sampleProperties;

public TestBusinessControlEditor()
{
InitializeComponent();
}

public void EditFunction(FunctionDTO function)


{
this._editedFunction = function;
this._sampleProperties = ((TestBusinessControlPropertiesDTO)
((BusinessControlFunctionPropertiesDTO)this._editedFunction.Properties).
BusinessControlProperties).SampleProperties;
[Link](this._sampleProperties);
[Link](this._editedFunction.IsReadOnly);
this._editedFunction.ReadOnlyChanged += [Link];
this._sampleProperties.PropertyChanged += [Link];
}

public void SetReadOnly(bool readOnly)


{
AccessLevel uiAccessLevel = [Link]
([Link]);
if (uiAccessLevel == [Link] || uiAccessLevel == [Link])
readOnly = true;

[Link] = !readOnly;
[Link] = !readOnly;
}

public void CompleteEditing()


{
Business Controls Development | DELMIA Apriso 2021 Technical Guide 32

this._editedFunction.ReadOnlyChanged -= [Link];
this._sampleProperties.PropertyChanged -= [Link];
this._sampleProperties = null;
}

private void SetValuesToControls(SampleProperties properties)


{
this._settingControls = true;

[Link] = [Link] ?? [Link];


[Link] = [Link];

this._settingControls = false;
}

void SamplePropertiesPropertyChanged(object sender,


[Link] e)
{
[Link](this._sampleProperties);
}

void EditedFunctionReadOnlyChanged(object sender,


[Link]<bool> e)
{
[Link](this._editedFunction.IsReadOnly);
}

private void textBox1_TextChanged(object sender, EventArgs e)


{
if (this._settingControls)
return;

this._sampleProperties.TestProperty = [Link];
}

private void checkBoxTestInputRequired_CheckedChanged(object sender, EventArgs e)


{
if (this._settingControls)
return;

this._sampleProperties.TestInputRequired =
[Link];

if (this._sampleProperties.TestInputRequired && this._


[Link]("TestInput") == false)
{
[Link](new AddInputAction(this._
editedFunction, [Link], [Link], "TestInput", "Test
input description", false));
}
}
Business Controls Development | DELMIA Apriso 2021 Technical Guide 33

}
}

4.4 Using a Business Control in DELMIA Apriso


To understand the role of each element of a Business Control, it is necessary to know how a
Business Control is installed on a running Apriso server and how users interact with it.

4.4.1 Installing the Business Control on a DELMIA Apriso Server


As a result of the development of a Business Control, several ASCX files ([Link] user
controls, e.g., [Link]) and DLL files (e.g.,
[Link], [Link],
and [Link]) are created. They contain the logic of the
Business Control (for instructions on creating these assemblies, refer to 4.1 Developing the
Business Control Properties Project, 4.2 Developing the Business Control Runtime Project
and 4.3 Developing the Business Control Win Editor Project):
The DLLs need to be added to .NET Global Assembly Cache of the server or folder from
where ClickOnce application is downloaded:
[Link] should be added to the .NET Global
Assembly Cache
[Link] should be added to the installation folder of
the Click Once application (by default <drive>\Program Files\Dassault Systemes\DELMIA
Apriso 2021\WebSite\Downloads\PB2)
[Link] should be added to both the .NET Global
Assembly Cache and the ClickOnce installation folder
The ASCX files should be copied to a new subfolder of the BusinessControls folder of the
Portal applications (by default <drive>\Program Files\Dassault Systemes\DELMIA Apriso
2021\WebSite\Portal\BusinessControls\<control subfolder name>)
This can be changed in Central Configuration using BusinessControlsPath key located in
the “FunctionInterpreter” section (for details, see Central Configuration Documentation)
The ClickOnce application manifest should be regenerated. To do this, the Publish Apriso
Process Builder via [Link] batch file should be executed (by default this is
located in the <drive>\Program Files\Dassault Systemes\DELMIA Apriso
2021\WebSite\Downloads\ClickOnce Tools folder)
The next step requires registering the Business Control in the Component Repository
under the “Business Control” type
After successful registration, the control is ready to use
If you cannot see your control on the Business Control list when creating a new
Function, it may sometimes be required to restart the ProcessBuilder service and re-
open the PB application
Business Controls Development | DELMIA Apriso 2021 Technical Guide 34

4.4.2 Configuring the Business Control


All Business Controls are configured in DELMIA Apriso Process Builder. There is a special
type of Function designed for configuring Business Controls. To include a control in an
Operation, add a Function of the Business Control type from the Toolbox to one of its Steps.

Figure 4 Business Control function in Process Builder

For instructions on managing Steps and Functions in Process Builder, refer to Process Builder
Help.

4.4.3 The Business Control in Runtime


After releasing the Operation which includes the Business Control, Function Interpreter will
render the control using the configured properties and the current Inputs. For the user of the
Operation, using the Business Control does not differ in any way from using other Functions
configured in Process Builder.
Business Controls Development | DELMIA Apriso 2021 Technical Guide 35

5 Best Practices
5.1 Web Controls (*.ascx)
Use the full assembly name in ASCX files
Each *.ascx file contains a reference to its DLL, for example:

<%@ Control Language="c#" AutoEventWireup="false" Codebehind="[Link]"


Inherits="[Link],
[Link], Version=[Link], Culture=neutral,
PublicKeyToken=33f692327842122b"
TargetSchema="[Link]

The inherits tag should appear as “class name (with namespace), full assembly name” – this
is required if the DLL is in GAC and not in the Web application bin folder!

5.2 Shared Web Controls


Shared controls overview
During the development of the first set of Business Controls, some parts of runtime screens
were repeating more than once. That led to the creation of several [Link] controls that may
be used as parts of the new Business Control screens. Currently these are: InlineSidebar.
Using these controls is strongly encouraged whenever possible, as it prevents duplication of
the code and ensures the unified look and feel of all Business Control screens.
The controls need to be referenced in the *.ascx file, for example:

<%@ Register TagPrefix="uc1" TagName="InputOutputMapper" Src="~/[Link]" %>

The existing shared controls should be used in the following situations:


InlineSidebar
This control can be used only by runtime controls. Given the ID of the HTML control (this
control has a child of an HTML element that can contain a <table> element object), it wraps
that control’s content and displays a sidebar next to it. Check the usage of the InlineSidebar
control in the Work Instructions Business Control.

5.3 Shared Actions


When developing the Process Builder Configurator or Editor, you have to use actions for all
the Operations that change the status of an Input, Output, or Routing. Actions must be classes
that implement the IAction interface, so that they support the undo/redo functionality. This is
required because in the case of calling an undo operation for another action, the state of an
object could be inconsistent and produce an error.
Business Controls Development | DELMIA Apriso 2021 Technical Guide 36

In the [Link] namespace, there are predefined


actions which allow for manipulating Function properties. See the example list below:
AddFunctionAction
AddInputAction
AddOutputAction
AddOutputAndLinkToInputAction
AddOutputRoutingAction
ChangeFunctionTypeAction
ChangeInputDataTypeAction
CreateSVRoutingToExistingOutputAction
RemoveInputAction
RemoveOutputAction
RemoveOutputRoutingAction
ResequenceInputAction
You can either use the predefined actions or create your own actions. Using existing actions is
very simple, as in this example:

private void checkBoxEmployeeNoList_CheckedChanged(object sender, [Link] e)


{
if (this._settingControls)
return;

AddRemoveEmployeeNoInputAction action = new AddRemoveEmployeeNoInputAction(this._


editedFunction, [Link]);
[Link](action);
}

The code is calling an action that creates or removes the EmployeeNo input in a Function
based on the selected property (check box).
It is also possible to create a Composite Action that will call many other simple actions:

List<IAction> actions = new List<IAction>();


foreach (InputOutputDescriptor descriptor in this._requiredInputs)
{
if (this._editedFunction.Inputs[[Link]] == null)
[Link](new AddInputAction(this._editedFunction, [Link],
[Link], [Link]));
}
IAction addInputAction = new CompositeAction(actions);
[Link](addInputAction);

Starting the action cannot be done by just calling [Link]();, because in such a
case there will be no support for undo/redo. You have to use the
[Link](addInputAction); command to start the
execution.
Business Controls Development | DELMIA Apriso 2021 Technical Guide 37

5.4 Debugging Business Control Editor Class


If you have an editor that is a bit more complicated, you will sometimes want to debug it. The
best way to do this is to copy PB locally to the disk, and then copy the new Business Control
Editor DLL to this folder as well as the PDB file. Start PB from this folder and attach to this
Process with your Business Control solution.

It is very important to make sure that you do not have debugging the DLL in GAC. In
such a case, any changes applied in the solution will not be visible, because the DLL
is read from GAC first. That is why it is not recommended to develop a Business
Control solution on a computer which is also the DELMIA Apriso server.
Business Controls Development | DELMIA Apriso 2021 Technical Guide 38

6 References
Internal Documentation
1. Process Builder Help
Provides an overview of DELMIA Apriso Process Builder (PB) and information on installing
and using the application. This Help describes the user interface elements, entity
maintenance, available Business Controls, and management of Processes, Operations,
and Screen Flows.
2. Central Configuration Documentation
Describes in detail all the keys of the Central Configuration (CC) file for DELMIA Apriso.
Various sections group the keys for individual modules or distinct functional areas.

3DS Support Knowledge Base


If you have any additional questions or doubts not addressed in our documentation, feel free to
visit the 3DS Support Knowledge Base at [Link]

All the internal documents referenced in this section are available from the DELMIA Apriso
Start page, which can be accessed on your DELMIA Apriso server (<server name>/apriso/start).
The newest versions of all documents are available from 3DS Support at:
[Link]

Common questions

Powered by AI

The Win Configurator serves as a user control in the WinForms application within DELMIA Apriso that interacts with Business Controls. It is used in design mode to set the Business Control properties, ensuring that configuration options are tailored to specific operational needs. This integration allows for intuitively setting parameters and options for Business Controls, aiding in their seamless incorporation into processes and ensuring that they function as intended during runtime .

The three primary projects required for creating a new Business Control are: (1) Business Control Properties Project, which involves creating the properties class for both the configurator and runtime controls; (2) Business Control Runtime Project, which contains the main Business Control class and runtime-related classes for web applications; and (3) Business Control Win Editor Project, involving classes for the WinForms Editor used in the Process Builder. These projects cover the development, configuration, and runtime execution aspects of a Business Control, ensuring seamless integration and functionality across various environments .

It might not be necessary to create a WinForms Editor for a Business Control if the control only uses predefined inputs and does not require a custom configuration interface. In such cases, where user interaction configuration is not complex or fully defined at design time, the need for a specialized WinForms Editor diminishes .

The implementation of Business Controls in DELMIA Apriso is based on the assumption that all controls will be developed using Microsoft's .NET framework and ASP.NET technology. While the majority of the Business Controls are written in C#, there is support for other .NET languages. These controls are composite components that consist of multiple subcomponents, each developed according to specified rules to ensure proper functionality and behavior .

Implementing the INotifyPropertyChanged interface in the Business Control Properties class is significant because it provides a mechanism to notify the user interface of changes to property values. This dynamic data handling capability is crucial for real-time updates and allowing the Business Control to react appropriately to user interactions or database changes, ensuring that the displayed information remains accurate and up-to-date .

The primary motivation behind introducing Business Controls in the DELMIA Apriso Process Builder is to facilitate the development of UI components that can be reused across several processes and operations with minimal changes. These Business Controls offer configuration features that modify the component's outlook and behavior, allowing for the consistent display of similar functions to the end user and speeding up the development process .

The Business Control Main Class is a critical non-visual component that binds the Business Control with the DELMIA Apriso environment. It holds the information necessary for registering the control within the Business Component Repository and interfaces with configuration and runtime controls. This class validates user input data, manages inputs and outputs for Business Control functions, and executes custom logic at runtime, ensuring seamless operation and integration within the system .

When developing Business Control subcomponents, they must follow specific guidelines for ensuring proper and consistent behavior. These include implementing necessary interfaces, utilizing .NET framework standards, and adhering to the rules outlined for Business Control architecture. The subcomponents should include a Business Control Class, Win Business Control Configuration, Business Control Runtime, and optional Business Control Properties. Each must be serializable, especially when persistence in a database is required, and should implement interfaces like INotifyPropertyChanged to handle dynamic data .

Microsoft Visual Studio is recommended as the primary development environment for creating DELMIA Apriso Business Controls. It offers comprehensive support for the .NET platform, facilitating the development of controls in C# and other supported languages. This environment aids developers with tools and functionalities that streamline the coding, testing, and debugging processes .

Business Controls contribute to the consistency and speed of developing production operations by providing templates that are reusable and customizable. They are designed to work with different sets of inputs, enabling developers to ensure a consistent user interface while reducing the time spent on creating similar functions from scratch. These controls simplify the process of embedding pre-coded web forms and related business logic into various processes, thereby enhancing both development efficiency and output consistency .

You might also like