Situation
Case 1: Dot Net: Dashboard shows violations for the rule Avoid cyclical calls and inheritances between namespaces content. Need to understand the details of cyclic calls in Enlighten.
Case 2: J2EE: Dashboard shows violations for the rule Avoid cyclical calls and inheritances between packages content. Need to understand the details of cyclic calls in Enlighten
Expectation
Identify cyclical calls in Enlighten
Figure 1
Figure 2
Release | Yes/No |
---|---|
8.3.x | |
8.2.x | |
8.1.x | |
8.0.x | |
7.3.x | |
7.2.x | |
7.0.x |
RDBMS | Yes/No |
---|---|
Oracle Server | |
Microsoft SQL Server | |
CSS2 |
Steps
- Launch Enlighten and select corresponding LOCAL base
- Launch dashboard from CAST MS and navigate to Investigation View. Please click on the violating rule "Avoid cyclical calls and inheritances between namespaces content" (Hightlighted and marked as 1 in below image)
- In the "OBJECTS WITH VIOLATION" section,List of objects violating the rule will be displayed. We need to identify which of these objects are involved in cyclical calls.
- Click on the first object name (Highlighted and marked as 2 in below image)
In the "OBJECT DETAILS" tab, Right Click on the displayed object name and open it in new tab (Highlighted and marked as 3 in below image)
- The object's URL will display object # (Highlighted and marked as 4 in below image), which is OBJECTID. To identify the next object in cyclical call, we need to run few queries on central database. So launch respective query browser
- We need to identify SNAPSHOT ID and METRIC ID, which is required to identify the next object in cyclical call
To identify METRICID, run this query
select metric_id from dss_metric_types where metric_name = 'Avoid cyclical calls and inheritances between namespaces content'
Note: For java Metric is :'Avoid cyclical calls and inheritances between packages content'
To identify SNAPSHOTID, run this query
select snapshot_id from dss_metric_results where object_id = OBJECTID and metric_id = (METRICID+1).
Choose the SNAPSHOTID from the displayed list
After collecting OBJECTID, METRICID, SNAPSHOTID, run this query
Select dos1.object_id as cur_namespace_id, dos1.object_full_name as cur_namespace_name, dos2.object_id as next_namespace_id, dos2.object_full_name as next_namespace_name from dss_metric_results dmr join dss_objects dos1 on dos1.object_id = dmr.object_id join dss_objects dos2 on dos2.object_id = dmr.metric_object_id where dmr.metric_id = (METRICID+1)and dmr.object_id = (OBJECTID)and dmr.snapshot_id = (SNAPSHOTID).
- Above query will output cur_namespace_id,cur_namespace_name, next_namespace_id and next_namespace_name. Please note down the result values
- In Enlighten, from the Object Browser, select the project, right click and open "Find object in Browser"
- Search for the value of cur_namespace_name. It will be displayed in Result section. Add it to Enlighten View
- Search for the value of next_namespace_name. It will be displayed in Result section. Add it to Enlighten View. An escalated link will be formed between the two objects
- To search for the next object in cyclical call, we have next OBJECTID, which is the value of next_namespace_id. Use the value as OBJECTID in (b) query and repeat (c),(d),(e) and (f) until a cyclical link is formed (refer image in Expectation Section)
- We need to identify SNAPSHOT ID and METRIC ID, which is required to identify the next object in cyclical call
Figure 3
Alternate & Quick Solution
- Launch Dashboard
- Go to Investigation - Application Drilldown view
- Select the target application from LHS
- Select "BY VIOLATION" tab on RHS
- in the "BY VIOLATION" tab, Sort the list by "Rule Name"
From the sorted list, navigate to the section having rule "Avoid cyclical calls and inheritances between namespaces content"
- From this subset of list,Take the first Object Name violating the rule. Search it in Enlighten and add in its view
- Now Select the object name (that you added in enlighten view) from the subset list . This will display "Violation Details" at the bottom of the page
- In the "Violation Details" section, there is a sub section "Cyclically called / inherited Package full name"
- The object name displayed under this sub section is the next object in the cyclical call, violating the rule
- Search for this object name in Enlighten and add it in view
- Repeat Steps 8 - 11 until you see an escalated link between objects in Enlighten that form a cyclical call
Additional Tips for Finding the Cycle in Cases of .NET Namespaces
- .NET Namespaces can have sub-namespaces that can be involved in a cycle.
- If there are interconnections between the namespaces then sub-namespaces may have a cycle with other namespaces that are still part of the parent so that the queries above may indicate a cycle between the parent and a sub-namespace.
- For example, in the screenshot below the queries above indicated a cylcle between the Parent A and the Child 1. The screenshot does show a cycle between these as Child 2 (which is part of Parent A) calls Child 1, and Child 1 calls Child 3 (which is part of Parent A as well):
- .NET Namespaces can also have there only procedures that are also involved with sub-namespaces in a cylce
- For exmaple, in the screenshot below the queries above indicated a cycle between Parent A and Child 1. The screenshot below shows a cycle between these as Proc 1 (which is part of Parent A) calls Child 1, and Child 1 calls Child 2 (which is part of Parent A as well):
- For exmaple, in the screenshot below the queries above indicated a cycle between Parent A and Child 1. The screenshot below shows a cycle between these as Proc 1 (which is part of Parent A) calls Child 1, and Child 1 calls Child 2 (which is part of Parent A as well):