Thursday, July 30, 2020

Filters and QueryOptions

# Filter class contains all the static methods but filter class is not a static.
e.g
Single Criteria in Filter    :

Filter filter    =    Filter.eq("name","101");
NOTE : name is a property, 101 is property value

Multiple Criteria's in Filter   :

Filter filter1 = Filter.eq("firstname","Prasad");
Filter filter2 = Filter.eq("lastname","Reddy");

Filter.ignoreCase(Filter.and(filter1,filter2));

How to use filter in QueryOptions    : 

Single filter  in QueyOptions    :

QueyOptions qOptions = new QueyOptions();
qo.setCloneResults(true);
qOptions.addFilter(Filter.eq("application.name","Mighty App"));

Multiple filters  in QueyOptions    :

e.g     : 1

List listOfFilters = newArrayList();
listOfFilters.add("application.name","Clock");
listOfFilters.add("application.name","Watch App");

QueryOptions qOptions = new QueryOptions();
qOptions.setFilters(listOfFilters);

e.g    : 2

QueryOptions qOptions = new QueryOptions();
qOptions.add(Fiter.eq("type", certification.Type.Manager));
qOptions.add(Fiter.eq("name","Adam.guerich"));
qOptions.add(Fiter.eq("application",appId));

Multiple Ordering in QueryOptions    :

List arrayList = new ArrayList();
arrayList.add(new QueryOptions.Ordering("lastname","true"));
arrayList.add(new QueryOptions.Ordering("id","true"));

QueryOptions qOptions = new QueryOptions();
qOptions.setOrderings(arrayList);


How to search in Sailpoint with multiple conditions    :

Filter filter = Filter.and(Filter.like("manager.name","101"), Filter.eq("lastname","reddy"));

QueryOptions qOptions = new QueryOptions();
qOptions.addFilter(filter);

List propertyName = new ArrayList();
propertyName.add("name");

List listOfNames = new ArrayList();

Iterator names = context.search(Identity.class, qo, propertyName);
if(null != names){
while(names.hasNext()){
String name = (String)names.next()[0];
listOfNames.add(name)
}









Tuesday, July 28, 2020

Freeze Panes in Excel

Freeze Panes    :

Keep rows and columns visible while the rest of worksheet scrolls (based on current selection).
    
It will keep the left side columns and rows data while moving right  and It will keep the top side columns and rows data while scrolling down also

Freeze Top  Row    : 

Keep the row visible while scrolling through the rest of the worksheet
    

It will keep the headers while scrolling down also

Freeze First Column    :

Keep the first column visible while scrolling through the rest of the worksheet
    
It will keep the first column while moving right also

Reading data from CSV file (by using CSVReader - CSV-2.5 jar is required)

String filePath = "D:\IDM\Sailpoint\sailpoint7.3\AuthEMP.csv"
File file = new File(filePath);
FileReader fileReader = new FileReader(file);
CSVReader csvReader = new CSVReader(fileReader);
List<String> inValidRecords = new ArrayList<String>());

List<String> headersList = new ArrayList<String>(Arrays.asList(csvReader.readNext()));
List<String[]> listOfRecords = csvReader.readAll();

for(Strin[] record : listOfRecords){

    if(record != null){
        boolean isValid = updateMethod(record[headersList.indexOf("userLogin")],record[headersList.indexOf("employeeNumber")],record[headersList.indexOf("justification")],record[headersList.indexOf("endDate")]);

if(!isValid){
System.ou.println("Adding record to invalid List :  UserLogin = "+record[headersList.indexOf("userLogin")] +", UPI= "+  record[headersList.indexOf("employeeNumber")]);

inValidRecords.add(record);
        }
    }
}

String to Date to String to Date Conversion code

// Fetch current date :

Calender calender = Calender.getInstance();
Date currentDate = calender.getTime();

// Printing  current date in terminal :

SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy-hh-mm-ss");
System.setProperty("current_time", dateFormat.format(new Date()));

// Converting String to Date to String to Date

String endDate = "20200728";
Date date1 = new SimpleDateFormat("yyyyMMdd").parse(endDate);
SimpleDateFormat newFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss z");
String str = newFormat.format(date1);
Date date2 = newFormat(str);

Java String to Date Example :

String sDate1="10/03/1994";  
Date date1=new SimpleDateFormat("dd/MM/yyyy").parse(sDate1);  
System.out.println(sDate1+"\t"+date1);

Java Date to String Example :

Date date = Calendar.getInstance().getTime();  
DateFormat dateFormat = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss");  
String strDate = dateFormat.format(date);  
System.out.println("Before conversion of date into String: " + date); 
System.out.println("After conversion of date into String: " + strDate); 

// Inserting user data into EMP table

Connection connection = Platform.getConnection();
PreparedStatement pstmt = connection.prepareStatement("insert into EMP(userLogin,employeeNumber,reason,end_Date) values(?,?,?,?)");

pstmt.setString(1, userLogin);
pstmt.setString(2, upi);
pstmt.setString(3, reason);
pstmt.setDate(4, new java.sql.Date(date2.getTime));
pstmt.exceuteUpdate();
connection.commit();


Copy all the columns from OIM Design console to Excel sheet and sort the columns

Steps : 

e.g : We want copy all the Reconciliation Field Mappings(Resource Object / Lookup) from OIM Design Console.

1. Login to Design console and navigate to Reconciliation Field Mappings (Process Definition)

2. Select the object name (*AD User*) then search

3. Copy all the field names and save in notepad ++ (.txt)

4. Open the Excel sheet first then click on file then open again (Ctrl + O)

5. Select the .txt file  then click on open ---> Yes

6. Choose the file type as Delimited and check

7. Delimiters - check Tab and Comma

8. Click on next

9. Click on finish.

10. Now the fields are separated in Excel sheet, select your required columns

Monday, July 27, 2020

Finding duplicate values in column

Steps : 

1. Below is the sample data and select all the values / data
    

2. Select Home ---> Conditional Formatting
        
        

3. Click on Highlight cell Rules    --->    Duplicate values
    (Below prompt will pop up)
    
4. Select the color of duplicate values (values with) then click on Ok

5. Duplicate values will show like below
    

    

Attaching any file / document to the Word

Steps : 

1. Open the word document

2.  click on insert 

    

3. click on Object 

    

4. Below promt will pop up

    

5. Browse the file / document from Browse option

6. Check Display as icon and click on Ok


    

Fetch Members from Workgroup

  import java.util.ArrayList;   import java.util.Iterator;   import java.util.List;   import sailpoint.api.ObjectUtil;   import sailpoint.ob...