1. 创建一个属性ObjectHandle
define attribute ObjectHandle store as string(256);
2. 将属性添加到PdmItem上去
attach dynamic attribute ObjectHandle to PdmItem;
3. 添加一个文本项
//.TXT 10notifsample001
//.Assignment: #VALMAINATTRB#
//.#LBODYOFNOTIF#
//.
//.To view the item, click the following link
//.http://localhost:9988/TCENT/controller/home?sdrcStartupPage=eds_open_generic_open_tab&activetab=FilesTab&eds_global_background_item_handle=#OBJECTHANDLE#
//.HLP
//.The body of the worklist notification message
4. 定义一个对象消息
define trusted external nondisplaying nonprompting published
object overridable message InflateObjectHandle (
update: ObjectPtr thisObj ::
output: integer *mfail
);
object overridable message InflateObjectHandle (
update: ObjectPtr thisObj ::
output: integer *mfail
);
5. 添加消息到PdmItem类上
attach object message InflateObjectHandle to PdmItem in server bbksvr;
6. 重载系统已有消息PdmItem:InflateDisplayInfo
attach object message InflateDisplayInfo to PdmItem in server bbksvr;
7. 撰写消息方法代码
//
// InflateObjectHandle 消息用于填充PdmItem对象的ObjectHandle属性值
//
message PdmItem:InflateObjectHandle (
update: ObjectPtr thisObj ::
output: integer *mfail
) code
{
MODNAME("PdmItem:InflateObjectHandle");
status dstat = OKAY;
string version = "0001";
string objectHandle = NULL;
*mfail = USC_OKAY;
if (dstat = ConstructObjectHandle(thisObj, version, NULL, NULL, &objectHandle, mfail))
{
goto EXIT;
}
if (*mfail) goto CLEANUP;
if (dstat = objSetAttribute(thisObj, ObjectHandleAttr, objectHandle))
{
goto EXIT;
}
CLEANUP:
if (objectHandle)
nlsStrFree(objectHandle);
update: ObjectPtr thisObj ::
output: integer *mfail
) code
{
MODNAME("PdmItem:InflateObjectHandle");
status dstat = OKAY;
string version = "0001";
string objectHandle = NULL;
*mfail = USC_OKAY;
if (dstat = ConstructObjectHandle(thisObj, version, NULL, NULL, &objectHandle, mfail))
{
goto EXIT;
}
if (*mfail) goto CLEANUP;
if (dstat = objSetAttribute(thisObj, ObjectHandleAttr, objectHandle))
{
goto EXIT;
}
CLEANUP:
if (objectHandle)
nlsStrFree(objectHandle);
EXIT:
if (dstat)
uiShowFatalError(dstat, WHERE);
return dstat;
if (dstat)
uiShowFatalError(dstat, WHERE);
return dstat;
}
;
;
//
// InflateDisplayInfo消息重载,首先调用原始方法,再调用InflateObjectHandle方法
//
message PdmItem:InflateDisplayInfo (
update: ObjectPtr thisObj ::
output: integer *mfail
) code
{
MODNAME("PdmItem:InflateDisplayInfo");
status dstat = OKAY;
*mfail = USC_OKAY;
if (dstat = InflateDisplayInfoAtParent(PdmItemClass, thisObj, mfail))
{
goto EXIT;
}
if (*mfail) goto CLEANUP;
if (dstat = InflateObjectHandle(thisObj, mfail))
{
goto EXIT;
}
if (*mfail) goto CLEANUP;
CLEANUP:
update: ObjectPtr thisObj ::
output: integer *mfail
) code
{
MODNAME("PdmItem:InflateDisplayInfo");
status dstat = OKAY;
*mfail = USC_OKAY;
if (dstat = InflateDisplayInfoAtParent(PdmItemClass, thisObj, mfail))
{
goto EXIT;
}
if (*mfail) goto CLEANUP;
if (dstat = InflateObjectHandle(thisObj, mfail))
{
goto EXIT;
}
if (*mfail) goto CLEANUP;
CLEANUP:
EXIT:
if (dstat)
uiShowFatalError(dstat, WHERE);
return dstat;
if (dstat)
uiShowFatalError(dstat, WHERE);
return dstat;
}
;
;
8. 修改NewWorkAssignment,Sig对象
点击Query菜单下面的Administrative Classes→Notification Configuration for Relations
在Event Name字段上输入值 NewWorkAssignment.
在Event Name字段上输入值 NewWorkAssignment.
Update the NewWorkAssignment,Sig object with the values shown following:
Field | Enter This Value |
Left Line Text ID | Replace 33lcmadm001 with the new text ID from MODeL. In this example, you enter 10notifsample001 (see the example in Step 1: Create MODeL Definitions, earlier in this chapter). |
Left Extra Subkeywords | Enter the new substitution parameter. In this example, you enter OBJECTHANDLE (see the example in Step 1: Create MODeL Definitions, earlier in this chapter). |
Left Extra Subattributes | Enter ObjectHandle. |
Mail Directives | Format the notification as HTML by entering:
Content-Type: text/html; charset=us-ascii |
点击OK按钮
9. 测试(将一个文档对象提交到工作流)