`
li.feixiang
  • 浏览: 121230 次
  • 性别: Icon_minigender_1
  • 来自: 武汉
社区版块
存档分类
最新评论

copy user from team administrator to workflow team.

 
阅读更多

The code can be used directly in the workflow.

Notice the red string which should be fixed.

wt.inf.container.WTContainer c = wt.inf.container.WTContainerHelper.getContainer((wt.inf.container.WTContained)primaryBusinessObject);
wt.inf.container.WTContainerRef ref = wt.inf.container.WTContainerRef.newWTContainerRef(c);
wt.team.TeamTemplate team = wt.team.TeamHelper.service.getTeamTemplate(ref,"CostAnalysisReport team ");  
java.util.HashMap map = (java.util.HashMap)team.getRolePrincipalMap();         
wt.project.Role r = wt.project.Role.toRole("REVIEWER ");
wt.team.Team ateam = (wt.team.Team)(((wt.team.TeamManaged)self.getObject()).getTeamId().getObject());
java.util.List l = (java.util.List)map.get(r);
for(int i=0;i<l.size();i++){
wt.org.WTPrincipalReference rf = (wt.org.WTPrincipalReference)l.get(i);
Object obj = rf.getObject();
if (obj instanceof wt.org.WTGroup){
java.util.Enumeration en = ((wt.org.WTGroup)obj).members();
while(en.hasMoreElements()){
wt.org.WTUser user = (wt.org.WTUser)en.nextElement();
wt.team.TeamHelper.service.addRolePrincipalMap(r,user,ateam);
}
}else{
wt.team.TeamHelper.service.addRolePrincipalMap(r,(wt.org.WTUser)obj,ateam);
}
}
ateam = (wt.team.Team)wt.fc.PersistenceHelper.manager.refresh(ateam);
ateam = (wt.team.Team)wt.fc.PersistenceHelper.manager.save(ateam);
wt.team.TeamReference tt = wt.team.TeamReference.newTeamReference(ateam);
wt.team.TeamHelper.service.augmentRoles((wt.lifecycle.LifeCycleManaged)primaryBusinessObject,tt);

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics