PTC FlexPLM rfa 工作流全局变量赋值 Workflow Global Variable

1.根据当前登录用户和工作流名称定位workitem

2.获取WfAssignedActivity

3.获取activity的ProcessData

4.取变量值或者赋值

5.保存变量新值

代码如下:

//工作流全局变量赋值
        wt.fc.ReferenceFactory rf = new wt.fc.ReferenceFactory();
        wt.workflow.work.WorkItem workitem =null;
        Collection collection = null;
        workitem=(wt.workflow.work.WorkItem) rf.getReference(WorkItemID).getObject();
        wt.workflow.work.WfAssignedActivity wfactivity = (wt.workflow.work.WfAssignedActivity) workitem.getSource().getObject();
        wt.workflow.engine.ProcessData processdata = wfactivity.getContext();        
        processdata.setValue("setUser",measurementUser);
        System.out.println(processdata);
        wfactivity.setContext(processdata);
        PersistenceHelper.manager.save(wfactivity);
        //执行工作流
        String workIds = "|~*~|"+WorkItemID;
        Collection workIdsCollection = MOAHelper.getMOACollection(workIds);
        WFHelper.getService().processWFTasks(workIdsCollection, workEvent);    

 

posted @ 2013-06-05 16:49  jackchain  阅读(450)  评论(0编辑  收藏  举报