Tuesday, July 28, 2020

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);
        }
    }
}

No comments:

Post a Comment

Fetch Members from Workgroup

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