ITK开发入门
1、ITK-Handler开发介绍

在Teamcenter EPM企业流程管理模块中,添加开发入口作为触发点。按照OOTB的流程,流程中Handler分为rule Hander和actiion Handler,程序中可以接收配置的参数名称和参数值作为入参。
2、ITK-Handler开发所需工具和开发环境配置
2.1vs中新建空项目

2.2编辑工程属性

3、hello,world实例程序
handlers_register_callbacks.cpp

#include "Header.h"
#include "Handler_register.h"
#include "CommonFunc.h"
#ifdef __cplusplus
extern "C" {#endif  extern DLLAPI int handlerTest_register_callbacks(){int ifail = ITK_ok;CommonFunc::WriteInfoLog("********TC成功加载handlerTest************");ITKCALL(ifail = CUSTOM_register_exit("handlerTest", "USER_gs_shell_init_module", (CUSTOM_EXIT_ftn_t)Handler_Register));return ifail;}
#ifdef __cplusplus
}
#endif

Handler_register.cpp

#include "Handler_Register.h"
#include "CommonFunc.h"
#include "Header.h"
//============================================
// 说明: 此函数用来注册Handlers
//============================================
extern DLLAPI int Handler_Register(int *decision, va_list args)
{int status = ITK_ok;*decision = ALL_CUSTOMIZATIONS;CommonFunc::WriteInfoLog("> > > 开始注册action_func_test_name ... \n");#pragma region ================注册TC的 action 的Handler========================ITKCALL(status = EPM_register_action_handler("action_func_test_name","描述",action_func_test));if (status == ITK_ok){CommonFunc::WriteInfoLog("成功: 注册action_func_test_name ... ");}else{CommonFunc::WriteInfoLog("失败:action_func_test_name... ");}#pragma endregionCommonFunc::WriteInfoLog("> > > 开始注册rule_func_test_name ... \n");#pragma region ================注册TC的 rule 的Handler========================ITKCALL(status = EPM_register_rule_handler("rule_func_test_name","描述",rule_func_test));if (status == ITK_ok){CommonFunc::WriteInfoLog("成功: 注册rule_func_test_name ... ");}else{CommonFunc::WriteInfoLog("失败: 注册rule_func_test_name ... ");}#pragma endregionreturn status;
}

action_func_test.cpp

#include "CommonFunc.h"
#include "Header.h"
#define DELIMITER "\\"
#define TMPDIR "temp"
#define TC_ROOT "FMS_HOME"
#include <windows.h>
#include<io.h>
#include <iostream>
#include <string>
#include <string.h>
#include <algorithm>
int action_func_test(EPM_action_message_t msg)
{CommonFunc::WriteInfoLog("action_func_test入口");string errorStr = "错误:action_func_test:>>";int result=EPM_go;int rcode = ITK_ok;int argsCount = 0;bool isDebug = true;//是为了在控制台写log,正式包改为falsestring para_status="";char* paraArgsValue = NULL;argsCount = TC_number_of_arguments(msg.arguments);TC_init_argument_list(msg.arguments);string datasetCheckStr="";string attachType;bool datasetCheckFlag=false;bool typeFlag=false;bool hasTypeFlag=false;bool hasdatasetCheckFlag=false;if(argsCount!=2){rcode=ERROR_PARAMETER_LACK;string logStr ="流程模板配置错误(检查到action_func_test参数数量不为2),请联系管理员";     CommonFunc::WriteInfoLog(logStr.c_str());logStr=CommonFunc::gbk2utf(logStr);rcode=ERROR_PARAMETER_LACK;EMH_store_error_s1(EMH_severity_user_error, rcode, logStr.c_str());return EPM_nogo;}CommonFunc::WriteInfoLog("流程模板该节点的参数个数:",(CommonFunc::intToString(argsCount)).c_str());for (int i = 0; i < argsCount; i++){char* paraValue = NULL;char* paraFlag = NULL;paraArgsValue = TC_next_argument(msg.arguments);ITK_ask_argument_named_value(paraArgsValue, &paraFlag, &paraValue);CommonFunc::WriteInfoLog(paraFlag);// 读取参数if (CommonFunc::IsEqual(paraFlag, "Type")){hasTypeFlag=true;if (!CommonFunc::IsEmpty(paraValue)){attachType=paraValue;typeFlag=true;}} if (CommonFunc::IsEqual(paraFlag, "DatasetCheck")){hasdatasetCheckFlag=true;if (!CommonFunc::IsEmpty(paraValue)){datasetCheckStr=paraValue;datasetCheckFlag=true;}}Free(paraValue);Free(paraFlag);}if(hasdatasetCheckFlag==false||hasTypeFlag==false){CommonFunc::WriteInfoLog("");string logStr = errorStr+"流程参数配置错误,请联系管理员";        CommonFunc::WriteInfoLog(logStr.c_str());logStr=CommonFunc::gbk2utf(logStr);rcode=ERROR_PARAMETER_LACK;EMH_store_error_s1(EMH_severity_user_error, rcode, logStr.c_str());return EPM_nogo;}return  ITK_ok;
}

**
Header.h

#pragma once
#include "tcinit/tcinit.h"
#include <ae/datasettype.h>
#include <string>
#include <time.h>
#include <io.h>
#include "epm/epm.h"
#include "sa/sa.h"
#include "fclasses/tc_date.h"
#include "epm/signoff.h"
#include "tccore/grmtype.h"
#include "tccore/grm.h"
#include <iostream>
#include <fstream>
#include <sa/am.h>
#include <sa/tcfile_cache.h>
#include <tccore/aom.h>
#include <tccore/aom_prop.h>
#include <ae/dataset.h>
#include <tccore/tc_msg.h>
#include <tc/folder.h>
#include <tccore/grm.h>
#include <tccore/grmtype.h>
#include <tccore/item.h>
#include <tccore/item_msg.h>
#include <tccore/method.h>
#include <tc/preferences.h>
#include <sa/sa.h>
#include <tc/tc_macros.h>
#include <tc/tc_util.h>
#include <tc/tc_startup.h>
#include <tccore/workspaceobject.h>
#include <fclasses/tc_string.h>
#include <res/res_itk.h>
#include "tccore/idcxt.h"
#include "tccore/idfr.h"
#include "epm/epm_task_template_itk.h"
#include <user_exits/epm_toolkit_utils.h>#include <tccore/custom.h>
#include <tccore/tctype.h>
#include <ict/ict_userservice.h>
#include "epm/signoff.h"
#include <string>
#include <sstream>
#include "ict/ict_userservice.h"
#include "fclasses/tc_date.h"
#include "ps/ps.h"
#include <lov\lov.h>
#include <bom\bom.h>#include <vector>
#include <map>
using namespace  std;// 此常量用于变量的长度
const int Long16 = 16;
const int Long32 = 32;
const int Long64 = 64;
const int dLong81 = 81;
const int Long128 = 128;
const int Long512 = 512;
const int Long1000 = 1000;
const int Long1500 = 1500;
const int Long2000 = 2000;
const int Long3000 = 3000;//错误代码
#define ERROR_NOT_FIND (EMH_USER_error_base + 100003)
#define ERROR_DATA (EMH_USER_error_base + 100005)
#define ERROR_RULE_NOT_PASS (EMH_USER_error_base + 100008)
#define ERROR_PARAMETER_LACK (EMH_USER_error_base + 100010)
#define ERROR_PREF_NOT_FIND (EMH_USER_error_base + 100011)// TC 中默认的关系
#define RELATION_specification "IMAN_specification"// TC中默认的属性名称
#define PROP_itemId "item_id"
#define PROP_itemRevId "item_revision_id"
#define PROP_objectString "object_string"#define PARAM_USER "-u="
#define PARAM_PASSWORD "-p="
#define PARAM_GROUP "-g="
#define PARAM_SLEEP "-sleep="
#define PARAM_FOLDER "-folder="#define TEXT_FORMAT "TEXT"
#define BINARY_FORMAT "BINARY"#define Free(obj)       \
{                                   \if(obj!=NULL)                     \{                              \MEM_free(obj);     \obj = NULL;           \}                              \
};#define SAFECALL(x)                                                                 \
{                                                                                \if((rcode = (x)) != ITK_ok)                                                     \{                                                                               \goto CLEANUP;                                                               \}                                                                               \
}#ifdef COMM_LIB_IMPORT
#define COMM_LIB __declspec(dllimport)
#else
#define COMM_LIB __declspec(dllexport)
#endifclass Header
{public:Header(void);~Header(void);
};int action_func_test(EPM_action_message_t msg);
EPM_decision_t rule_func_test(EPM_rule_message_t msg);

Handler_register.h

#include "Header.h"#pragma once
class Handler_Register
{public:Handler_Register(void);~Handler_Register(void);
};//============================================
// 说明: 此函数用来注册Handlers
//============================================
extern DLLAPI int Handler_Register(int *decision, va_list args);//============================================
// 说明: 此函数用来注册Methods
//============================================
extern DLLAPI int Method_Register(int *decision, va_list args);//调用dispatcher
//extern DLLAPI int DispatcherRequest(EPM_action_message_t msg);

4、TC中的配置以及测试**

4.1参数数量不符合条件时

4.2参数名称不符合条件时

4.3 action和rule类似,在此省略。

ITK开发入门hello,world相关推荐

  1. python自学视频教程 38-python编程开发入门中文视频培训教程38讲

    Python 当前位置:主页 > 编程教程 > Python > python编程开发入门中文视频培训教程38讲 python编程开发入门中文视频培训教程38讲 教程大小:   发布 ...

  2. Hololens Unity 开发入门 之 Hello HoloLens

    Hololens Unity 开发入门 之 Hello HoloLens~ 本文主要记录 HoloLens Unity 开发入门 ~ 一.说在前面的话 Unity 对 VR AR 甚至 将来的 MR ...

  3. 【Arduino】开发入门教程【一】什么是Arduino

    Arduino Arduino 是一款便捷灵活.方便上手的开源电子原型平台,包含硬件(各种型号的arduino板)和软件(arduino IDE).它适用于艺术家.设计师.爱好者和对于"互动 ...

  4. unity开发入门_Unity游戏开发终极入门指南

    unity开发入门 Unity is a great tool for prototyping everything from games, to interactive visualisations ...

  5. 《iOS 8应用开发入门经典(第6版)》——第1章,第1.6节小结

    本节书摘来自异步社区<iOS 8应用开发入门经典(第6版)>一书中的第1章,第1.6节小结,作者 [美]John Ray(约翰 雷),更多章节内容可以访问云栖社区"异步社区&qu ...

  6. openresty 前端开发入门五之Mysql篇

    2019独角兽企业重金招聘Python工程师标准>>> openresty 前端开发入门五之Mysql篇 这章主要演示怎么通过lua连接mysql,并根据用户输入的name从mysq ...

  7. Android项目驱动式开发教程 第2版,《Android项目驱动式开发教程》第一章开发入门.ppt...

    <Android项目驱动式开发教程>第一章开发入门 1.4 项目框架分析 4 android:versionName="1.0" > 5 8 第9行代码andro ...

  8. 《SAP FIORI 开发入门》课程答疑 第二期

    课程上线已经一个星期,本人也接到了同学们提出的一些问题.在这里把典型的问题的回答重新整理一下,帮助后来的同学. 再次放上课程的连接: SAP FIORI开发入门 希望老师能够再放开一章免费的课程. 已 ...

  9. JSP WEB开发入门基础到高手进阶教程002

    JSP WEB开发入门基础到高手进阶教程 -------开发入门 JSP与微软的Active Server Pages 兼容,但它是使用类似HTML的卷标以及Java程序代码段而不是VBScript. ...

最新文章

  1. FastText情感分析和词向量训练实战——Keras算法练习
  2. 云原生 DevOps 的 5 步升级路径
  3. 发现一个骨灰级图形学大神的博客
  4. opengl 球纹理旋转源代码
  5. 12种主要的Dropout方法:如何应用于DNNs,CNNs,RNNs中的数学和可视化解释
  6. ClickHouse的特性及读写
  7. 深入理解 nvidia-docker 2.0
  8. html5触摸指定区域,HTML5/CSS3系列教程:HTML5 区域(Sectioning)的重要性
  9. Windows下使用python库 curses遇到错误消息的解决方案 1
  10. 多核环境下pthread调度执行bthread的过程
  11. hive多个表join_8个Hive数据仓工具面试题锦集!
  12. bug-箭头函数中this指向的问题
  13. DEDECMS首页调用单页文档内容并带过滤HTML的方法
  14. Java是传值还是传引用
  15. Robotium在输入框输入文字
  16. Kafka权威指南 —— 读书笔记
  17. 中职学校实验室安全整改总结报告
  18. 【每日一P】利用通道抠图更换天空
  19. 《1024伐木累》-小白篇之丽姐(前篇)-总章节四
  20. “车”的故事,我的信息化建设和管理愚见

热门文章

  1. B2C购物网站常用分类目录
  2. 基于EF框架的数据库操作方法
  3. 情人节,技术男可知单身女神的心声
  4. The 'mode' option has not been set以及Can't resolve './src'解决方法
  5. STM32CubeIDE 制作中英字库 显示屏显示中英文
  6. android 文本阅读,如何在Android中阅读文本文件?
  7. 鲸会务现场提问上线,大屏互动功能更全面
  8. 这届云栖大会很摇滚很美“乐队的夏天”也来了科技背后有程序员的吐槽 、产品经理的笑和泪
  9. 北京大学袁晓如:智能数据可视分析
  10. 1. 深度生成模型-扩散模型(非均衡热力学的深度无监督学习)