Context Object Parameters
Parameter Name | Type | Read/Write | Comments |
---|
OperationId | String | Read | The operation identifier defines when the equivalences are computed:- Case (1): before the default ports mapping, to overload it (OperationId = "OverloadPortsMapping")
- Case (2): after the default ports mapping, and only for unmapped ports (OperationId = "PortMappingOnPortsWithoutEquivalence")
|
ReplacingReference | Feature | Read | The replacing functional/logical reference |
ListOfPortsReplaced | List (Feature) | Read | This parameter contains the list of functional/logical ports on the replaced reference. All ports in case (1), only ports without unique equivalence in case (2). |
ListOfPortsReplacing | List (Feature) | Read | This parameter contains the list of all the functional/logical ports on the replacing Reference. |
ListOfPortsEquivalence | List of List (Feature) | Write | This parameter is used to return the list of equivalences. It must contain a list of couples [Replaced Port, Port Equivalent]. If no equivalence found, an empty list is returned. |
IsPortsMappingOverloaded | Boolean | Write | Default value: True. This parameter is useful only in case (1), it allows you to indicate if the business logic overloads the ports mapping or not. If false, the list of equivalences must be empty and current ports mapping is called. If true, current ports mapping is not be called and only retrieved equivalences are used. |
Sample
- Case 1: Overload ports mapping
Let's implement the following rule (on the functional
domain):
- If
V_Name
attribute of the replaced reference equals MyName
,
overload the ports mapping. Replaced Port equivalent to the last
Replacing Port with same direction. - Else, ports mapping not overloaded.
To achieve this particular business logic implementation, a
.CATRuleExit file, known as family, declares the script to run every
time a replace is performed on a functional reference:
<Scripts>
<Script OpeningID="FL_Replace_PortsMapping"
Type="RFLPLMFunctionalReferenceSubType"
ScriptName="MyOverloadingPortsMappingComputationRule" >
<Condition Attribute="OperationId"
Value=" OverloadPortsMapping" />
</Script>
</Scripts>
This family tells to run the script MyOverloadingPortsMappingComputationRule
whenever a replace operation is launched on a functional reference (that have at least one port) of PLM type RFLPLMFunctionalReferenceSubType
. This script is a .CATRule file that contains the following business logic implementation:
let ReferenceReplacing(PLMEntity)
let lPortsReplaced(list)
let lPortsReplacing(list)
let lPortsEquivalence(list)
let portReplaced(RFLPLMFunctionalConnector)
let portReplacing(RFLPLMFunctionalConnector)
let portEquivalent(RFLPLMFunctionalConnector)
set ReferenceReplacing = Parameters->GetAttributeObject("ReplacingReference")
set lPortsReplaced = Parameters->GetAttributeObject("ListOfPortsReplaced")
set lPortsReplacing = Parameters->GetAttributeObject("ListOfPortsReplacing")
if (ThisObject.V_Name == "MyName") {
//Overload ports mapping
For portReplaced inside lPortsReplaced
{
set portEquivalent=NULL
For portReplacing inside lPortsReplacing
{
// If same V_Direction, set equivalent Port. Only last one kept.
if( portReplaced.V_Direction == portReplacing.V_Direction ) {
set portEquivalent=portReplacing
}
}
//If port equivalent found, add it to the equivalences list.
if( NULL <> portEquivalent) {
lPortsEquivalence.Append(List(portReplaced, portEquivalent))
}
}
Parameters->SetAttributeObject("ListOfPortsEquivalence",lPortsEquivalence)
}
else {
// Ports Mapping not overloaded
Parameters->SetAttributeBoolean("IsPortsMappingOverloaded",false)
}
When ports mapping is NOT overloaded, only
IsPortsMappingOverloaded
is returned to false
. Otherwise, the
list of found equivalences is returned (can be null
if no
equivalences found).
- Case 2: Help the current ports mapping on unmapped ports
- Let's implement the following rule (on the functional domain):
Replaced port equivalent to the last replacing port with same
direction.
Here is the corresponding .CATRuleExit file:
<Scripts>
<Script OpeningID="FL_Replace_PortsMapping"
Type="RFLPLMFunctionalReferenceSubType"
ScriptName="MyHelpingPortsMappingComputationRule" >
<Condition Attribute="OperationId"
Value="PortMappingOnPortsWithoutEquivalence" />
</Script>
</Scripts>
This family tells to run the script MyHelpingPortsMappingComputationRule whenever a replace operation is launched with a functional reference (that remains with Port(s) without unique equivalence) of PLM type RFLPLMFunctionalReferenceSubType. This script is a .CATRule file that contains the following business logic implementation:
let ReferenceReplacing(PLMEntity)
let lPortsReplaced(list)
let lPortsReplacing(list)
let lPortsEquivalence(list)
let portReplaced(RFLPLMFunctionalConnector)
let portReplacing(RFLPLMFunctionalConnector)
let portEquivalent(RFLPLMFunctionalConnector)
set ReferenceReplacing = Parameters->GetAttributeObject("ReplacingReference")
set lPortsReplaced = Parameters->GetAttributeObject("ListOfPortsReplaced")
set lPortsReplacing = Parameters->GetAttributeObject("ListOfPortsReplacing")
For portReplaced inside lPortsReplaced
{
set portEquivalent=NULL
For portReplacing inside lPortsReplacing
{
// If same V_Direction, set equivalent Port. Only last one kept.
if( portReplaced.V_Direction == portReplacing.V_Direction ) {
set portEquivalent=portReplacing
}
}
//If port equivalent found, add it to the equivalences list.
if( NULL <> portEquivalent) {
lPortsEquivalence.Append(List(portReplaced, portEquivalent))
}
}
Parameters->SetAttributeObject("ListOfPortsEquivalence",lPortsEquivalence)
As a result, the list of found equivalences is returned (can be null of no equivalences found).