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 system in which the business rule is executed. |
L2PListLogicalRoutables | List | Read | List of logical routables aggregated in a logical system. |
L2PListCompatibleFathers | List | Read | List of compatible electrical physical systems. |
Output Objects
Parameter Name | Type | Read or Write | Comments |
---|
L2PListofPhysicalFathers | List |
Write | List of physical parents computed for creation corresponding to logical routables in L2PListLogicalRoutables |
Notes:
- If the size of
L2PListLogicalRoutables
and L2PListofPhysicalFathers
are different, the output list is ignored. - If you enter a
NULL
value in one of the output lists (<name of output list>), the first L2PListCompatibleFathers
parameter is accounted for.
Sample
The following sample illustrates how to compute the parent for placing a routable, using V_description attribute as criteria. The conductor corresponding to the logical routable is placed in the electrical physical system which has the same V_description attribute.
/* CATRule signature (do not edit) : (ThisObject : #In RFLVPMLogicalInstance, Parameters : #In RuleContext) : #Void */
/* Rule created by KMM1 13-May-16 */
let listCompatibleFathers(LIST)
let listRoutables(LIST)
let listComputedFathers (LIST)
let listComputedFatherDescription (LIST)
let occ (ProductOccurrence)
let inst (VPMInstance)
let ref (VPMReference)
let feat (Feature)
let featFather (Feature)
let occLog (LogicalOccurrence)
let instLog (RFLVPMLogicalInstance)
let refLog (RFLVPMLogicalReference)
let index (INTEGER)
let size (INTEGER)
let pos (INTEGER)
let severity (INTEGER)
let sDesc (STRING)
let sMessage1 (STRING)
let sMessage2 (STRING)
let sMessage (STRING)
set severity =2
set listRoutables = Parameters.GetAttributeObject("L2PListLogicalRoutables" )
set listCompatibleFathers = Parameters.GetAttributeObject("L2PListCompatibleFathers")
if( (NULL <> listRoutables) and (1 <= listRoutables.Size()) )
{
if( (NULL == listCompatibleFathers) or (0 >= listCompatibleFathers.Size()) )
{
set sMessage = "Computation Failed: List of compatible fathers is invalid"
}
else // Create list of descriptions of all compatible parents
{
set size = listCompatibleFathers.Size()
set index = 1
for index while index <= size
{
set sDesc = ""
set feat = listCompatibleFathers.GetItem(index)
set occ = feat
set inst = feat
set ref = feat
if(NULL <> occ)
set ref = occ.Reference
else if(NULL <> inst)
set ref = inst.Reference
if(NULL <> ref)
{
set sDesc = ref.V_description
}
listComputedFatherDescription.Append(sDesc)
}
/* if the description list is created, for each routable find description and create list father */
/* NOTE: The criteria could be anything in the rule*/
set sMessage = "Computation failed"
if(size == listComputedFatherDescription.Size())
{
sMessage1 = "Parent with compatible description value NOT found for : "
sMessage2 = "Parent with compatible description value found for : "
set size = listRoutables.Size()
set index = 1
for index while index <= size
{
set sDesc = ""
set pos = 0
set feat = listRoutables.GetItem(index)
set occLog = feat
set instLog = feat
set refLog = feat
if(NULL <> occLog)
set refLog = occLog.Reference
else if(NULL <> instLog)
set refLog = instLog.Reference
if(NULL <> refLog)
{
set sDesc = refLog.V_description
if(1 <= sDesc.Length())
set pos = listComputedFatherDescription.IndexOf(sDesc, 1)
}
/* If description is unset or father with same description is not found in compatible list, return the routable itself (wrong element) */
/* This will force L2P to set default parent - NOTE this is only for test purpose*/
set featFather = feat
if(0 == pos)
{
set sMessage1 = sMessage1 + feat.Name + " "
}
else
{
set featFather = listCompatibleFathers.GetItem(pos)
set sMessage2 = sMessage2 + feat.Name + " "
}
listComputedFathers.Append(featFather)
}
set sMessage = sMessage1 + "|" + sMessage2
set severity = 0
}
}
}
else
{
set sMessage = "Computation failed: Routable list is invalid"
}
Parameters.SetAttributeObject("L2PListofPhysicalFathers", listComputedFathers)
Parameters.SetAttributeInteger("Severity", severity)
Parameters.SetAttributeString("Message", sMessage)