/*
* 移除 从分类库中移除历史版本
*/
int j2_replace_ics(EPM_action_message_t msg){
//流程根对象
tag_t roottask = NULLTAG;
int i = 0, j = 0, k = 0;
int n = 0, m = 0;
//目标对象
tag_t* attachments = NULL;
int rcode = ITK_ok;
char debug_string[1024];
int curdebug = 1;
/*防止进入循环陷阱*/
if (msg.task == NULL_TAG)
return ITK_ok;
if (msg.action > EPM_perform_action)
{
return ITK_ok;
}
/*打开旁路*/
setOpenByPass();
/*获取流程对象*/
//循环检查处理
ITKCALL(EPM_ask_root_task(msg.task, &roottask));
ITKCALL(EPM_ask_attachments(roottask, EPM_target_attachment, &n, &attachments));
if (n > 0)
{
for (i = 0; i < n; i++) {
int isRev = 0;
isRev = 0;
ITKCALL(AOM_refresh(attachments[i], 0));
tag_t item = NULLTAG;
int rev_count = 0;
tag_t* rev_list = NULL;
logical isIr;
ITKCALL(cust_is_ItemRevision(attachments[i], &isIr));
if (isIr) {
ITKCALL(ITEM_ask_item_of_rev(attachments[i], &item));
ITKCALL(ITEM_list_all_revs, );
ITKCALL(ITEM_list_all_revs(item, &rev_count, &rev_list));
for (int j = 0; j < rev_count;j++) {
if (rev_list[j] != attachments[i]) {
//从分类中移除
tag_t classObj = NULLTAG;
int icos_count = 0;
ITKCALL(ICS_ask_classification_object(rev_list[j], &classObj));
if (classObj) {
ITKCALL(ICS_ico_remove(classObj));
}
}
}
}
SAFE_SM_FREE(rev_list);
}
}
setCloseByPass();
SAFE_SM_FREE(attachments);
return ITK_ok;
}