Monday, July 14, 2014

Generic job for testing AIF Read operation

static void GenericReadServiceCall(Args _args)
{
    DictClass dictClass;
    anytype objEntityValue;
    anytype objValue;
    Object object;
    ExecutePermission permission;
    str strClassName="KT_ActivitiesViewService";
    str strTableName="smmActivities";
    str strRecordValue="S450247";

    str strTableMethodName="find";
    str strServiceMethodName="read";
    aifcriteriaElement criteriaElements;
    aifQueryCriteria objqueryCriteria;
    container objContainer;
    SysDictTable objSysDictTable;

    AifEntityKey           entityKey     = new AifEntityKey();
    AifEntityKeyList      entityKeyList = new AifEntityKeyList();



    objSysDictTable=new SysDictTable(tableName2Id(strTableName));
    objEntityValue=objSysDictTable.callStatic(strTableMethodName,strRecordValue); //,"CANONIMAGERUNNER");

     entityKey.parmKeyDataMap(SysDictTable::getKeyData(objEntityValue));
        entityKeyList.addEntityKey(entityKey);
    // 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(strServiceMethodName, object,entityKeyList);
    }

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

No comments:

Post a Comment