package com.ai.data; import java.util.Map; import com.ai.application.interfaces.RequestExecutionException; import com.ai.application.utils.AppObjects; /** * @author Satya * */ public class DataUtils { public static void fillAMap(IDataRow inRow, Map map) throws DataException { try { IIterator colNames = inRow.getColumnNamesIterator(); for(colNames.moveToFirst(); !colNames.isAtTheEnd(); colNames.moveToNext()) { String colName = (String)colNames.getCurrentElement(); String colValue = inRow.getValue(colName); map.put(colName.toLowerCase(),colValue); } } catch(FieldNameNotFoundException x) { throw new DataException("Error: field name not found",x); } } public static Object execRequestUsingDataRow(String requestName, IDataRow inRow, Map args) throws DataException, RequestExecutionException { fillAMap(inRow, args); return AppObjects.getObject(requestName,args); } public static IDataCollection queryUsingDataRow(String requestName, IDataRow inRow, Map args) throws DataException, RequestExecutionException { fillAMap(inRow, args); return (IDataCollection)AppObjects.getObject(requestName,args); } }//eof-class