下面run
显示的方法是从类Tutorial_RunbaseBatch
中批量运行的。
我做了以下更改:
修改 类SysSecurity中的constructSecurityKeySet方法为
server client static public SecurityKeySet constructSecurityKeySet()
将BatchRun 类中的runJobStatic方法修改为
server client static void runJobStatic(recId batchId)
我知道我不应该玩弄框架类,但这只是一项研究。在我添加以下代码部分之前,它运行良好。
代码更改1:
MenuItemName menuItemName;
AccessType act;
代码更改2:
act = securitySet.secureNodeAccessmenuItemName,SysSecurity::accessRecType2UtilElementType(AccessRecordType::MenuItemDisplay)); // Line 24
现在,添加上述代码部分后,我收到以下错误消息
The server-side impersonated (RunAs) session tried to invoke a method that is available for client-side processing only.
(S)\Classes\Tutorial_RunbaseBatch\run - line 24
(S)\Classes\BatchRun\runJobStatic - line 62 //which is batchClass.run();
SecurityKeySet(SystemClass)将属性RunOn设置为calledFrom
并在调用对象的任何位置执行,可以是client或server。它还依赖于 Class Batchable和BatchRunable。这两个类的属性都RunOn
设置为calledFrom
我尝试在类上将属性更改为服务器,但这不起作用
反正有没有让这段代码工作?
完整代码:
public void run()
{
SecurityKeySet securitySet;
UserGroupId fromUserGroupId;
DomainId domainId;
MenuItemName menuItemName;
AccessType act;
;
#OCCRetryCount
fromUserGroupId = "XXXX";
domainId = "YYYY";
if (!this.validate())
throw error("");
try
{
ttsbegin;
// this.Update();
securitySet=SysSecurity::constructSecurityKeySet();//error
securitySet.loadGroupRights(fromUserGroupId,domainId);
act = securitySet.secureNodeAccess(menuItemName,SysSecurity::accessRecType2UtilElementType(AccessRecordType::MenuItemDisplay));
ttscommit;
}
catch (Exception::Deadlock)
{
retry;
}
catch (Exception::UpdateConflict)
{
if (appl.ttsLevel() == 0)
{
if (xSession::currentRetryCount() >= #RetryNum)
{
throw Exception::UpdateConflictNotRecovered;
}
else
{
retry;
}
}
else
{
throw Exception::UpdateConflict;
}
}
}