Context Object Parameters
Parameter Name | Type | Read or Write | Comments |
---|
FactType | Any EKL type | — | Type of ThisObject in the business rule body. |
ThisObject | RFLPVPMLogicalInstance |
Read | Logical element for which a physical element is computed. |
L2PPhysicalRoot | VPMReference | Read | Physical context in which search is performed. |
Output Objects
Parameter Name | Type | Read or Write | Comments |
---|
L2PListOfPhysicalElements | List | Write | List of physical elements corresponding to ThisObject . |
L2PCreateImplementLink | Boolean |
Write | Indicates if implement links are created during the synchronization. |
After the synchronization, all outputs in L2PListOfPhysicalElements
are created. The created links are based on L2PCreateImplementLink
.
Sample
The following sample illustrates how to automatically link one logical system to several electrical physical systems by listing all electrical physical systems whose V_description value contains the logical system's V_description value.
/* CATRule signature (do not edit) : (ThisObject : #In RFLVPMLogicalInstance, Parameters : #In RuleContext) : #Void */
/* Rule created by KMM1 13-May-16 */
let physRootElem(VPMReference)
let childInst(VPMInstance)
let childRef(VPMReference)
let childOcc(ProductOccurrence)
let feat (Feature)
let listChild(List)
let listAllChild (List)
let listCorrespondingPhysicals(List)
let sDescription(String)
let sDescriptionChild(String)
let sMessage(String)
let index1(Integer)
let index2(Integer)
let nbChild(Integer)
let nbChild2(Integer)
let severity(Integer)
set physRootElem = Parameters.GetAttributeObject("L2PPhysicalRoot")
set sDescription = ThisObject.V_description
if (1 <= sDescription.Length() )
{
/* List all children of physical context (L2PPhysicalRoot) which has same V_description as ThisObject*/
set listAllChild = physRootElem.Children
if(NULL <> listAllChild)
{
set sMessage = "Following physical elements are found based on description: "
set index1 = 1
for index1 while index1 <= listAllChild.Size()
{
set feat = listAllChild.GetItem(index1)
set childInst = feat
set childRef = feat
set childOcc = feat
/* Only child of type VPMReference/ VPMInstance/ ProductOccurrence are valid to link with the system. Other types e.g. Representation should be ignored */
if ( (NULL <> feat) and ( (NULL <> childInst) or (NULL <> childRef) or (NULL <> childOcc)) )
{
if(NULL <> childInst)
set childRef = childInst.Reference
else if(NULL <> childOcc)
set childRef = childOcc.Reference
if(NULL <> childRef)
{
set sDescriptionChild = childRef.V_description
if(0 <= sDescriptionChild.Search(sDescription, 0, true))
{
set severity = 0 /* If at least one physical system is found return severity = 0*/
listCorrespondingPhysicals.Append(feat)
set sMessage = sMessage + " " + feat.Name
}
set listChild = childRef.Children
if(NULL <> listChild)
{
set index2 = 1
for index2 while index2 <= listChild.Size()
{
listAllChild.Append(listChild.GetItem(index2))
}
}
}
}
}
if(0 >= listCorrespondingPhysicals.Size())
{
set severity = 1
sMessage = "Computation FAILED : None of the direct children has same description as ThisObject"
}
}
}
else
{
set severity = 2
set sMessage = "Computation FAILED : Description unset on ThisObject"
}
Parameters.SetAttributeObject("L2PListOfPhysicalElements", listCorrespondingPhysicals)
Parameters.SetAttributeBoolean("L2PCreateImplementLink", TRUE)
Parameters.SetAttributeInteger("Severity", severity)
Parameters.SetAttributeString("Message", sMessage)