You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.3 KiB

#include "util.h"
int jd_get_target2(EPM_action_message_t msg) {
POM_AM__set_application_bypass(true);
tag_t root_task, *attachments;
int att_cnt;
stringstream ss;
EPM_ask_root_task(msg.task, &root_task);
EPM_ask_attachments(root_task, EPM_target_attachment, &att_cnt, &attachments);
for (int i = 0; i < att_cnt; i++) {
char *item_id, *item_revision_id;
if (isTypeOf(attachments[i], "ItemRevision")) {
char *uid;
ITK__convert_tag_to_uid(attachments[i], &uid);
ss << uid;
break;
}
}
cout << ss.str().c_str() << endl;
//string temp = ss.str().c_str();
//AOM_lock(root_task);
//AOM_set_value_string(root_task, "jd2_task_target", temp.c_str());
//AOM_save(root_task);
//AOM_unlock(root_task);
//char **p = (char **)MEM_alloc(sizeof(char *));
//p[0] = (char *)MEM_alloc(sizeof(char) * 50);
//p[0] = (char *)ss.str().c_str();
//ITKCALL(PREF_set_char_values("jd2_task_target2", 1, p));
//MEM_free(p);
AOM_set_value_string(root_task, "object_desc", ss.str().c_str());
AOM_save(root_task);
POM_AM__set_application_bypass(false);
//ofstream out;
//stringstream file_location;
//file_location << getenv("temp");
//file_location << "\\";
//file_location << "jd2_task_target2.txt";
//out.open(file_location.str().c_str(), ios::out | ios::trunc);
//out << temp.c_str() << endl;
//out.close();
return 0;
}