Monday, July 14, 2014

Generic job for testing AIF Find operation

static void GenericFindServiceCal(Args _args)
{
    DictClass dictClass;
    anytype objValue;
    Object object;
    ExecutePermission permission;
  //  str strTableName;
    str strClassName="KT_ActivitiesListService";
   // str strClassName="SalesViewQService";
    str strTableName="smmActivities";
//str strTableName="SalesLine";
    str strMethodName="find";
    aifcriteriaElement criteriaElements;
    aifQueryCriteria objqueryCriteria;
    container objContainer;
    aifQueryCriteria queryCriteria;

    objContainer=[1,strTableName,"KTPAGING",1,1,10];
   // objContainer=[1,strTableName,"Salesid",1,1,10];

    /* = conins(c,1,"SalesTable");
    c = conins(c,2,"SalesId");
    c = conins(c,3,salesIdValue);*/
    //info(tableid2name(2303));
    //info(tableid2name(8152));
    //pause;

    criteriaElements = aifCriteriaElement::create(objContainer);

    /*criteriaElements[0] = new CriteriaElement();
    criteriaElements[0].DataSourceName = "SalesTable";
    criteriaElements[0].FieldName = "SalesId";
    criteriaElements[0].Value1 = salesIdValue;*/

    objqueryCriteria = new aifQueryCriteria();
///
    objqueryCriteria.addCriteriaElement(criteriaElements);

    // Grants permission to execute the DictClass.callObject method.
    // DictClass.callObject runs under code access security.
    permission = new ExecutePermission();
    permission.assert();

    dictClass = new DictClass(className2Id(strClassName));
    object = dictClass.makeObject();


    if (dictClass != null)
    {
    //If it is static method
    //dictClass.callStatic(methodName);
     objValue = dictClass.callObject(strMethodName, object, objqueryCriteria);
    }

    // Closes the code access permission scope.
    CodeAccessPermission::revertAssert();

}

No comments:

Post a Comment