How to Implement the Flow/Type Association Check Business Logic? |
Technical Article |
AbstractThis article details how you can implement the Flow/Type Association Check Business Logic based on the knowledge scripting technology. |
The flow/type association check business logic allows you to define rules that are taken into account everytime a flow/type is about to be associated to a port, to actually continue or cancel this operation.
The flow/type association operation means:
Let's illustrate this pattern with the following figure (in the logical domain):
This business logic is launched everytime an interactive command or a programming interface (API) triggers an operation of flow/type association to a port.
The business logic behavior is illustrated below (with the logical domain):
This section describes the objects defining the PLM opening: its global information, its kind of input object, its context object parameters. These concepts are detailed in the PLM Customization by Rules documentation [1].
PLM Opening ID | FLTypeAssociationCheck |
---|---|
Customization Intent | Validation |
Execution Context | Client |
The validation nature of this business logic implies that the operation is actually performed if and only if every associated rule that is a candidate for execution within the context of this operation grants permission to do so.
The Business Logic can be invoked for at least the listed PLM Component Type. It means that your implementation can safely use the PLM attributes of the default PLM Component.
PLM Component Class Types |
---|
RFLPLMFunctionalConnector |
RFLVPMLogicalPort |
Since the Knowledge scripting technology supports inheritance, the actual component type may be any type that derives from theses two PLM Core types. Hence additional attributes defined by the inheriting types may be accessed depending on the context of the operation.
Parameter Names | Types | Read/Write | Comments |
---|---|---|---|
TypeToAssociate | PLMEntity | Read | Flow/type reference to associate to the port. |
AggregatingReference | PLMEntity | Read | Functional/logical reference aggregating the port. |
The figure below illustrates the different parameters:
Let's implement the following rule (on the logical domain): the logical type can be associated to a logical port only if both objects share the same value of a custom attribute named 'Segregation' (defined on the PLM type RFLVPMLogicalCustomizedPort).
To achieve this particular business logic implementation, a CATRuleExit file, known as family, declares the script to run everytime a logical type is about to be associated to a logical port:
<Scripts> <Script OpeningID="FLTypeAssociationCheck" Type="RFLVPLMLogicalCustomizedPort" ScriptName="CATMyFirstTypeAssociationCheckRule" /> </Scripts>
This family tells to run the script CATMyFirstTypeAssociationCheckRule whenever a flow/type association to a port operation is launched with a logical port of PLM type RFLVPMLogicalCustomizedPort. This script is a CATRule file that contains the following business logic implementation:
let TypeToAssociate(PLMEntity) let AggregatingReference(PLMEntity) set TypeToAssociate = Parameters->GetAttributeObject("TypeToAssociate") set AggregatingReference = Parameters->GetAttributeObject("AggregatingReference") if (TypeToAssociate.GetAttributeString("Segregation") == ThisObject.GetAttributeString("Segregation")) { Validation = true } else { Validation = false } if (Validation == false) { Parameters.Message = "The logical type '" + TypeToAssociate.Name + "' failed to be associated to a logical port of '" + AggregatingReference.Name + "' reference because the defined segregations are different." }
Since this is a check purpose business logic, the Validation variable must be valuated during the script execution to return the check result.
The reader can refer to the PLM Customization by Rules documentation [1] to get more insights regarding the writting and the delivery of these files.
None
[1] |
Version: 1 [December 2008] | Document created |