OpcenterEXFN ExtensibilityGuide
OpcenterEXFN ExtensibilityGuide
Extensibility Guide
04/2021
PL20201124062203470
Guidelines
This manual contains notes of varying importance that should be read with care; i.e.:
Important:
Highlights key information on handling the product, the product itself or to a particular part of the documentation.
Note: Provides supplementary information regarding handling the product, the product itself or a specific part of
the documentation.
Trademarks
All names identified by ® are registered trademarks of Siemens AG.
The remaining trademarks in this publication may be trademarks whose use by third parties for their own purposes
could violate the rights of the owner.
Disclaimer of Liability
We have reviewed the contents of this publication to ensure consistency with the hardware and software
described. Since variance cannot be precluded entirely, we cannot guarantee full consistency. However, the
information in this publication is reviewed regularly and any necessary corrections are included in subsequent
editions.
Security information
Siemens provides products and solutions with industrial security functions that support the secure operation of
plants, systems, machines and networks. In order to protect plants, systems, machines and networks against
cyber threats, it is necessary to implement – and continuously maintain – a holistic, state-of-the-art industrial
security concept. Siemens’ products and solutions only form one element of such a concept.
Customer is responsible to prevent unauthorized access to its plants, systems, machines and networks. Systems,
machines and components should only be connected to the enterprise network or the internet if and to the extent
necessary and with appropriate security measures (e.g. use of firewalls and network segmentation) in place.
Additionally, Siemens’ guidance on appropriate security measures should be taken into account. For more
information about industrial security, please visit https://www.siemens.com/industrialsecurity.
Siemens’ products and solutions undergo continuous development to make them more secure. Siemens strongly
recommends to apply product updates as soon as available and to always use the latest product versions. Use of
product versions that are no longer supported, and failure to apply latest updates may increase customer’s
exposure to cyber threats.
To stay informed about product updates, subscribe to the Siemens Industrial Security RSS Feed under https://
www.siemens.com/industrialsecurity.
Revision PL20201124062203470
State Published
Author Siemens AG
Language en-US
Functional Blocks
Foundation Functional Blocks can be found at Overview of Functional Blocks in the Opcenter Execution
Foundation Development and Configuration Guide.
Entities and Facets Define the static Data Model, deciding the degree of independence you need to
give to your model participants and the relationships among them.
Command Handlers Define the way the database or external systems will be changed according to a
request.
UI Applications Define how the solution will be available to a group of user, choosing the right
User Interfaces that Apps make available.
Process Definitions Author a Business Process, deciding how Task Types must be orchestrated.
Signal App Provides the environment where it is possible to manage Signal Rules
representing a one-to-one relationship between a trigger and the logic that must
be activated.
Programmable Artifacts are not static, but rather, are conceived to be expanded, thanks to elements coming from
different Functional Blocks. They apply to specific contexts and adopt a variety of extensibility techniques.
Extensibility Techniques
Programmable Extensibility Applicability
Artifact Technique
Entities and Facet Use a Facet when you want to extend an entity with properties that
Relationships are relevant to a specific technological field.
Facets do not support relationships to single instances ("to-1"
relationships).
Entity as Facet Use an entity in a "1-to-1" relationship with the base entity when
you need to establish "to-1" relationships with other entities
("1-to-1")
(belonging to the same logic domain) in order to enforce their
relationships.
Child Entity Use a Child Entity when you are need to add a "1-to-many"
relationship between the base entity and a list of one or more
("1-to-many")
items.
Command Post-Action Adopt Post-Actions when you want to extend Command Handlers
Handlers with a transactional continuation in another technological field.
Post-Actions accept the same input parameters as the command to
which they are attached and cannot change the command's
output: however, they can make the command fail transactionally.
It is possible to sort Post-Actions and to disable them according to
the needs of your business logic, provided that they are not
mandatory.
Pre-Check Adopt Pre-Checks when you realize that you have constraints from
a different technological field that make using the base command
inapplicable or forbidden.
Pre-Checks cannot change entities, call commands and fire events,
they can just access the reading model.
Although not essential to your business logic, it is possible to sort
Pre-Checks to improve performance. You can also disable one or
more Pre-Checks, according to your needs.
Model-Driven User Model-Driven User If you do not need to customize the master page of an MDUI, you
Interfaces Interface Extension can extend it by implementing an extension that will show
additional data. In addition, you can add custom commands to the
command bar both in Master pages and Master and Detail screens.
There exist common situations in which Extensibility is not feasible: in such cases, you must resort to implementing
new artifacts either from scratch or from the copy of an existing artifact.
Fine A specific functionality: in this case, the existing artifacts and behaviors
are typically customized or extended. Typically, this is achieved by
extending an existing Functional Block or creating a new one.
Intermediate An entire use case: According to the business needs, the authoring of
Signal Rules, Business Process Flows, Task Types and Mashups could be
involved.
General The complete solution: in this case, one or more UI Applications must be
configured, along with any other solution relevant configurations (such
as for example, the definition of the user access rights, database
maintenance, audit trails, and so on) to make the Apps and
functionalities available and the toggling of the handlers present at the
lower levels are involved.
Workflow
In all cases listed above, you must:
1. Design your extension domain accurately.
2. Create and implement a new Functional Block according to the following workflow:
Note In the modeling phase, you may have to decide which technique to use.
3. Create and implement a new custom App according to the following workflow:
4. If you need to further customize the new custom App without having the source solution, create and implement
the related Extension App.
For more information, see How to Develop a Manufacturing Use Case (App) in the Opcenter Execution
Foundation Development and Configuration Guide.
contains the runtime instances. For a detailed explanation, see the Data Model Domains in the Opcenter Execution
Foundation Development and Configuration Guide.
In this case, you must be aware of the structure of the artifacts involved in the functionality and how they can be
extended.
Opcenter Execution Foundation comes with a set of different Functional Blocks that are packaged into several
Apps. Each Functional Block contains the back-end functionality to provide a basic benefit, whereas Apps group the
Functional Blocks and User Interfaces necessary to provide a specific business benefit to a set of business scenarios.
The User Interfaces contained inside an App can be grouped to form a UI App. In this way, User Interfaces can be
offered to a specific final user.
• Pre-Check configurations
• Event Handler subscriptions
• Post-Action configurations
Terminology
We refer to the composition pattern as the daisy extension paradigm or daisy pattern to avoid an overly
abused term and to immediately evoke the concept according to which components are combined.
The daisy extension paradigm has been chosen because it offers more freedom in combining extensions coming
from a vast catalog, while maintaining the possibility to receive updates and fixes of the central components.
The daisy extension paradigm is characterized by having one level of depth: all extensions must be attached to the
central structure.
The disk-petal relationship involves different objects in Opcenter Execution Foundation:
• An App can be extended by one level of Extension Apps.
• Entities can be extended by one level of Facets.
• Public Command Handlers can be extended by one level of Pre-Checks.
• Command Handlers can be extended by one level of Post-actions.
• MDUIs can be extended by one level of MDUI Extensions.
Information
Using Solution Studio, you can disable and sort Pre-Checks and Post-Actions.
Workflow
1. In Opcenter Execution Foundation Project Studio, create a new Functional Block that belongs to the same
domain as the Functional Block you want to extend.
2. Reference the product Functional Block from the Functional Block you have just created.
3. If necessary, reference the new Functional Block to other Functional Blocks.
4. In the Model project, define the artifacts (entities, commands, events, types and/or facets) necessary to
implement the logical and physical extension of the manufacturing functionality:
• Add properties to entities when the provided entities do not possess the properties you require.
5. Build your Model.
6. In the CommandHandler project, implement the logic to be executed by adopting one or more of the following
techniques:
• Extend command applicability when the provided commands cannot be applied to all the required cases
(that is, there are Pre-Checks blocking them).
• Extend command behavior when the provided commands are unable to change all the required entities
(that is, they need to modify more entities or trigger more actions).
• Restrict command applicability when the provided commands can be applied to more cases than
required (that is, you want your Pre-Check to block them).
• Restrict command behavior when the provided commands change more entities than required (that is,
they need to modify less entities or trigger less actions).
7. Configure and then generate the Functional Block package: the new Functional Block is ready to be included in
your App (or Extension App).
Constraints
In the following cases, Facets cannot be used:
• When your extension is not a single extension, but, rather, a list of related instances. In this case, it is
recommended that you use an entity linked to the existing entity (see Extension2 in the figure) by means of
composition. The logical key of the parent entity will be inherited from the child entity with the addition of the
local discriminator (in the figure, Base.NId with Extension2.LocalNId). For example, in Opcenter Execution
Foundation, AMPowderBatchGenalogy is a child entity for DM_MaterialTrackingUnit.
• When you need to establish an enforced "use" relationship with a Catalog instance (see Extension3 in the
figure), you may consider adding the new properties to an entity, rather than to a facet. For example, in
Opcenter Execution Foundation, DM_Material is modeled as an entity instead of a facet to be able to refer to
Functional Codes and Material Classes
• In this case, always bear in mind to handle the extension entity as if it were a facet: in particular, no field is to be
included as part of the logical key (so you will be implementing a ‘1-to-1’ relationship with the base entity) and
the extension entity must not be used in the "1" end of relationships with other entities.
If a command structure contains Pre-Checks, you can disable one or more of them in the Extension App at hand that
contains the command to which they refer: in this case, the Extension App's requirements will be less restrictive.
For further information on Pre-Check management, see Configuring Business Logic from Solution Studio.
Besides using FireEventOnCommit to allow Event Continuation in case of commit, you can fire a compensation
event using the FireEvent before returning an Execution Error to the main command chain to allow your
subscribers to be notified and compensate with appropriate measures.
Aggregate Properties
There are common cases, known as Aggregate Properties, in which a property of an entity at a higher level must be
changed after a change at a lower level: however, keep in mind that such cases do not always result in the changing
of the property of the higher-level entity.
For example, you may need to change the status of a Work Order depending on the status of its Work Order
Operations.
In this case, you need to adopt Event Continuation to be sure that the committed status of all concurrent
transactions at the lower level be read at least once.
Transaction Isolation
Opcenter Execution Foundation works using an Optimistic Snapshot Isolation Level: transactions are not
enqueued, but executed simultaneously.
A snapshot of the system at the beginning of the transaction is taken and, if any other transaction has
modified the system at the commit instant, the current transaction will be immediately re-attempted.
Event Handlers and Signal Rules are not run in a single transaction. Therefore, their queries tend to read
data while being modified by another transaction. As a result, Event Handlers and Signal Rules may base
their decisions on uncommitted data.
The correct approach is to box decisions inside command handlers.
Designing a variety of modular Apps and Functional Blocks allows you to install just the artifacts you require: for
instance, if you do not refer a Functional Block from any of the installed Apps, the Pre-Checks, Post-Actions and
Event Handlers contained in the Functional Block will not be run in your solution.
To modify the behavior of a Command safely, you must refer to its internal structure to locate the sections that
must be suppressed and, depending on their type, you can make the appropriate changes.
Pre-Check If you want to disable a Pre-Check, you are extending the applicability of a command.
Pre-Execution None of the command's main sections can be disabled, but sometimes they can be undone
with an opposite command called in a Post-Action: note that all events will be fired at the
end of the entire transaction.
Sub-Command
Post-Execution
Post-Action Post-Actions are enabled when their Functional Block is loaded, but you can still disable
them, provided that they are not mandatory. For detailed information see Modeling Post-
Actions section in the Opcenter Execution Foundation Development and Configuration Guide.
In some cases, operating in Solution Studio, you can disable Event Handlers or change their subscriptions. If
subscriptions are created as default subscriptions, you cannot disable them, but only detach them from the worker
role.
Icon Meaning
Suggested
Forbidden
To be considered
To be avoided
Operation Do's/Don'ts
CONSIDER sizing Functional Blocks so they can be plugged into as many scenarios as possible.
Imagine a set of real or fictitious scenarios where your Functional Blocks might be used (for
example, Aerospace, Repetitive, One-Piece-Flow, Formulation, Process) and think of the possible
combinations in which using the Functional Block can come in handy, as well as those in which it
can be left out. You should maximize the number of meaningful combinations and reduce the
overall number of Functional Blocks to a minimum.
For example, the Process Flow Control Functional Block manages process milestones for
Material Tracking Units belonging to different Materials: typical examples are vehicles in the
Automotive industry and sublots of bulk materials in the Composite Material industry. Keeping
such possible generalizations in mind makes it easier to group the artifacts belonging to the
Functional Block in a manner so that they are more reusable.
Operation Do's/Don'ts
CONSIDER isolating the most particular, complex or unstable units of code in a distinct
Functional Block to facilitate their replacement and maintenance.
Sometimes, during the lifecycle of a project, it is necessary to integrate with subsystems that are
susceptible to change or instability. By wrapping these subsystems into dedicated Functional
Blocks, any possible side effects of this instability are potentially thwarted, because the
subsystems are not contained in Functional Blocks the contents of which are of more ample use.
Said subsystems can be a native part of your solution or injected.
CONSIDER designing a Functional Block with the same boundaries as those of the base when
you are extending artifacts from the Master Data Domain.
CONSIDER designing a Functional Block limited to a specific technological subject when you
are extending artifacts from the Operational Domain.
The simplest choice for organizing your extension artifacts (in particular, Facets, Relationships,
Post-Actions, Pre-Checks and DB-Init files) is to define your Functional Block with the same
extent as the base Functional Block.
AVOID creating a Functional Block from scratch if you can start from an existing one.
Evaluate if you can extend an existing generic entity, rather than creating your own main entities.
Icon Meaning
Suggested
Forbidden
To be considered
To be avoided
Operation Do's/
Don'ts
DO use physical extensions when all basic data-manipulation commands (such as Create, Update,
Delete: CrUD) and the User Interfaces use an existing entity structure for which a completely new
behavior is implemented. For more information, see the Opcenter Execution Foundation Product
Overview.
For example, in structural terms, Functional Code (for example, "steering wheel") is a Material
Group, but it participates in other relationships and works in a different way than in the Material
Group. This makes it easier for you to comprehend the database model.
DO adopt loose relationships (that is, relationships implemented on logical keys and not enforced
by a physical foreign key) not only when crossing a horizontal domain (for example, between
Operational and Master Data), but also when crossing a vertical domain boundary that you may
not require in your functionalities. Postpone consistency checks between domains to the last
opportune moment.
For example, if you are defining a whitelist of materials that are compatible with a section of your
process, you are dealing with a formulation or regulatory domain, and not with a procurement
domain: the business logic involving the whitelist will not be concerned whether a Material
Definition exists in the system, until some operational domain actually calls for it.
The benefits of this well-established Domain-Driven Design approach are:
• Greater modularity (more possibilities to combine/couple/decouple) that can be fine-tuned by
typically using Pre-Checks if coupling is required by the final industrial processes.
• Better comprehension from the final user's standpoint: for example, when functionalities rely
on internal relationships that are not clear from a functional perspective (for example, export).
• The possibility of Data Maintenance without being blocked by unnecessary relationships.
DON'T append facets or entities to other facets or entities used for extension to implement a "1-
to-many" relationship: append them directly to the central entity.
If possible, avoid making functionalities on your child entities depend on facets or other child
entities: at least provide a default behavior in case the facets you require do not exist.
DON'T create two instances of the same facet type on the same record.
Always keep a "1-to-1" relationship per facet type between central entity and facet.
You cannot define keys on facets, so it is impossible to uniquely identify facets of the same type.
When you need to add children to an existing entity, use entities and link them with composition
to the parent entity.
Operation Do's/
Don'ts
CONSIDER using an entity instead of a facet when you foresee performance issues.
Always treat entities used for extension as if they were facets: do not attach other entities or facets
to them, but to their central entity.
CONSIDER using an entity instead of a facet when you need to refer to entities with a "to-1"
enforced relationship.
Always treat entities used for extension as if they were facets: do not attach other entities or facets
to them, but to their central entity.
CONSIDER denormalizing the logical keys of referenced entities inside the facet to improve
performance.
Use Post-Actions to synchronize this information. Also consider adopting custom views to
optimize frequently-used queries.
CONSIDER using Custom Views for accessing relational data in the Database. Reading Functions
remain the only viable technique to access non-relational data.
CONSIDER adopting Event Orchestration for complex use cases (where for example data
manipulation is required) and use Signal Rules for simple event-based use cases.
AVOID fragmenting too much your model: when you do not foresee an independent usage of
several small facets.
Try to group very granular functionalities that rely on just a few properties, particularly if you
expect them to work together.
Use Custom Views to group together the facets that are involved in the same business logics.
AVOID using too much Property, Parameter or User Field entities ("unpivoted properties"), in
particular in the Operational Domain.
Be aware that entities containing unpivoted properties are bad for performance and poorly
managed by User Interfaces.
Use them only to contain descriptive fields that are used in Reference or Master Data Domain.
For more information, see the Best Practices for Software Development section in the Opcenter Execution
Foundation Development and Configuration Guide.
Customization at this level requires using Opcenter Execution Foundation Project Studio, either for
implementing Business Logic or for developing specific Task Transitions.
Toggling Pre-Checks
In Solution Studio, you can enable or disable Pre-Checks, as well as change their execution order.
Pre-Check behavior can be set in Solution Studio by choosing either of the following behaviors: Stop at first fail or
Fail and proceed:
• If the Stop at first fail is set, the Pre-Check execution stops at the first Pre-Check failure and all the subsequent
Pre-Checks are stopped.
• If the Fail and proceed is set, all Pre-Checks will be executed anyway regardless of the result of the preceding
Pre-Checks.
In both cases, the command will be executed only after the success of all Pre-Checks.
For details, see Configuring Command Settings in the Opcenter Execution Foundation Development and
Configuration Guide.
Toggling Post-Actions
In Solution Studio, you can enable or disable Post-Actions, as well as change their execution order. The toggling in
Solution Studio is allowed only if you have defined them as Optional in Project Studio.
For details, see Configuring Command Settings in the Opcenter Execution Foundation Development and
Configuration Guide.