Context Object Parameters
Parameter Name | Type | Read/Write | Comments |
---|
ReferencePredefinedConfiguration | Object Type |
Read | Feature: predefined configuration just selected in the drop-down list. |
CurrentRoot | Object Type | Read | Occurrence: the root for which the Business Logic must return the predefined
configuration to apply. |
CurrentRootPredefinedConfigurationList | List | Write | List of predefined configurations owned by the current root . |
Index | Integer | Write | Index corresponding to the predefined configuration to apply:
0 means no predefined configuration to apply is
found.
n means referencePredefinedConfiguration[n] is
selected for current root.
|
Message | String | Write | Error message. |
Status | Integer | Write | 0 if Business Logic is successful. |
Sample
The following sample shows how to replicate predefined configuration filters to all downstream roots.
The filter is based on predefined configuration name ReferencePredefinedConfiguration, which is taken as reference pattern. For any configuration of CurrentRootPredefinedConfigurationList, a configuration fits if the first 9 characters of its name is the same as the pattern.
Let thisFeature(Feature) /* the Reference Root Let currentRoot(Feature) /* the current Root */
Let referencePredefinedConfiguration(Feature)
let testResourceOccurrence(ResourceOccurrence)
let thisResourceOccurrence(ResourceOccurrence)
Let Index(Integer)
Let Message(String)
Let Status(Integer)
Let rank(Integer)
Let configurationItemfromList(Feature) /*used in each list do not use Feature*/
Let referencePredefinedConfigurationName(String)
Let CurrentRootPredefinedConfigurationList(List)
Let configurationName(String)
Let currentRootName(String)
Let fromIdSetAttName(String)
Let filteringPattern(String)
Set Index = 0
Set Message = ""
Set Status = -1
Set referencePredefinedConfigurationName = ""
Set currentRootName = ""
Set configurationName = ""
Set fromIdSetAttName = ""
/* In this exemple we keep configuration whose name contains filteringPattern and skip the resource */
Set thisResourceOccurrence = ThisObject
if (NULL == thisResourceOccurrence)
{
if ( true == Parameters.HasAttribute("CurrentRoot") )
{
Set currentRoot=Parameters.GetAttributeObject("CurrentRoot")
if (NULL <> currentRoot)
{
currentRootName = currentRoot.Name
Set testResourceOccurrence = currentRoot
}
}
if (NULL == testResourceOccurrence)
{
if ( true == Parameters.HasAttribute("ReferencePredefinedConfiguration") )
{
Set referencePredefinedConfiguration=Parameters.GetAttributeObject("ReferencePredefinedConfiguration")
if (NULL <> referencePredefinedConfiguration)
{
referencePredefinedConfigurationName = referencePredefinedConfiguration.Name
Message = "No configuration with the same name found on "+currentRootName
filteringPattern = referencePredefinedConfigurationName
if (referencePredefinedConfigurationName.Length()>9)
{
filteringPattern=referencePredefinedConfigurationName.Extract(0,8)
}
if ( true == Parameters.HasAttribute("CurrentRootPredefinedConfigurationList") )
{
Set CurrentRootPredefinedConfigurationList=Parameters.GetAttributeObject("CurrentRootPredefinedConfigurationList")
rank=0
if (CurrentRootPredefinedConfigurationList.Size() > 0)
{
for configurationItemfromList inside CurrentRootPredefinedConfigurationList
{
rank=rank+1
if (NULL <> configurationItemfromList)
{
configurationName = configurationItemfromList.Name
if(0 <= configurationName.Search(filteringPattern, 0, true))
{
Index=rank
Message = ""
Status=0
}
}
}
}
}
}
}
}
else
{
Message = "No modification applied to resource node "+currentRootName
}
}
else
{
Message = "Modification on resource node "+currentRootName+" not considered"
}
if ( true == Parameters.HasAttribute("Index") )
{
Parameters.SetAttributeInteger ("Index" , Index)
}
if ( true == Parameters.HasAttribute("Message") )
{
Parameters.SetAttributeString ("Message" , Message)
}
if ( true == Parameters.HasAttribute("Status") )
{
Parameters.SetAttributeInteger ("Status" , Status)
}