package com.company;
import oracle.stellent.ridc.IdcClient;
import oracle.stellent.ridc.IdcClientException;
import oracle.stellent.ridc.IdcClientManager;
import oracle.stellent.ridc.IdcContext;
import oracle.stellent.ridc.model.DataBinder;
import oracle.stellent.ridc.model.DataObject;
import oracle.stellent.ridc.model.DataResultSet;
import oracle.stellent.ridc.protocol.ServiceResponse;
import java.util.List;
/**
* Created by Sonal_Chaudhary on 8/4/2016.
*/
public class ExtractEmailIDs {
public static void main(String[] args) {
int startIndex = 1;
int pageNumber = 1;
int totalRows = 20;
IdcClientManager manager = new IdcClientManager();
try {
IdcClient idcClient = manager.createClient("idc://143.127.54.171:4444");
IdcContext userContext = new IdcContext("sysadmin");
boolean stillLoop = true;
while (stillLoop) {
DataBinder dataBinder = idcClient.createBinder();
dataBinder.putLocal("IdcService", "GET_SEARCH_RESULTS");
dataBinder.putLocal("QueryText", "dSecurityGroup <contains> `Partner` <AND> xLanguage <contains> `4` <AND> xCountries <contains> `1`");
dataBinder.putLocal("SearchQueryFormat", "Universal");
dataBinder.putLocal("StartRow", Integer.toString(startIndex));
dataBinder.putLocal("ResultCount", Integer.toString(totalRows));
dataBinder.putLocal("PageNumber", Integer.toString(pageNumber));
dataBinder.putLocal("TotalRows", Integer.toString(totalRows));
ServiceResponse response = idcClient.sendRequest(userContext, dataBinder);
DataBinder responseData = response.getResponseAsBinder();
DataResultSet resultSet = responseData.getResultSet("SearchResults");
if (resultSet != null && resultSet.getRows() != null) {
List<DataObject> dataObjects = resultSet.getRows();
if (dataObjects.size() == totalRows) {
startIndex += totalRows;
pageNumber++;
} else {
stillLoop = false;
}
for (DataObject dataObject : dataObjects) {
System.out.println(dataObject.get("dID") + "," + dataObject.get("dDocName") + "," + dataObject.get("dExtension"));
}
}
}
} catch (IdcClientException ice) {
ice.printStackTrace();
}
}
}
Friday, August 5, 2016
UCM: GET_SEARCH_RESULTS iterating resultset
Subscribe to:
Posts (Atom)