|
|
#define _CRT_SECURE_NO_WARNINGS
|
|
|
#include "epm_handler_common.h"
|
|
|
|
|
|
/*************************************************************************************************
|
|
|
* ML_ItemIsMeetTheConditions()
|
|
|
*
|
|
|
* Description:
|
|
|
* This handler will Determine whether the object meets the condition
|
|
|
*
|
|
|
* Syntax:
|
|
|
*
|
|
|
* -property: 判断属性(item.item_id,rev.,revMaster.)
|
|
|
*
|
|
|
* -value: 属性对应的值(1111,2222)
|
|
|
*
|
|
|
* -type: 判断类型(等于/不等于)
|
|
|
*
|
|
|
* Placement:
|
|
|
* no request
|
|
|
*
|
|
|
**************************************************************************************************/
|
|
|
int ML_ItemIsMeetTheConditions(EPM_action_message_t msg) {
|
|
|
printf("=========================判断对象是否满足条件 Start===================\n");
|
|
|
int ifail = ITK_ok;
|
|
|
int attachments_num = 0;
|
|
|
tag_t rootTask = NULLTAG, *attachments = NULLTAG;
|
|
|
//获取任务对象
|
|
|
EPM_ask_root_task(msg.task, &rootTask);
|
|
|
//获取任务目标对象
|
|
|
EPM_ask_attachments(rootTask, EPM_target_attachment, &attachments_num, &attachments);
|
|
|
|
|
|
char *argflag = NULL, *argvalue = NULL, *arg = NULL;
|
|
|
char arg1value[1024] = "", arg2value[1024] = "", arg3value[1024] = "";
|
|
|
//获取参数
|
|
|
int arg_cnt = TC_number_of_arguments(msg.arguments);
|
|
|
printf("参数个数为:%d\n", arg_cnt);
|
|
|
if (arg_cnt > 0)
|
|
|
{
|
|
|
for (int i = 0; i<arg_cnt; i++)
|
|
|
{
|
|
|
//获取下一个参数(从0开始)
|
|
|
arg = TC_next_argument(msg.arguments);
|
|
|
//获取参数的名称和值
|
|
|
ifail = ITK_ask_argument_named_value((const char*)arg, &argflag, &argvalue);
|
|
|
if (stricmp(argflag, "property") == 0)
|
|
|
{
|
|
|
//strcmp("","");
|
|
|
if (argvalue != NULL)
|
|
|
{
|
|
|
strcpy(arg1value, argvalue);
|
|
|
}
|
|
|
}
|
|
|
else if (stricmp(argflag, "value") == 0)
|
|
|
{
|
|
|
if (argvalue != NULL)
|
|
|
{
|
|
|
strcpy(arg2value, argvalue);
|
|
|
}
|
|
|
}
|
|
|
else if (stricmp(argflag, "type") == 0)
|
|
|
{
|
|
|
if (argvalue != NULL)
|
|
|
{
|
|
|
strcpy(arg3value, argvalue);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
int propertyCount = 0;
|
|
|
char ** propertyChar = new char *[64];
|
|
|
//分割字符串
|
|
|
split(arg1value, ",", propertyChar, &propertyCount);
|
|
|
|
|
|
|
|
|
int valueCount = 0;
|
|
|
char ** valueChar = new char *[64];
|
|
|
//分割字符串
|
|
|
split(arg2value, ",", valueChar, &valueCount);
|
|
|
|
|
|
for (int i = 0; i < attachments_num; i++)
|
|
|
{
|
|
|
for (int j = 0; j < propertyCount; j++)
|
|
|
{
|
|
|
char * property = propertyChar[j];
|
|
|
if (strstr(property, ".") != NULL)
|
|
|
{
|
|
|
int itemCount = 0;
|
|
|
char ** itemChar = new char *[64];
|
|
|
split(property, ".", itemChar, &itemCount);
|
|
|
char * value = NULL;
|
|
|
if (strcmp(itemChar[0], "item") == 0)
|
|
|
{
|
|
|
//获取对象
|
|
|
AOM_ask_value_string(attachments[i], itemChar[1], &value);
|
|
|
}
|
|
|
else if (strcmp(itemChar[0], "rev") == 0)
|
|
|
{
|
|
|
AOM_ask_value_string(attachments[i], itemChar[1], &value);
|
|
|
}
|
|
|
else if (strcmp(itemChar[0], "revMaster") == 0)
|
|
|
{
|
|
|
AOM_ask_value_string(attachments[i], itemChar[1], &value);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
DOFREE(attachments);
|
|
|
printf("=========================判断对象是否满足条件 End===================\n");
|
|
|
return ifail;
|
|
|
}
|
|
|
|
|
|
|