Sometimes we are interested in total number of the objects in our implementation. We can easily go to debug page and see the total number at the bottom right of the debug page.
However, with this rule we can get all of the object numbers at a glance!
This rule can be imported from import from files and can be run either from debug page or from iiq console. It returns a map of the object name and total object numbers. It also prints the information in standard out. Here is the rule.
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE Rule PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<Rule language="beanshell" name="Object Count">
<Signature returnType="Object"/>
<Source>
import sailpoint.object.*;
import java.util.Map;
import java.util.HashMap;
// CSV of all independent objects in 6.4
String classNames="AccountGroup,ActivityDataSource,Application,ApplicationActivity,ApplicationScorecard,AuditConfig,AuditEvent,AuthenticationQuestion,BatchRequest,Bundle,BundleArchive,Capability,Category,Certification,CertificationArchive,CertificationDefinition,CertificationGroup,Configuration,CorrelationConfig,Custom,DashboardContent,DashboardLayout,DatabaseVersion,Dictionary,DynamicScope,EmailTemplate,Form,FullTextIndex,GroupDefinition,GroupFactory,GroupIndex,Identity,IdentityArchive,IdentityDashboard,IdentityEntitlement,IdentityHistoryItem,IdentityRequest,IdentitySnapshot,IdentityTrigger,IntegrationConfig,JasperResult,JasperTemplate,LocalizedAttribute,ManagedAttribute,MessageTemplate,MiningConfig,MitigationExpiration,ObjectConfig,PasswordPolicy,Policy,PolicyViolation,Process,ProcessLog,Profile,ProvisioningRequest,QuickLink,Request,RequestDefinition,ResourceEvent,RightConfig,RoleChangeEvent,RoleIndex,RoleMetadata,RoleMiningResult,RoleScorecard,Rule,RuleRegistry,SPRight,Scope,ScoreConfig,Scorecard,Server,ServiceDefinition,ServiceStatus,SyslogEvent,Target,TargetAssociation,TargetSource,TaskDefinition,TaskResult,TaskSchedule,TimePeriod,UIConfig,UIPreferences,WorkItem,WorkItemArchive,Workflow,WorkflowCase,WorkflowRegistry,WorkflowTestSuite,Workgroup";
//In 7.0 QuickLinkOptions is an independent object, so it's added here for 7.0
//String classNames="AccountGroup,ActivityDataSource,Application,ApplicationActivity,ApplicationScorecard,AuditConfig,AuditEvent,AuthenticationQuestion,BatchRequest,Bundle,BundleArchive,Capability,Category,Certification,CertificationArchive,CertificationDefinition,CertificationGroup,Configuration,CorrelationConfig,Custom,DashboardContent,DashboardLayout,DatabaseVersion,Dictionary,DynamicScope,EmailTemplate,Form,FullTextIndex,GroupDefinition,GroupFactory,GroupIndex,Identity,IdentityArchive,IdentityDashboard,IdentityEntitlement,IdentityHistoryItem,IdentityRequest,IdentitySnapshot,IdentityTrigger,IntegrationConfig,JasperResult,JasperTemplate,LocalizedAttribute,ManagedAttribute,MessageTemplate,MiningConfig,MitigationExpiration,ObjectConfig,PasswordPolicy,Policy,PolicyViolation,Process,ProcessLog,Profile,ProvisioningRequest,QuickLink,QuickLinkOptions,Request,RequestDefinition,ResourceEvent,RightConfig,RoleChangeEvent,RoleIndex,RoleMetadata,RoleMiningResult,RoleScorecard,Rule,RuleRegistry,SPRight,Scope,ScoreConfig,Scorecard,Server,ServiceDefinition,ServiceStatus,SyslogEvent,Target,TargetAssociation,TargetSource,TaskDefinition,TaskResult,TaskSchedule,TimePeriod,UIConfig,UIPreferences,Widget,WorkItem,WorkItemArchive,Workflow,WorkflowCase,WorkflowRegistry,WorkflowTestSuite,Workgroup";
//Making array from CSV
String[] classes = classNames.split(",");
// defining a map to return the object name and counts;
Map map=new HashMap();
//iterating all objects
for(String clas: classes ){
int count;
//For Workgroup object, it's Identity, so filtering Identity with workgroup true
if(clas.equals("Workgroup")){
QueryOptions qo = new QueryOptions();
qo.addFilter(Filter.eq("workgroup", true));
//counting objects
count=context.countObjects (Identity.class, qo);
}
else{
//getting class from string
Class className = Class.forName("sailpoint.object." + clas);
//counting obhects
count=context.countObjects (className, null);
}
// Standard out
System.out.println(clas + ": " + String.valueOf(count));
//adding to map
map.put(clas, count);
}
return map;
</Source>
</Rule>