Showing posts with label Custom Reports. Show all posts
Showing posts with label Custom Reports. Show all posts

Thursday, November 16, 2023

Applications Health Check Report

 <?xml version='1.0' encoding='UTF-8'?>

<!DOCTYPE TaskDefinition PUBLIC "sailpoint.dtd" "sailpoint.dtd">

<TaskDefinition executor="sailpoint.reporting.LiveReportExecutor"  name="Application-Test Connection-Report" progressMode="Percentage" resultAction="Rename" subType="Configured Resource Reports" template="true" type="LiveReport">

  <Attributes>

    <Map>

      <entry key="report">

        <value>

          <LiveReport title="Applications Detail Report">

            <DataSource objectType="Application" type="Filter">

              <QueryParameters>

                <Parameter argument="applications" property="id"/>

              </QueryParameters>

            </DataSource>

            <Columns>

              <ReportColumnConfig field="application" header="rept_app_grid_col_app" property="name" sortable="true" width="110"/>

              <ReportColumnConfig field="connectionStatus" header="Connection Status" property="id" sortable="true" width="110">

                <RenderScript>

                  <Source>


                    import sailpoint.connector.Connector;


                    import sailpoint.connector.ConnectorFactory;


                    import sailpoint.connector.*;


                    import sailpoint.object.Application;


                    import sailpoint.object.TaskItemDefinition;


                    import sailpoint.object.TaskItemDefinition.ProgressMode;


                    import sailpoint.tools.GeneralException;


                    import sailpoint.tools.Message;


                    import sailpoint.tools.Util;


                    import sailpoint.api.SailPointContext;


                    import sailpoint.object.*;


                    import java.lang.reflect.Constructor;


                    import java.util.*;


                    try {


                    Application app = (Application) context.getObjectById(Application.class, value);


                    //String appName = app.getName();


                    if (app != null) {


                    //String connName = app.getConnector();


                    try {


                    Connector connector = ConnectorFactory.getConnector(app, null);


                    connector.testConfiguration();


                    return "Test Connection Successful";


                    } catch (Exception e) {


                    return e.getMessage();


                    log.error(e);


                    }


                    }


                    } catch (Exception e) {


                    log.error(e);


                    throw(e);


                    }


                  </Source>

                </RenderScript>

              </ReportColumnConfig>

            </Columns>

          </LiveReport>

        </value>

      </entry>

    </Map>

  </Attributes>

  <Description>A list of all application's connection status.  If successfull, "Successful Connection" is displayed.  If not, the connector exception is shown.</Description>

  <RequiredRights>

    <Reference class="sailpoint.object.SPRight" id="c0a8010380581a4b8180581cdee2004a" name="FullAccessApplicationReport"/>

  </RequiredRights>

  <Signature>

    <Inputs>

      <Argument multi="true" name="applications" type="Application">

        <Description>rept_input_app_report_apps</Description>

      </Argument>

    </Inputs>

  </Signature>

</TaskDefinition>


Thursday, February 9, 2023

Report for tasks and scheduled or not including those tasks present in sequential tasks.

<?xml version='1.0' encoding='UTF-8'?>

<!DOCTYPE TaskDefinition PUBLIC "sailpoint.dtd" "sailpoint.dtd">

<TaskDefinition executor="sailpoint.reporting.LiveReportExecutor" name="TaskDefSch-Report" progressMode="Percentage" resultAction="Rename" subType="Role Management Reports" template="true" type="LiveReport">

<Attributes>

<Map>

<entry key="TaskDefinition.runLengthAverage" value="422"/>

<entry key="TaskDefinition.runLengthTotal" value="422"/>

<entry key="TaskDefinition.runs" value="1"/>

<entry key="report">

<value>

<LiveReport title="Task Result Report">

<DataSource objectType="TaskDefinition" type="Filter">

<QueryParameters>

<Parameter argument="type" property="type">

<QueryScript>

<Source>

import sailpoint.object.Filter;

import sailpoint.tools.Util;


List allowedTypes = new ArrayList();

allowedTypes.add("AccountAggregation");

allowedTypes.add("AccountGroupAggregation");


queryOptions.addFilter(Filter.in("type", allowedTypes));

queryOptions.addFilter(Filter.notnull("parent"));

return queryOptions;

</Source>

</QueryScript>

</Parameter>

</QueryParameters>

</DataSource>

<Columns>

<ReportColumnConfig field="taskName" header="Task Name" property="name" sortable="true" width="110"/>

<ReportColumnConfig field="taskType" header="Task Type" property="type" sortable="true" width="110"/>

<ReportColumnConfig field="appName" header="Application Name" property="name" sortable="true" width="110">

<RenderScript>

<Source>

import sailpoint.object.TaskDefinition;


TaskDefinition taskDef = context.getObjectByName(TaskDefinition.class, value);

if(taskDef != null &amp;&amp; null != taskDef.getArguments() &amp;&amp; null!= taskDef.getArguments().get("applications")){

return taskDef.getArguments().get("applications");

}

else

return "";

</Source>

</RenderScript>

</ReportColumnConfig>

<ReportColumnConfig field="isSchedule" header="Is Sheduled" property="name" sortable="true" width="110">

<RenderScript>

<Source>

import sailpoint.object.TaskDefinition;

import sailpoint.object.TaskDefinition;

import sailpoint.object.TaskSchedule;

import sailpoint.object.QueryOptions;

import sailpoint.object.Attributes;

import sailpoint.object.Filter;

import sailpoint.api.IncrementalObjectIterator;

import java.util.List;

import java.util.ArayList;

import java.util.Set;


public static String isPresentInSchlTasks(String taskIdParam)

{

//log.error("Entered into the method isPresentInSchlTasks() ");

try{

QueryOptions qo = new QueryOptions();


IncrementalObjectIterator taskSchedule = new IncrementalObjectIterator(context, TaskSchedule.class, qo);

String returnStmt = "notscheduled";

while (taskSchedule.hasNext()) {

TaskSchedule taskScheduleObject = (TaskSchedule) taskSchedule.next();

if(taskScheduleObject.getArguments().get("executor").contains(taskIdParam))

{

returnStmt = "scheduled";

break;

}

}

return returnStmt;

}

catch (Exception e)

{

return e.getMessage();

}

}


public static String checkInSeqSchExe(String taskNameParam)

{

try{

Filter f = Filter.like("formPath","sequentialTask");

QueryOptions qo = new QueryOptions();

qo.add(f);


IncrementalObjectIterator taskDefSeq = new IncrementalObjectIterator(context, TaskDefinition.class, qo);

String returnValue = "No";

while (taskDefSeq.hasNext()) {

TaskDefinition taskDefSeqObject = (TaskDefinition) taskDefSeq.next();

String taskName = taskDefSeqObject.getName();

String taskId = taskDefSeqObject.getId();

if(taskDefSeqObject.getArgument("taskList")!=null &amp;&amp; taskDefSeqObject.getArgument("taskList").contains(taskNameParam))

{

returnValue = isPresentInSchlTasks(taskId);

break;

}

}

return returnValue;

}

catch (Exception e)

{

return e.getMessage();

}

}


try{


//log.error("value task: "+value);


TaskDefinition taskDef = context.getObjectByName(TaskDefinition.class, value);

String taskId = taskDef.getId();

String taskName = taskDef.getName();

if(taskDef != null &amp;&amp; null != taskId)

{

String isPresented = isPresentInSchlTasks(taskId);

if("scheduled".equalsIgnoreCase(isPresented))

{

return "Yes";

}

else if("notscheduled".equalsIgnoreCase(isPresented))

{

String result = checkInSeqSchExe(taskName);

if("scheduled".equalsIgnoreCase(result))

{

return "Yes";

}

else

{

return "No";

}

}

}

else

return null;

}

catch(Exception e){

return e.getMessage();

}

</Source>

</RenderScript>

</ReportColumnConfig>

<ReportColumnConfig field="executeTime" header="Execution Time" property="name" sortable="true" width="110">

<RenderScript>

<Source>

import sailpoint.object.QueryOptions;

import sailpoint.object.Filter;

import sailpoint.object.TaskDefinition;

import sailpoint.object.TaskSchedule;

import sailpoint.object.Attributes;

import sailpoint.api.IncrementalObjectIterator;

import java.util.List;

import java.util.ArayList;



public static String isPresentInSchlTasks(String taskIdParam)

{

try{

QueryOptions qo = new QueryOptions();

IncrementalObjectIterator taskSchedule = new IncrementalObjectIterator(context, TaskSchedule.class, qo);

String returnStmt = "NA";


while (taskSchedule.hasNext()) {

TaskSchedule taskScheduleObject = (TaskSchedule) taskSchedule.next();

//log.error("Inside the while loop ");

if(taskScheduleObject.getArguments().get("executor").equalsIgnoreCase(taskIdParam) &amp;&amp; null != taskScheduleObject.getNextExecution())

{

returnStmt = taskScheduleObject.getNextExecution().toString();

break;

}

}

return returnStmt;

}

catch (Exception e)

{

return e.getMessage();

}

}


public static String checkInSeqSchExe(String taskNameParam)

{

try{

Filter f = Filter.like("formPath","sequentialTask");

QueryOptions qo = new QueryOptions();

qo.add(f);


IncrementalObjectIterator taskDefSeq = new IncrementalObjectIterator(context, TaskDefinition.class, qo);

String returnValue = "NA";

while (taskDefSeq.hasNext()) {

TaskDefinition taskDefSeqObject = (TaskDefinition) taskDefSeq.next();

String taskName = taskDefSeqObject.getName();

String taskId = taskDefSeqObject.getId();

if(taskDefSeqObject.getArgument("taskList")!=null &amp;&amp; taskDefSeqObject.getArgument("taskList").contains(taskNameParam))

{

returnValue = isPresentInSchlTasks(taskId);

break;

}

}

return returnValue;

}

catch (Exception e)

{

return e.getMessage();

}

}


try{


TaskDefinition taskDef = context.getObjectByName(TaskDefinition.class, value);

String taskId = taskDef.getId();

String taskName = taskDef.getName();

if(taskDef != null &amp;&amp; null != taskId)

{

String exeTime = isPresentInSchlTasks(taskId);

if(exeTime!=null &amp;&amp; !"NA".equalsIgnoreCase(exeTime))

{

return exeTime;

}

else

{

String exeTime2 = checkInSeqSchExe(taskName);

if(exeTime2!=null &amp;&amp; !"NA".equalsIgnoreCase(exeTime2))

{

return exeTime2;

}

else

{

return "NA";

}

}

}

else

return null;

}

catch(Exception e){

return e.getMessage();

}

</Source>

</RenderScript>

</ReportColumnConfig>

<ReportColumnConfig field="executeFrequency" header="Execution Frequency" property="name" sortable="true" width="110">

<RenderScript>

<Source>

import sailpoint.object.QueryOptions;

import sailpoint.object.Filter;

import sailpoint.object.TaskDefinition;

import sailpoint.object.TaskSchedule;

import sailpoint.object.Attributes;

import sailpoint.api.IncrementalObjectIterator;

import java.util.List;

import java.util.ArayList;



public static long isPresentInSchlTasks(String taskIdParam)

{

try{

QueryOptions qo = new QueryOptions();

IncrementalObjectIterator taskSchedule = new IncrementalObjectIterator(context, TaskSchedule.class, qo);

long returnStmt = 0L;


while (taskSchedule.hasNext()) {

TaskSchedule taskScheduleObject = (TaskSchedule) taskSchedule.next();

if(taskScheduleObject.getArguments().get("executor").equalsIgnoreCase(taskIdParam) &amp;&amp; null != taskScheduleObject.getNextExecution() &amp;&amp; null != taskScheduleObject.getLastExecution())

{

returnStmt = (taskScheduleObject.getNextExecution().getTime())-(taskScheduleObject.getLastExecution().getTime());

break;

}

}

return returnStmt;

}

catch (Exception e)

{

return e.getMessage();

}

}


public static long checkInSeqSchExe(String taskNameParam)

{

try{

Filter f = Filter.like("formPath","sequentialTask");

QueryOptions qo = new QueryOptions();

qo.add(f);


IncrementalObjectIterator taskDefSeq = new IncrementalObjectIterator(context, TaskDefinition.class, qo);

long returnValue = 0L;

while (taskDefSeq.hasNext()) {

TaskDefinition taskDefSeqObject = (TaskDefinition) taskDefSeq.next();

String taskName = taskDefSeqObject.getName();

String taskId = taskDefSeqObject.getId();

if(taskDefSeqObject.getArgument("taskList")!=null &amp;&amp; taskDefSeqObject.getArgument("taskList").contains(taskNameParam))

{

returnValue = isPresentInSchlTasks(taskId);

break;

}

}

return returnValue;

}

catch (Exception e)

{

return e.getMessage();

}

}


try{


TaskDefinition taskDef = context.getObjectByName(TaskDefinition.class, value);

String taskId = taskDef.getId();

String taskName = taskDef.getName();

if(taskDef != null &amp;&amp; null != taskId)

{

long exeTime = isPresentInSchlTasks(taskId);

if(exeTime!=null &amp;&amp; exeTime!=0)

{

if((exeTime / (1000*60*60)) % 24==1)

{

return "Once in a hour";

}

else if((exeTime / (1000*60*60*24)) % 365==1)

{

return "Once in a day";

}

else if((exeTime / (1000*60*60*24)) % 365==7)

{

return "Once in a week";

}

else if((exeTime / (1000*60*60*24)) % 365==31)

{

return "Once in a month";

}

else if ((exeTime / (1000*60*60*24)) % 365==89)

{

return "Once in a quarter";

}

else if ((exeTime / (1000*60*60*24)) % 365==0)

{

return "Once in a year";

}

else

return "Once in a "+exeTime+" milliseconds";



}

else

{

long exeTime2 = checkInSeqSchExe(taskName);

if(exeTime2!=null &amp;&amp; exeTime2!=0)

{

if((exeTime2 / (1000*60*60)) % 24==1)

{

return "Once in a hour";

}

else if((exeTime2 / (1000*60*60*24)) % 365==1)

{

return "Once in a day";

}

else if((exeTime2 / (1000*60*60*24)) % 365==7)

{

return "Once in a week";

}

else if((exeTime2 / (1000*60*60*24)) % 365==31)

{

return "Once in a month";

}

else if ((exeTime2 / (1000*60*60*24)) % 365==89)

{

return "Once in a quarter";

}

else if ((exeTime2 / (1000*60*60*24)) % 365==0)

{

return "Once in a year";

}

else

return "Once in a "+exeTime2+" milliseconds";

}

else

{

return "NA";

}

}

}

else

return null;

}

catch(Exception e){

return e.getMessage();

}

</Source>

</RenderScript>

</ReportColumnConfig>

</Columns>

</LiveReport>

</value>

</entry>

</Map>

</Attributes>

<Description>Displays the tasks and schedules.</Description>

<RequiredRights>

<Reference class="sailpoint.object.SPRight" name="FullAccessIdentityRoleReport"/>

</RequiredRights>

</TaskDefinition>


Sunday, August 9, 2020

Custom Reports

# IdentityIQ includes a reporting architecture that greatly simplifies the process of developing custom reports by allowing the developer to specify the report requirements in a TaskDefinition XML document. 

# The executor uses IdentityIQ's forms API to generate the UI form for parameters specification and creates the report output based on column configurations specified in the TaskDefinition.

# The TaskDefinition XML specifies the below details :

1. The report's Standard Properties values

2. The report-specific parameters

3. The columns that are available for the report

4. How the data is retrieved for inclusion for the report

5. How the report results are laid out in both the detail and summary sections

Structure of TaskDefinition XML (Report)   :-

<TaskDefinition>

        <Description/>

        <RequiredRights/>

         <Atttributes>

                    <Map>

                            <entry key="report">

                                    <value>

                                            <LiveReport>

                                                    <DataSource>

                                                            <QueyParameters>

                                                                    <Parameter/>

                                                            </QueyParameters>

                                                    </DataSource>

                                                    <Coulumns>

                                                            <ReportColumnConfig>

                                                            </ReportColumnConfig>

                                                    </Coulumns>

                                            </LiveReport>

                                    </value>

                            </entry>

                    </Map>

        </Atttributes>

        <Signature>

                <Inputs>

                        <Argument/>

            </Inputs>

        </Signature>

</TaskDefinition>


Tags Description    :

# <TaskDefinition>

In IdentityIQ, a report is essentially executed as a specialized task. The root element of a report is a <TaskDefinition> element.

e.g    :    <TaskDefinition executor="sailpoint.reporting.LiveReportExecutor" name="Uncorrelated Accounts Report" progressMode="Percentage" resultAction="Rename" subType="Identity and User Reports" template="true" type="LiveReport">

# <DataSource>

The  datasource element specifies the From and Where clauses of the query used to fetch data for the report.

e.g    :    <DataSource type="Java" dataSourceClass="sailpoint.reporting.dataSource.SampleDataSource" defaultSort="name">

#<ReportColumnConfig>

The Select portion (the column list) is specified through the <columns> element in the report definition - specifically, the <ReportColumnConfig> s listed within <Columns> element.

e.g    :    <ReportColumnConfig field="applicationName" header="rept_appName" property="application.name" sortable="true">

# <Argument>

The Arguments specify the values that must be passed to the report at runtime to be usedas report filters.

e.g    :    <Argument multi="true" name="applications" type="Application"/>

DataSource    :    Retrieving Report Data

There are three available datasource types    :    Filter, Java, HQL

1. Filter DataSource    :

A filter datasource executes a projection query to retrieve the data required by the ReportColumnConfigs specified for the report. It employs the Sailpoint filter Object to specify the query. The object whose data is being queried is specified as the objectType for the DataSource and the DataSource type is specified as "Filter".

e.g    :    <datsource objectType="sailpoint.object.Link" type="Filter">

2. Java DataSource    :

A Javaclass dataSource is the next most commonly used report datasource type. The XML to specify this is fairly simple and straightforward; the java class it calls can be as simple or as complex as is required the desired report contents.

3. HQL DataSource

An HQL dataSource is used in rare circumstances but is available for implements who need to execute queries that hit Hibernate directly.

e.g    :    <DataSource type="Hql">

<Query> from ManagedAttribute m where group=true</Query>

</DataSource>

IAM, IGA & Identity Security

IAM sets up the employee's account so they can log in and access the application with their credentials. IGA makes sure that access requ...

Featured Articles